快速关闭屏幕渲染

快速关闭屏幕渲染

本文介绍了OpenGL的:快速关闭屏幕渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要渲染相当很多使用OpenGL离屏图像(几万)。
我在Windows下运行,并且使用QT作为一个框架。该解决方案可以是仅适用于Windows,它其实并不重要。

I need to render quite alot (tens of thousands) images off-screen using OpenGL.
I am running under Windows and using QT as a framework. the solution can be windows only, it doesn't really matter.

从我使用发现谷歌有许多这样做的选择这其中似乎有些过时文章提出几个方面,其中相关的有:

From what I've found using Google there are a number of options for doing thisThis article which seems rather dated suggest a few ways, out of which the relevant ones are:

  • 在Windows下使用 - 使用 CreateDIBSection 不知何故纹理绑定到它
  • 使用扩展pbuffer而使我似乎对我的卡的支持。
  • Windows specific - Use CreateDIBSection and somehow bind the texture to it.
  • Use the pbuffers extension which I seem to be supported on my card.

这个线程(消息6)建议做的QT特定的方式这种使用的QGLWidget :: renderPixmap

This thread (Message 6) suggests a QT specific way of doing this using QGLWidget::renderPixmap

我的问题是 - 这人会是最快的方法是什么? pBuffers,在似乎是最安全的赌注,因为它是保证硬件执行,但没有使用CreateDIB方法还要通过硬件?怎么样的QT的方法?似乎有一些与这一个背景下创造的问题。我肯定不会要创建我创建的每个图像的新环境。
没有任何一个具有这方面的一些好的经验?

My question is - which one would be the fastest way? pbuffers seems to be the safest bet because it is guaranteed to be performed on the hardware but isn't using the CreateDIB method also goes through the hardware? What about the QT method? there seem to be some context-creation issue with this one. surely I would not want to create a new context for every image I create.
Does any one has some good experience with this?


修改:回答评论 -
我有一个恒定的场景,不改变的一切,我从很多不同的角度呈现它。对于现在的图像返回到用户,并将由CPU处理。可能在将来他们会在GPU上以进行处理。

EDIT: Answering the comment -
I have a constant scene which doesn't change at all and I'm rendering it from many different viewpoints. For now the images go back to the user and will be processed by the CPU. Possibly in the future they are going to be processed on the GPU.

推荐答案

使用 FBO 。它的快速,便携和更漂亮比pBuffers,在使用。

Use FBO. It's fast, portable and much nicer to use than pbuffers.

编辑:为了获得最佳性能,两个不同的宗教组织之间的交替渲染:

For best performance, alternate rendering between two different FBOs:

  1. 渲染到A
  2. 渲染到B
  3. 从回读和处理它
  4. 渲染到A
  5. 阅读从B改回
  6. 转到2

这样,您可以一边阅读背一FBO然后再进行处理而GPU渲染到另一个平行。

This way you can be reading back one FBO and then processing it while the GPU renders to the other one in parallel.

这篇关于OpenGL的:快速关闭屏幕渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!