views:

3032

answers:

2

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 this This article which seems rather dated suggest a few ways, out of which the relevant ones are:

  • Windows specific - Use CreateDIBSection and somehow bind the texture to it.
  • Use the pbuffers extension which I seem to be supported on my card.

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

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?


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.

A: 

Have you reviewed amateur game dev sites? They focus on performance rendering often & might be able to help you.

Paul Nathan
+5  A: 

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

EDIT: For best performance, alternate rendering between two different FBOs:

  1. Render to A
  2. Render to B
  3. Read back from A and process it
  4. Render to A
  5. Read back from B
  6. Goto 2

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

House MD
Yes I've just read about FBO. alternating between two sounds like a good idea. Do you know if there's a difference between rendering to a Texture and rendering to a RenderBuffer? which is faster?
shoosh
Rendering to a renderbuffer is preferable; if may be faster and certainly won't be any slower.
House MD