diff --git a/src/platform/generic.nim b/src/platform/generic.nim index 83ea793..be693ba 100644 --- a/src/platform/generic.nim +++ b/src/platform/generic.nim @@ -103,6 +103,10 @@ proc init_graphics*(engine: MyouEngine, width, height: int32, title: string, let rev = opengl_version mod 10 assert major >= 3 + if not gladLoadGLES2(nil): + echo "Could not initialize OpenGL" + quit -1 + engine.renderer.enqueue proc()= when not defined(release) and not defined(emscripten): proc f(source: GLenum, etype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: cstring, userParam: pointer) {.stdcall.} = diff --git a/src/platform/glfm_wrap.nim b/src/platform/glfm_wrap.nim index 28ec0ef..d8b68a4 100644 --- a/src/platform/glfm_wrap.nim +++ b/src/platform/glfm_wrap.nim @@ -227,10 +227,14 @@ proc init_graphics*(engine: MyouEngine, width, height: int32, title: string, window.glfmSetSurfaceCreatedFunc proc(window: Window, w,h: cint) {.cdecl.} = # force resize window.screen = window.screen + if not gladLoadGLES2(nil): + echo "Could not initialize OpenGL" + quit -1 window.screen.engine.renderer.initialize() window.glfmSetSurfaceDestroyedFunc proc(window: Window) {.cdecl.} = window.screen.engine.renderer.uninitialize() + when not defined(release) and not defined(emscripten): proc f(source: GLenum, etype: GLenum, id: GLuint, severity: GLenum, length: GLsizei, message: cstring, userParam: pointer) {.stdcall.} =