我正在尝试使用SDL2创建一个带有两个窗口的应用程序。为了使绘制过程更快并能够运行3d动画,我使用OpenGL。但是,当我打开第二个窗口时,如何对OpenGL(gl函数)说要在第二个窗口中绘制呢?我搜索了libsdl Wiki,但找不到任何东西。
您正在寻找SDL_GL_MakeCurrent
功能。
使用此功能可以设置用于渲染到OpenGL窗口中的OpenGL上下文。
例:
SDL_GL_MakeCurrent(window, gl_context);
// OpenGL functions will draw to window
// ...
SDL_GL_MakeCurrent(window2, gl_context);
// OpenGL functions will draw to window2
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句