Check that OpenGL resources have really been allocated, before deleting them in Unload().
This commit is contained in:
parent
6e5eaf4653
commit
37755cb398
2 changed files with 13 additions and 7 deletions
|
@ -206,11 +206,14 @@ namespace Examples.Tutorial
|
|||
public override void OnUnload(EventArgs e)
|
||||
{
|
||||
// Clean up what we allocated before exiting
|
||||
GL.DeleteTextures(1, ref ColorTexture);
|
||||
GL.DeleteTextures(1, ref DepthTexture);
|
||||
GL.Ext.DeleteFramebuffers(1, ref FBOHandle);
|
||||
if (ColorTexture != 0)
|
||||
GL.DeleteTextures(1, ref ColorTexture);
|
||||
|
||||
base.OnUnload(e);
|
||||
if (DepthTexture != 0)
|
||||
GL.DeleteTextures(1, ref DepthTexture);
|
||||
|
||||
if (FBOHandle != 0)
|
||||
GL.Ext.DeleteFramebuffers(1, ref FBOHandle);
|
||||
}
|
||||
|
||||
protected override void OnResize(OpenTK.Platform.ResizeEventArgs e)
|
||||
|
|
|
@ -191,12 +191,15 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region OnUnLoad
|
||||
#region OnUnload
|
||||
|
||||
public override void OnUnload(EventArgs e)
|
||||
{
|
||||
GL.DeleteTextures(1, ref TextureObject);
|
||||
GL.DeleteProgram(ProgramObject); // implies deleting the previously flagged ShaderObjects
|
||||
if (TextureObject != 0)
|
||||
GL.DeleteTextures(1, ref TextureObject);
|
||||
|
||||
if (ProgramObject != 0)
|
||||
GL.DeleteProgram(ProgramObject); // implies deleting the previously flagged ShaderObjects
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue