[vtkusers] Using GL with VTK in same WIN32 app fails, or vtkGLUT

Lisa Sobierajski Avila lisa.avila at kitware.com
Fri Jun 23 08:40:33 EDT 2000


Hello,

VTK does restore the context before each render (and several places during 
the render since a vtkRenderWindow can trigger an update in another 
vtkRenderWindow in the middle of rendering). You should be able to mix 
windows opened with VTK with windows opened for direct OpenGL use - as long 
as you are careful in your own application to set your context and not to 
mess up the OpenGL state (doing some "incorrect" things in OpenGL can 
sometimes corrupt the whole state).

What functionality do you see the vtkGLUTRenderWindow providing?

Lisa


At 04:49 AM 6/23/00, Matthew Hall wrote:


>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
>
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>vtkusers mailing list
>vtkusers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtkusers






More information about the vtkusers mailing list