[vtkusers] Using GL with VTK in same WIN32 app fails, or vtkGLUT
Matthew Hall
mahall at ncsa.uiuc.edu
Fri Jun 23 04:49:19 EDT 2000
Anthony Sherbondy wrote:
> Hello,
>
> I am using VTK and OpenGL simultaneously in an application. I.e. there are
> multiple windows visualizing the same data set. One window uses OpenGL API
> directly to draw where as the other window is drawn by GL through VTK.
> Either window works as expected when up alone, but if both windows are up
> simultaneously there are glitches in both scenes. This may be more of an
> OpenGL issue, but I am wondering if the windows are conflicting with global
> GL memory since both windows are run from the same application or ....
> Please point me in the right direction. Thanks for the time.
>
> --Tony
>
It's probably a problem of switching OpenGL rendering contexts. Without code, it is hard to
diagnose,
but it seems the most likely explanation. Windows aint my forte, but here is some general
pseudocode:
void RenderStuff(){
myVTKWindow->Render();
glWin32Context(?) *saved=glWin32GetCurrentContext();
glWin32MakeCurrent(myContext);
// Save Window State
// Setup window state for my rendering
// Render my stuff
// Restore Window State
glWin32MakeCurrent(saved);
}
This is pretty sparse, I know, and probably easy to break. Plus, if you are using a
vtkRenderWindowInteractor
this is going to cause problems.
One thing I think would be useful in the long term would be to create a vtkGLUTRenderWindow
object (and use the extant vtkOpenGL
actors/mappers/renderers). A vtkGLUTRenderWindowInteractor would also be useful, but the
GLUTRenderWindow should
be able to save and restore its window ID so that in mixed rendering situations like yours,
you can handle the interaction yourself.
This would also aid in the transitions to new platforms (yes Virginia, there ARE
Mac/Be/OS2/etc users out there) which most likely
have GLUT, but don't have anyone willing to devote a few months to writing and debugging a vtk
interface to their particular OS.
It's something I've worked on, a little bit, but we all have more pressing projects with
platforms that already work, , of course.
If anyone has made progress on this, or is willing to collaborate, it would really be helpful
for scientists who use other platforms,
and for those who want to prototype multi-platform software with vtk as a "mix-in".
Does this strike anyone's fancy?
-matt hall
More information about the vtkusers
mailing list