Christian Bar
2015-12-03 14:33:22 UTC
Dear All,
I am trying to create an OpenSG application that renders some OpenSG noded
and, in addition, also renders VTK data.
I am aware of the ContribVTK lib, but I'd like to do a different thing,
which is to render a vtk scene in an OpenGL context created by OpenSG. This
can be accomplished by the *ExternalVTKWidget *and
*vtkExternalOpenGLRenderWindow*, which should do just like what I want.
I successfully ran the VTK example that demonstrate the two classes above
and render some vtk actors and some plain GL code inside a glut window (
*TestGLUTRenderWindow*).
Then, I tried to copy the code and put it inside the basic OpenSG example
(01hello).
What I get is a crash when I call
*externalVTKWidget->GetRenderWindow()->Render()
*during the first render (called in the glut display function). Such crash
do no happen when I use vtk and glut, withouth OpenSG.
The crash is caused because vtk internally calls *glGetString(GL_VERSION)*,
and this returns null, which obviously is an error. BTW, if I call
*glGetString(GL_VERSION)
*BEFORE *GLUTWindow->init()*, it returns the correct string ("4.5.0 NVIDIA
348.07"). Is glew somehow related to this? I thought that *GLUTWindow *already
calls the *wglMakeCurrent* (and related stuff), so I should already have a
valid OpenGL context...
BTW (again), *glGetString(GL_VERSION) *always return null after a
*GLUTWindow->init()*, even if I do not use VTK.
Now, the real question is: do I have to build OpenSG and VTK in a way that
makes them compatible? What are the CMAKE options that manage this?
Has anyone ever tried to mix OpenSG and VTK?
My machine runs Windows 8 and I am building the application with Visual
Studio 2010 x64.
VTK version is 6.3 and OpenSG 2.0 (updated from git)
Many thanks to anyone that could give me some advice :)
Kind regards,
Christian Bar
I am trying to create an OpenSG application that renders some OpenSG noded
and, in addition, also renders VTK data.
I am aware of the ContribVTK lib, but I'd like to do a different thing,
which is to render a vtk scene in an OpenGL context created by OpenSG. This
can be accomplished by the *ExternalVTKWidget *and
*vtkExternalOpenGLRenderWindow*, which should do just like what I want.
I successfully ran the VTK example that demonstrate the two classes above
and render some vtk actors and some plain GL code inside a glut window (
*TestGLUTRenderWindow*).
Then, I tried to copy the code and put it inside the basic OpenSG example
(01hello).
What I get is a crash when I call
*externalVTKWidget->GetRenderWindow()->Render()
*during the first render (called in the glut display function). Such crash
do no happen when I use vtk and glut, withouth OpenSG.
The crash is caused because vtk internally calls *glGetString(GL_VERSION)*,
and this returns null, which obviously is an error. BTW, if I call
*glGetString(GL_VERSION)
*BEFORE *GLUTWindow->init()*, it returns the correct string ("4.5.0 NVIDIA
348.07"). Is glew somehow related to this? I thought that *GLUTWindow *already
calls the *wglMakeCurrent* (and related stuff), so I should already have a
valid OpenGL context...
BTW (again), *glGetString(GL_VERSION) *always return null after a
*GLUTWindow->init()*, even if I do not use VTK.
Now, the real question is: do I have to build OpenSG and VTK in a way that
makes them compatible? What are the CMAKE options that manage this?
Has anyone ever tried to mix OpenSG and VTK?
My machine runs Windows 8 and I am building the application with Visual
Studio 2010 x64.
VTK version is 6.3 and OpenSG 2.0 (updated from git)
Many thanks to anyone that could give me some advice :)
Kind regards,
Christian Bar