(web) add explicit check for failure to create context
This commit is contained in:
@@ -45,6 +45,11 @@ extern "C"
|
||||
|
||||
auto context = emscripten_webgl_create_context("#thermion_canvas", &attr);
|
||||
|
||||
if(!context) {
|
||||
std::cout << "Failed to create WebGL context" << std::endl;
|
||||
return context;
|
||||
}
|
||||
|
||||
std::cout << "Created WebGL context " << attr.majorVersion << "." << attr.minorVersion << std::endl;
|
||||
|
||||
auto success = emscripten_webgl_make_context_current((EMSCRIPTEN_WEBGL_CONTEXT_HANDLE)context);
|
||||
|
||||
Reference in New Issue
Block a user