以非常大的图像分辨率捕获OpenGL窗口的快照 [英] Capture snapshot of OpenGL window with very large image resolution

查看:102
本文介绍了以非常大的图像分辨率捕获OpenGL窗口的快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用glReadPixels在各种相机位置和变化的图像分辨率下拍摄OpenGL渲染的3D世界的快照.对于实现OpenGL Windows程序的GUI库,我有两种选择:Qt和freeglut.经过对两者的一些实验,我意识到Qt不会将其QGLWidget快照的图像分辨率限制为桌面大小,但是我无法对freeglut做同样的事情.

I am currently trying to take snapshots of an OpenGL rendered 3D world at various camera positions and varying image resolution using glReadPixels. I have two choices for the GUI library that implements the OpenGL windows program: Qt and freeglut. After a few experiments on both, I realise that Qt does not limit the image resolution of its snapshots of a QGLWidget to the desktop size but I could not do the same for freeglut.

我希望我可以将Qt用于此快照捕获程序,但我仅限于过分使用,因为正在同一个程序的另一个模块上工作的项目团队伙伴无法花时间学习新的库和IDE(Qt Creator) .他正在使用Visual Studio 2008.

I wish I could use Qt for this snapshot grabbing program but I am limited to glut because my project team mate who is working on another module of the same program cannot afford the time to learn a new library and IDE (Qt Creator). He is using Visual Studio 2008.

我是否仍然可以创建一个不受桌面大小限制且可以高达4000 x 2000的glut窗口?

Is there anyway for me to create a glut window that is not limited by the desktop size and can be as large as 4000 x 2000?

推荐答案

在对两者进行一些实验之后,我意识到Qt不会将其QGLWidget快照的图像分辨率限制为桌面大小,但是我无法对freeglut做同样的事情.

After a few experiments on both, I realise that Qt does not limit the image resolution of its snapshots of a QGLWidget to the desktop size but I could not do the same for freeglut.

警告:如果创建的窗口大于桌面,则那些不在视野中的像素将无法通过像素所有权测试.因此,这些像素的内容是 undefined .它们可能包含您想要的内容,但可能没有.

Be warned: if you create a window that is larger than the desktop, those pixels that are not in view do not pass the pixel-ownership test. Therefore, the contents of those pixels is undefined. They may contain what you want, but they may not.

对于任何不可见的像素都是如此,无论该窗口是刚刚离开桌面还是被另一个窗口覆盖.

This is true for any pixels that are not visible, whether the window is just off the desktop or being covered by another window.

无论如何,您不应该创建一个桌面大小的窗口.您应该创建一个普通窗口,并制作一个包含大颜色的帧缓冲对象和深度渲染缓冲区.将所有渲染都渲染到这些屏幕外缓冲区.这样您就不必担心窗口的大小限制了.

Anyway, you shouldn't be creating a window the size of your desktop. You should be creating a normal window, and making a framebuffer object that contains a large color and depth renderbuffer. Do all of your rendering to these off-screen buffers. Then you won't have to worry about size limitations of your window.

尽管您会受到渲染缓冲区的最大大小以及最大视口大小的限制.

Though you will be limited by the maximum size of renderbuffers, as well as the maximum viewport size.

这篇关于以非常大的图像分辨率捕获OpenGL窗口的快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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