简体   繁体   English

SDL_Renderer opengl冲突

[英]SDL_Renderer opengl conflict

I'm new to openGL and SDL and I'm having some problems with a basic program I wrote. 我是openGL和SDL的新手,我编写的基本程序遇到一些问题。 I've narrowed it down and it seems like the problem is a conflict between the SDL_CreateRenderer function and how SDL manages OpenGL. 我已经缩小了范围,似乎问题出在SDL_CreateRenderer函数和SDL如何管理OpenGL之间。

Basically the program is a simple game, drawn with OpenGL, and the problem has risen with me creating a menu. 基本上,该程序是一个使用OpenGL绘制的简单游戏,而我创建菜单时出现了问题。 Since the game window was created with the "SDL_WINDOW_OPENGL" flag, I created another window for the menu. 由于游戏窗口是使用“ SDL_WINDOW_OPENGL”标志创建的,因此我为菜单创建了另一个窗口。 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...). 要在菜单窗口上绘制,虽然我需要创建一个渲染器,但是这样做之后,如果我尝试返回OpenGL窗口,则所有崩溃都会灾难性地崩溃(计算机速度变慢,所有响应均不响应...)。

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状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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