GL_INVALID_OPERATION quickfix

This commit is contained in:
gazer 2017-06-08 17:57:05 +03:00
parent b07a6d54a7
commit 3d4bf61bb8
2 changed files with 8 additions and 2 deletions

View File

@ -651,6 +651,8 @@ private __gshared GLSupport _glSupport;
return _glSupport;
}
__gshared bool glNoContext;
/// initialize OpenGL support helper (call when current OpenGL context is initialized)
bool initGLSupport(bool legacy = false) {
import dlangui.platforms.common.platform : setOpenglEnabled;
@ -1125,8 +1127,10 @@ class GLObject(GLObjectTypes type, GLuint target = 0) {
}
~this() {
unbind();
mixin("checkgl!glDelete" ~ to!string(type) ~ "s(1, &ID);");
if (!glNoContext) {
unbind();
mixin("checkgl!glDelete" ~ to!string(type) ~ "s(1, &ID);");
}
}
void bind() {

View File

@ -1595,6 +1595,8 @@ int sdlmain(string[] args) {
Log.d("Destroying SDL platform");
Platform.setInstance(null);
static if (ENABLE_OPENGL)
glNoContext = true;
releaseResourcesOnAppExit();