Drawing into new WebGL context after rendering with SDL2

19 views
Skip to first unread message

Richard Russell

unread,
Sep 23, 2020, 9:06:59 AM9/23/20
to emscripten-discuss
In my application I initially render using native SDL2 (i.e. calling SDL_RenderPresent) and later set up a new context (SDL_GL_CreateContext) in which I draw using custom shaders and display using SDL_GL_SwapWindow.  This works fine on all OpenGL and OpenGLES platforms, but in Emscripten / WebAssembly I get a black screen after creating the new WebGL context and my shader-rendered graphics don't appear.

There are no errors in the console, and I can return to the SDL2 context successfully (SDL_GL_MakeCurrent) but I just can't get any of the shader-drawn graphics to appear.  The shaders are compiling successfully.  I am yielding my main loop back to the browser immediately after calling SDL_GL_SwapWindow which I assume is the correct thing to do.

Are there any specific issues I need to be aware of when initially rendering using SDL2 and later wanting to switch to using custom shaders?
Reply all
Reply to author
Forward
0 new messages