]> O.S.I.I.S - jp/crow.git/commitdiff
implement IDisposable for InterfaceControler class
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 31 Jan 2017 14:59:12 +0000 (15:59 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 31 Jan 2017 14:59:12 +0000 (15:59 +0100)
Tests/InterfaceControler.cs

index 12ddf7d8b0682767b10621af74081d249ed042ff..766a328d9c8ea0b6591fe5a853c4c5f2cca05074 100644 (file)
@@ -43,7 +43,7 @@ namespace Crow
                        get { return ifaceModelMat * modelview * projection; }
                }
 
-               public override void initGL(){                  
+               public override void initGL(){
                        quad = new Crow.vaoMesh (0, 0, 0, 1, 1, 1, -1);
                        //ifaceModelMat = Matrix4.CreateRotationX(MathHelper.PiOver2) * Matrix4.CreateTranslation(Vector3.UnitY);
                        CrowInterface.ProcessResize(iRect);
@@ -106,7 +106,7 @@ namespace Crow
                        return vec;
                }
        }
-       public class InterfaceControler {
+       public class InterfaceControler : IDisposable {
                public Interface CrowInterface;
                public int texID;
                public vaoMesh quad;
@@ -194,7 +194,7 @@ namespace Crow
                #endregion
 
                #region graphic context
-               public virtual void initGL(){                   
+               public virtual void initGL(){
                        projection = OpenTK.Matrix4.CreateOrthographicOffCenter (-0.5f, 0.5f, -0.5f, 0.5f, 1, -1);
                        quad = new Crow.vaoMesh (0, 0, 0, 1, 1, 1, -1);
                        createContext ();
@@ -244,6 +244,18 @@ namespace Crow
                        #endif
                }
                #endregion
+
+               #region IDisposable implementation
+
+               public void Dispose ()
+               {
+                       if (GL.IsTexture(texID))
+                               GL.DeleteTexture (texID);
+                       if (quad != null)
+                               quad.Dispose ();
+               }
+
+               #endregion
        }
 }