OpenGL 屏幕过渡效果?

发布于 2024-07-18 02:42:53 字数 70 浏览 2 评论 0原文

任何人都熟悉使用普通 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖树树初阳… 2024-07-25 02:42:53

如果我正确地解释你的问题,你有两个场景在 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);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文