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

查看:22
本文介绍了以非常大的图像分辨率捕获 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.

请注意:如果您创建的窗口比桌面大,那些不在视野中的像素将无法通过像素所有权测试.因此,这些像素的内容未定义.它们可能包含您想要的内容,但可能没有.

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.

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

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天全站免登陆