2D 引擎通过硬件在 OpenGL 上滚动?

发布于 2024-08-23 14:48:06 字数 289 浏览 4 评论 0原文

我使用 OpenGL 作为 2D 平铺引擎的底端。 当一切都是二维时,优化某些问题就很简单。 例如,滚动。如果我知道屏幕的某个部分 需要从底部滚动,然后我可以直接跳过该部分。 我晚上一次移动超过 1 个像素。没有显式硬件 支持(想想旧的任天堂硬件),这需要大量的像素写入。一个 芯片上的 bitblt 将是下一个最好的选择。

本质上,我正在研究如何优化我的 GL 调用以使用 VRAM 纹理渲染为高效的硬件位块传送。

是否可以让 GL 滚动帧缓冲区,或者我应该只是 屈服于双缓冲并重新渲染整个场景 对于每一帧?

谢谢

I'm using OpenGL as the bottom end for a 2D tiling engine.
When everything is 2D, it is simple to optimize certain issues.
For example, scrolling. If I know a certain section of the screen
needs to scroll off the bottom, then I can just blit over that portion.
I'm evening moving more than 1 pixel at a time. Without explicit hardware
support (think old nintendo hw), this requires a lot of pixel writes. An
on chip bitblt would be the next best thing.

Essentially, I'm looking at how I can optimize my GL calls to use
VRAM texture renders as efficient hardware blits.

Is it possible to have GL scroll the framebuffer, or should I just
resign myself to double-buffering and re-rendering an entire scene
for each frame?

Thx

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

你的心境我的脸 2024-08-30 14:48:06

我不知道你将如何解决,至少,每帧都使用纹理进行全屏矩形渲染(当它实际滚动时)。我有一段时间没有看到在显卡上移动帧缓冲区指针的功能了。

但是,您可以限制渲染每帧所需的场景量。如果将滚动场景保留为纹理,则可以绑定到屏幕外帧缓冲区并渲染其无效部分。然后,您只需使用 UV 操作来完成最终的全屏矩形块传输。

I don't see how you will get around, at the very least, doing a fullscreen rect render with a texture every frame (when it's actually scrolling). I haven't seen the ability to move the frame buffer pointer on graphics cards for a while now.

However, you can limit how much of the scene you need to render every frame. If you keep your scrolling scene as a texture, you can bind to an offscreen frame buffer and render over the invalidated part of it. Then, you just use UV manipulation to do your final full screen rectangle blit.

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