aboutsummaryrefslogtreecommitdiffstatsci
path: root/Tests
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2017-01-31 15:59:12 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2017-01-31 15:59:12 +0100
commit0a849b1c2abec63eedc13eb473e2c477c8155a2a (patch)
tree38d87745c5579c0a0723b4b45fafc3dbf3aaf58e /Tests
parentcfb314bd4fe70c83f43bb254bcc1bdb54b2dc827 (diff)
implement IDisposable for InterfaceControler class
Diffstat (limited to 'Tests')
-rw-r--r--Tests/InterfaceControler.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Tests/InterfaceControler.cs b/Tests/InterfaceControler.cs
index 12ddf7d8..766a328d 100644
--- a/Tests/InterfaceControler.cs
+++ b/Tests/InterfaceControler.cs
@@ -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
}
}