diff --git a/Makefile.emscripten b/Makefile.emscripten index 52f9711060..0c15c8bd81 100644 --- a/Makefile.emscripten +++ b/Makefile.emscripten @@ -86,7 +86,7 @@ ifeq ($(HAVE_THREADS), 1) endif ifeq ($(HAVE_OPENGL), 1) - OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/emscriptenegl_ctx.o gfx/shader_glsl.o + OBJ += gfx/gl.o gfx/math/matrix.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/gfx_context.o gfx/context/emscriptenegl_ctx.o gfx/shader_glsl.o gfx/glsym/rglgen.o gfx/glsym/glsym_es2.o DEFINES += -DHAVE_OPENGL -DHAVE_OPENGLES -DHAVE_OPENGLES2 -DHAVE_EGL -DHAVE_OVERLAY -DHAVE_GLSL endif diff --git a/gfx/context/emscriptenegl_ctx.c b/gfx/context/emscriptenegl_ctx.c index 9c5f2516bd..363152c358 100644 --- a/gfx/context/emscriptenegl_ctx.c +++ b/gfx/context/emscriptenegl_ctx.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -52,10 +53,19 @@ static void gfx_ctx_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count) { (void)frame_count; - (void)width; - (void)height; + int iWidth, iHeight, isFullscreen; - *resize = false; + emscripten_get_canvas_size(&iWidth, &iHeight, &isFullscreen); + *width = (unsigned) iWidth; + *height = (unsigned) iHeight; + + if (*width != g_fb_width || *height != g_fb_height) + *resize = true; + else + *resize = false; + + g_fb_width = (unsigned) iWidth; + g_fb_height = (unsigned) iHeight; *quit = false; } @@ -167,8 +177,10 @@ static bool gfx_ctx_set_video_mode( return true; } -static bool gfx_ctx_bind_api(enum gfx_ctx_api api) +static bool gfx_ctx_bind_api(enum gfx_ctx_api api, unsigned major, unsigned minor) { + (void)major; + (void)minor; switch (api) { case GFX_CTX_OPENGL_ES_API: