[vtkusers] Conflict VTK and QGLViewer
Clinton Stimpson
clinton at elemtech.com
Wed Jun 22 11:45:17 EDT 2011
On Wednesday, June 22, 2011 03:43:46 am Ralph Brecheisen wrote:
> Hi,
>
> We're developing a research tool that uses QVTKWidget to integrate VTK
> rendering in a Qt application. For this application, I'm currently working
> on a widget that extends from QGLViewer. In this widget I want to display a
> 2D map of floats (a 256x128 height field). Since I cannot find a way to do
> this in Qt with either QPixmap or QImage (they both require specific image
> formats which I don't have) I'm using OpenGL to do this. This works fine
> except for the fact that it messes up depth sorting and face culling in the
> vtkRenderer of the QVTKWidget. For some reason, the GL context in the
> QGLViewer is left in an unknown state which confuses the VTK rendering.
>
> In the QGLWidget I'm trying to keep the OpenGL-specific render statements
> together in a single function and call glPushAttrib( GL_ALL_ATTRIB_BITS )
> and glPopAttrib() at the beginning and end. I'm also pushing and popping
> all transformation matrices. Still I'm getting these rendering problems in
> VTK. If I don't create the GL widget, everythings works fine.
>
> Any idea how I could solve this?
Are you sharing a context between the two?
Could you try overloading QGLWidget::glDraw() and call the superclass glDraw()
then call doneCurrent(), to see if that fixes your problem.
You might be seeing an optimization in QtOpenGL on handling the current
context, where it only considers contexts created with QGLContext and doesn't
call the underlying OpenGL api to get the current context.
Or you may consider trying the new QVTKWidget2 which is based on QGLWidget.
--
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com
More information about the vtkusers
mailing list