[vtkusers] Qt and VTK, vtkTexture and vtkImager
Carsten Kübler
kuebler at ira.uka.de
Fri Sep 22 06:03:28 EDT 2000
Hej vtkdevelopers and users,
during my work to combine qt and vtk (yes I know that there are a few
people who did the same) I noticed several problems with vtk. I wrote a
"new" RenderWindow, RenderWindowInteractor (bases on the version Manish
P. Pagey), ImageWindow, Texture, PolyDataMapper, Imager and an
object-factory for the use of my classes.
And there are a view "bugs" in the vtk 3.1.2 code.
1. vtkOpenGLTexture
#ifdef _WIN32
((vtkWin32OpenGLRenderWindow *)
(ren->GetRenderWindow()))->RegisterTextureResource( this->Index
);
#else
((vtkOpenGLRenderWindow *)
(ren->GetRenderWindow()))->RegisterTextureResource( this->Index
);
#endif
2. vtkOpenGLPolyDataMapper
#ifdef _WIN32
((vtkWin32OpenGLRenderWindow *)
(ren->GetRenderWindow()))->MakeCurrent();
#else
((vtkOpenGLRenderWindow *)
(ren->GetRenderWindow()))->MakeCurrent();
#endif
The two classes ignore other OpenGL implementations like mine and other
vtk/qt implementations.
I propose the redesign of the opengl-implementation of all vtkWindows.
There are 7 classes with "almost" the same gl-code (win32 doesn't clear
the lights during destructing the RenderWindow, win32 uses
VTK_MAX_LIGHTS instead of MAX_LIGHTS, and a lot of other small
differences).
My suggestion.
The vtkWindow has a new aggregated object vtkGraphicExtension. All
OpenGL specific code is in a derived vtkOpenGLGraphicsExtension. All
plattform dependent implementations of vtkWindow use the same
vtkOpenGLGraphicsExtension and use OOP instead of #ifdef !!!! So all
developers of a new vtkOpenGLWindow have not to cut and paste the OpenGL
specific code out of one of seven possible implementations.
Rewrite the 2 classes:
1. vtkOpenGLTexture
((vtkOpenGLGraphicsExtension *)
(ren->GetGraphicExtension()))->RegisterTextureResource(
this->Index );
2. vtkOpenGLPolyDataMapper
((vtkOpenGLGraphicsExtension *)
(ren->GetGraphicExtension()))->MakeCurrent( );
------
Why does a texture register at a vtkRenderWindow but has no possibility
to unregister???
------
The vtkOpenGLImager clears the COLOR_BUFFER_BIT but forgets to clear the
DEPTH_BUFFER_BIT in the Erase() method.
glClearColor( ((GLclampf)(this->Background[0])),
((GLclampf)(this->Background[1])),
((GLclampf)(this->Background[2])),
((GLclampf)(1.0)) );
glClear((GLbitfield)GL_COLOR_BUFFER_BIT);
-->
glClearColor( ((GLclampf)(this->Background[0])),
((GLclampf)(this->Background[1])),
((GLclampf)(this->Background[2])),
((GLclampf)(1.0)) );
glClearDepth( (GLclampd)( 1.0 ) );
glClear((GLbitfield)GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Now the background is painted correctly (in my Qt widget).
Regards
Carsten Kübler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20000922/7b9554ae/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kuebler.vcf
Type: text/x-vcard
Size: 424 bytes
Desc: Card for Carsten K?bler
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20000922/7b9554ae/attachment.vcf>
More information about the vtkusers
mailing list