c++ - 如何在 OpenGL 中使用 SDL2 软件渲染?

标签 c++ sdl-2 opengl-3

我正在创建一个 3D 游戏,我想知道如何混合使用 SDL2 软件(表面)渲染和 OpenGL。我尝试使用此代码呈现简单文本,但它不起作用。

glClearColor(0,0,1,1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
SDL_BlitSurface(surf,0,dest,0);
SDL_GL_SwapWindow(win);

问题是什么?

最佳答案

I am taking about updating window surface via SDL_UpdateWindowSurface on SDL_Window created with SDL_WINDOW_OPENGL flag

那是 specifically prohibited by the API :

You may not combine this [SDL_GetWindowSurface] with 3D or the rendering API on this window.

关于c++ - 如何在 OpenGL 中使用 SDL2 软件渲染?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58732911/

相关文章:

c++ - 将C++ Builder应用程序与外部dll一起使用

c++ - header 中定义的 C++ 类方法是否始终内联?

c++ - 在 OS X 上将 SDL2 与 CLion 结合使用

C++ vector 大小为零

c++ - 使用 OpenCV 进行 UV 映射 OpenGL

macos - 更改默认 OpenGL 上下文配置文件版本

c++ - 帮助将 C++ 代码转化为函数

c++ - 我们可以在一个 STL 列表中保存 2 种数据类型吗?

c - 声明任何标准变量时 SDL 崩溃

c++ - glGetActiveUniformName 的异常行为