OpenGL 屏幕过渡效果?
任何人都熟悉使用普通 OpenGL 演示屏幕/页面转换效果的资源或示例源代码吗? (最好是 C/C++,而不是使用 QT)。
Anyone familiar with resources or sample source code that demonstrates screen/page transition effects using plain OpenGL? (Preferably C/C++ and not using QT).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我正确地解释你的问题,你有两个场景在 OpenGL 中渲染,并且你希望从一个场景移动到另一个场景。
几年前,我正在编写一款游戏,我想在其中有一个世界和一个战斗屏幕 - 就像最终幻想一样。 因此,我决定编写一个“令人震惊”的效果。 为此,我将当前场景渲染为纹理,将其映射到一组三角形,然后将三角形移开,同时在背景中渲染新场景。
为了将当前场景获取为纹理,假设您已经有一个纹理对象,可以使用 glCopyTexSubImage2D,如下所示:
glBindTexture(GL_TEXTURE_2D,textureID);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, 屏幕宽度, 屏幕高度);
If I'm interpreting your question right, you have two scenes rendering in OpenGL, and you wish to move from one to another.
I was programming a game a few years ago, in which I wanted to have a world and a battle screen - just like Final Fantasy. In that, I decided to program a "shattering" effect. In order to do so, I rendered the current scene to a texture, mapped it onto a set of triangles, then moved the triangles away, while rendering the new scene in the background.
In order to get your current scene as a texture, assuming you have a texture object already, you can use glCopyTexSubImage2D, as below:
glBindTexture(GL_TEXTURE_2D, textureID);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, screenWidth, screenHeight);