PDA

View Full Version : initialization of FBO



schr_10
12-29-2010, 08:16 PM
Hi,
I have a scene that can be manipulated by user interaction. When there changes to the orientation, I draw the scene in an encoded fashion to an FBO, which works well.
I can't figure out how to call this encoding upon the first draw though. I don't want to call the encoding during every paint event, only those that change orientation of the scene.
I thought I could call my FBO encoder as the last call of initializeGL, but this is not working, I get an illegal framebuffer operation in this case.
1) How can I draw to an FBO as a one off upon initialization?
Of course I can make a first_pass flag in paintGL and do it from there, but it seems messy to have a statement in paintGL that is only used to call a function once.
2) Why can't I draw from the last line of initializeGL? It seems the context is valid, but something prevents the draw to the FBO from working.

Hope someone can assist!
Soren

Alfonse Reinheart
12-29-2010, 09:09 PM
It's kind of hard to know what your problem is since we don't know what "initializeGL" and "paintGL" are. We don't have your code.

schr_10
12-31-2010, 06:01 AM
sorry, that was QT speak.
initializeGL is the initialization function, I would assume analogous to glutInit
paintGL is analogous to the function passed to glutDisplayFunc.
So I guess the question is whether one should be able to draw to the FBO during initialization - generally?
It may be that my problem is Qt specific if so I'll take it to the appropriate forum.