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

Anthony Sherbondy ajs214 at psu.edu
Fri Jun 23 12:33:54 EDT 2000


Yes, the OpenGL application was not correctly resetting the device context.
Thanks for your help.

Anthony Sherbondy
Multidimensional Image Processing Laboratory
Pennsylvania State University
Electrical Engineering West Rm. 220
University Park, PA 16801
http://cobb.ee.psu.edu
ajs214 at psu.edu
sherbond at aaron.ee.psu.edu

-----Original Message-----
From: Lisa Sobierajski Avila [mailto:lisa.avila at kitware.com]
Sent: Friday, June 23, 2000 8:41 AM
To: mahall at ncsa.uiuc.edu; Anthony Sherbondy
Cc: vtkusers at public.kitware.com
Subject: Re: [vtkusers] Using GL with VTK in same WIN32 app fails, or
vtkGLUT


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