<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hej vtkdevelopers and users,
<p>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.
<br>And there are a view "bugs" in the vtk 3.1.2 code.
<p><b>1. vtkOpenGLTexture</b>
<br>#ifdef _WIN32
<br>&nbsp;&nbsp;&nbsp; ((vtkWin32OpenGLRenderWindow *)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ren->GetRenderWindow()))->RegisterTextureResource(
this->Index );
<br>#else
<br>&nbsp;&nbsp;&nbsp; ((vtkOpenGLRenderWindow *)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ren->GetRenderWindow()))->RegisterTextureResource(
this->Index );
<br>#endif
<p><b>2. vtkOpenGLPolyDataMapper</b>
<br>#ifdef _WIN32
<br>&nbsp; ((vtkWin32OpenGLRenderWindow *)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ren->GetRenderWindow()))->MakeCurrent();
<br>#else
<br>&nbsp; ((vtkOpenGLRenderWindow *)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ren->GetRenderWindow()))->MakeCurrent();
<br>#endif
<p>The two classes ignore other OpenGL implementations like mine and other
vtk/qt implementations.
<p>I propose the redesign of the opengl-implementation of all vtkWindows.
<br>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).
<p>My suggestion.
<br>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.
<p>Rewrite the 2 classes:
<br><b>1. vtkOpenGLTexture</b>
<br>&nbsp;&nbsp;&nbsp; ((vtkOpenGLGraphicsExtension *)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ren->GetGraphicExtension()))->RegisterTextureResource(
this->Index );
<p><b>2. vtkOpenGLPolyDataMapper</b>
<br>&nbsp;&nbsp; ((vtkOpenGLGraphicsExtension *)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (ren->GetGraphicExtension()))->MakeCurrent(
);
<p>------
<p>Why does a texture register at a vtkRenderWindow but has no possibility
to unregister???
<p>------
<p>The vtkOpenGLImager clears the COLOR_BUFFER_BIT but forgets to clear
the DEPTH_BUFFER_BIT in the Erase() method.
<p>&nbsp; glClearColor( ((GLclampf)(this->Background[0])),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((GLclampf)(this->Background[1])),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((GLclampf)(this->Background[2])),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((GLclampf)(1.0)) );
<br>&nbsp; glClear((GLbitfield)GL_COLOR_BUFFER_BIT);
<p>-->
<p>&nbsp; glClearColor( ((GLclampf)(this->Background[0])),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((GLclampf)(this->Background[1])),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((GLclampf)(this->Background[2])),
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
((GLclampf)(1.0)) );
<br>&nbsp; glClearDepth( (GLclampd)( 1.0 ) );
<br>&nbsp; glClear((GLbitfield)GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
<p>Now the background is painted correctly (in my Qt widget).
<br>&nbsp;
<p>Regards
<br>&nbsp;&nbsp;&nbsp; Carsten K&uuml;bler</html>