Call gladLoadGLES2 in mobile to properly detect supported extensions.

This commit is contained in:
Alberto Torres 2024-09-04 02:44:26 +02:00
parent d9778546b5
commit e4b918b384
2 changed files with 8 additions and 0 deletions

View file

@ -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.} =

View file

@ -227,11 +227,15 @@ 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.} =
if id == 131185: