OpenGL中的低分辨率以模仿较旧的游戏 [英] low resolution in OpenGL to mimic older games

查看:47
本文介绍了OpenGL中的低分辨率以模仿较旧的游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我感兴趣的是,如何模拟在OpenGL中模拟较早游戏(如Atari 2600)的低分辨率以进行fps游戏的正确方法.我想最好的方法是将缓冲区写入纹理,放在四边形上,然后将其显示为屏幕分辨率.

I'm interested in know how is the right way to mimic the low resolution of the older games (like Atari 2600) in OpenGL to do a fps game. I imagine the best way to do it is writing the buffer into a texture, put onto a quad and display it to the screen resolution.

看看 http://www.youtube.com/watch?v= _ELRv06sa-c ,例如(很棒的游戏!)

Take a look of http://www.youtube.com/watch?v=_ELRv06sa-c, for example (great game!)

任何建议,帮助或示例代码都将受到欢迎.

Any advice, help or sample-code will be welcome.

推荐答案

我认为最好的方法就是像您所说的那样,将所有内容渲染为低分辨率纹理(最好使用

I think the best way to do it would be like you said, render everything into a low-res texture (best done using FBOs) and then just display the texture by drawing a sceen-sized quad (of course using GL_NEAREST as magnification filter for the texture). Maybe you can also use glBlitFramebuffer for copying directly from the low-res FBO into the high-res framebuffer, although I don't know if you can copy directly into the default framebuffer (the displayed one) this way.

编辑:查找 framebuffer_blit的规范后似乎您可以使用glBlitFramebuffer(EXT/ARB)从低分辨率FBO复制到高分辨率默认帧缓冲区.这可能比使用纹理映射的四边形更快,因为它完全绕过了顶点-碎片-流水线(尽管这很简单).另一个优点是,如果需要,您还可以获得低分辨率的深度和模板缓冲区,并且可以通过这种方法在低分辨率的背景之上渲染高分辨率的内容,这可能是一个有趣的效果.因此,它将以某种方式发生:

After looking up the specification for framebuffer_blit it seems you can just copy from the low-res FBO into the high-res default framebuffer using glBlitFramebuffer(EXT/ARB). This might be faster than using a texture mapped quad as it completely bypasses the vertex-fragment-pipeline (although this would have been a simple one). And another advantage is that you also get the low-res depth and stencil buffers if needed and can this way render high-res content on top of the low-res background which might be an interesting effect. So it would happen somehow like this:

generate FBO with low-res renderbuffers for color and depth (and stencil)
...
glBindFramebuffer(GL_FRAMEBUFFER, lowFBO);
render_scene();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, 640, 480, 0, 0, 1024, 768, 
    GL_COLOR_BUFFER_BIT [| GL_DEPTH_BUFFER_BIT], GL_NEAREST);

这篇关于OpenGL中的低分辨率以模仿较旧的游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆