OpenGL: Fast off-screen rendering
Asked Answered
C

1

5

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.

Crescendo answered 18/10, 2008 at 2:39 Comment(3)
Where are the images coming from? Are you rendering the same scene over and over again, perhaps from different viewpoints? Or are you loading texture after texture from disk? And where do the images go? Into a gpu computation? Onto disk? Your answer depends on the details.Jammie
Answered in the questionCrescendo
Maybe this link can be useful, here I used framebuffer objects with QGLFrameBuffer #19934602Laughable
F
8

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.

Feathers answered 18/10, 2008 at 3:30 Comment(5)
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?Crescendo
Rendering to a renderbuffer is preferable; if may be faster and certainly won't be any slower.Feathers
better PBO link #12158146Willamina
Another anwer involving offscreen rendering with FBOs: #14785507.Disentitle
Does not answer the question.Caviar

© 2022 - 2024 — McMap. All rights reserved.