mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
Emscripten: fix incorrect error check for WebGL context creation
According to the documentation and testing the `emscripten_webgl_create_context` function returns `0` on error as oppposed to a negative number. This was causing the error message to be empty when the later `emscripten_webgl_make_context_current` call fails given the invalid context. See https://emscripten.org/docs/api_reference/html5.h.html#c.emscripten_webgl_create_context
This commit is contained in:

committed by
Sam Lantinga

parent
fcdaff4110
commit
7e1d4f843c
@@ -101,7 +101,7 @@ SDL_GLContext Emscripten_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *
|
|||||||
|
|
||||||
context = emscripten_webgl_create_context(window_data->canvas_id, &attribs);
|
context = emscripten_webgl_create_context(window_data->canvas_id, &attribs);
|
||||||
|
|
||||||
if (context < 0) {
|
if (!context) {
|
||||||
SDL_SetError("Could not create webgl context");
|
SDL_SetError("Could not create webgl context");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user