简体   繁体   中英

SDL_Renderer opengl conflict

I'm new to openGL and SDL and I'm having some problems with a basic program I wrote. I've narrowed it down and it seems like the problem is a conflict between the SDL_CreateRenderer function and how SDL manages OpenGL.

Basically the program is a simple game, drawn with OpenGL, and the problem has risen with me creating a menu. Since the game window was created with the "SDL_WINDOW_OPENGL" flag, I created another window for the menu. Whenever I need to switch between game and menu I just hide and show whichever window I need. To draw on the menu window though I need to create a renderer but after doing so, if I try to go back to the OpenGL window everything crashes catastrophically (computer slows down, everything is unresponsive...).

Can anyone guess where the problem could lie? Or can anyone suggest a better way to solve my game-menu problem?

不要尝试互操作OpenGL和SDL_Renderer:即使您可以保证您的平台没有/没有实现针对OpenGL的SDL_Renderer,SDL_Renderer API也无法正确设置/恢复SDL_Renderer使用的OpenGL状态。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM