Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenGL: Fast off-screen rendering

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.

like image 635
shoosh Avatar asked Oct 18 '08 02:10

shoosh


1 Answers

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.

like image 99
House MD Avatar answered Sep 26 '22 16:09

House MD