Render to a FrameBufferObject


what is the best way to enable offscreen rendering for the V3d_View? (I´m using OCC in combination with Qt. And my constructor looks
like in this thread:
So far I have an init()-method where I initialize the FrameBufferObject:

void init()
Handle(Visual3d_View) visual3dView = m_view->View();
OpenGl_FrameBuffer *fboPtr = (OpenGl_FrameBuffer *) visual3dView->FBOCreate(width(), height());

const Graphic3d_CView *graphic3dCView = (const Graphic3d_CView *) visual3dView->CView();
const OpenGl_CView *openGlCView = (const OpenGl_CView *) graphic3dCView->ptrView;
Handle(OpenGl_Context) glContext = openGlCView->WS->GetGlContext(); // get glContext
Graphic3d_PtrFrameBuffer graphic3dFboPtr = (Graphic3d_PtrFrameBuffer) fboPtr;
visual3dView->FBOChangeViewport(graphic3dFboPtr, width(), height());

Then in the paint-method one should call visual3dView->BufferDump (Image_PixMap &theImage, const Graphic3d_BufferType &theBufferType).
But this approach does not seem to work (it crashes) !?
At first I tried to call visual3dView->FBOChangeViewport(...) from the paint-method() and not from the init-method() (like above). But then I noticed that the V3d_View() constantly autoupdates the window (e.g. after a call to Rotation(...)). But in my program only
rendering to a FrameBufferObject should be allowed, and every direct rendering call should be prevented (due to some odd error).

Thanks for any tips!

Daniel Park's picture


If you place the code in init() into your paintEvent(), it doesn't crash.
You might be able to help me with this problem :


Dimitrij's picture

Thanks. By the way, I found this method: V3d_View->SetImmediateUpdate(bool).
However I have not tested yet, wether it completely disables the auto-repainting of the V3d_View.