mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-24 08:47:02 +00:00
Check that OpenGL resources have really been allocated, before deleting them in Unload().
This commit is contained in:
parent
9a32ce9f55
commit
90253d5f62
|
@ -206,11 +206,14 @@ namespace Examples.Tutorial
|
|||
public override void OnUnload(EventArgs e)
|
||||
{
|
||||
// Clean up what we allocated before exiting
|
||||
if (ColorTexture != 0)
|
||||
GL.DeleteTextures(1, ref ColorTexture);
|
||||
GL.DeleteTextures(1, ref DepthTexture);
|
||||
GL.Ext.DeleteFramebuffers(1, ref FBOHandle);
|
||||
|
||||
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,11 +191,14 @@ namespace Examples.Tutorial
|
|||
|
||||
#endregion
|
||||
|
||||
#region OnUnLoad
|
||||
#region OnUnload
|
||||
|
||||
public override void OnUnload(EventArgs e)
|
||||
{
|
||||
if (TextureObject != 0)
|
||||
GL.DeleteTextures(1, ref TextureObject);
|
||||
|
||||
if (ProgramObject != 0)
|
||||
GL.DeleteProgram(ProgramObject); // implies deleting the previously flagged ShaderObjects
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue