
Thu, 03/13/2014 - 20:11
Hi,
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: http://www.opencascade.org/org/forum/thread_25450/?forum=3)
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
fboPtr->BindBuffer(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).
Right?
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!
Mon, 03/17/2014 - 05:43
Hello,
If you place the code in init() into your paintEvent(), it doesn't crash.
You might be able to help me with this problem : http://www.opencascade.org/org/forum/thread_25916/?forum=3
Thanks
Daniel
Tue, 03/18/2014 - 00:07
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.