Add check to Release() method of OpenGl_Texture, OpenGl_ShaderObject, OpenGl_ShaderProgram
Standard_ASSERT_RETURN (theCtx != NULL,
"OpenGl_ShaderObject destroyed without GL context! Possible GPU memory leakage...",);
- if (theCtx->core20 != NULL)
+ if (theCtx->core20 != NULL
+ && theCtx->IsValid())
{
theCtx->core20->glDeleteShader (myShaderID);
}
anIter.ChangeValue().Nullify();
}
- if (theCtx->core20 != NULL)
+ if (theCtx->core20 != NULL
+ && theCtx->IsValid())
{
theCtx->core20->glDeleteProgram (myProgramID);
}
Standard_ASSERT_RETURN (theGlCtx != NULL,
"OpenGl_Texture destroyed without GL context! Possible GPU memory leakage...",);
- glDeleteTextures (1, &myTextureId);
+ if (theGlCtx->IsValid())
+ {
+ glDeleteTextures (1, &myTextureId);
+ }
myTextureId = NO_TEXTURE;
mySizeX = mySizeY = 0;
}