Reputation: 143
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.
Upvotes: 5
Views: 6614
Reputation:
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
Upvotes: 11