I am trying to make one application with two windows with SDL2. To make draw process faster and capable to run 3d animations I am using OpenGL. But when I open second window, how can I said to OpenGL (gl functions) to draw in second window? I searched into libsdl wiki but cant find anything.
You are looking for the SDL_GL_MakeCurrent
function.
Use this function to set up an OpenGL context for rendering into an OpenGL window.
Example:
SDL_GL_MakeCurrent(window, gl_context);
// OpenGL functions will draw to window
// ...
SDL_GL_MakeCurrent(window2, gl_context);
// OpenGL functions will draw to window2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With