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; return _glSupport;
} }
__gshared bool glNoContext;
/// initialize OpenGL support helper (call when current OpenGL context is initialized) /// initialize OpenGL support helper (call when current OpenGL context is initialized)
bool initGLSupport(bool legacy = false) { bool initGLSupport(bool legacy = false) {
import dlangui.platforms.common.platform : setOpenglEnabled; import dlangui.platforms.common.platform : setOpenglEnabled;
@ -1125,9 +1127,11 @@ class GLObject(GLObjectTypes type, GLuint target = 0) {
} }
~this() { ~this() {
if (!glNoContext) {
unbind(); unbind();
mixin("checkgl!glDelete" ~ to!string(type) ~ "s(1, &ID);"); mixin("checkgl!glDelete" ~ to!string(type) ~ "s(1, &ID);");
} }
}
void bind() { void bind() {
static if(target != 0) static if(target != 0)

View File

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