[vtkusers] Rendering into pre-existing OpenGL-window without any vtkRenderWi ndow-Instance

Saeger, Marian Marian.Saeger at eads.net
Tue May 18 04:51:00 EDT 2004


Hi Lisa!

Thanks for the explanation! Right now, I'm working that way and it works
quite good.

The problem in my case is, that it is a platform dependent solution -
because the different RenderWindow-Subclasses have different methods to tell
them "Use that frickin' window!", I would have to decide which methods to
use via compiler flags or something similar. I would really like to avoid
this.

Next thing is, that i'm not only getting the OpenGL-window from another
program, the program is responsible for cameras/lights as well. That's the
reason for my intention to have a Render-thingabob, which really doesn't
care about anything else than rendering geometry _but_ is able to work
together with Interactors and widgets. Or am I getting something seriously
wrong here?!? Does vtk already provide a nifty solution for my case? Maybe I
missed something in the sources? 

Greetings, Marian
--------------------------
Marian Saeger
 
EADS Deutschland GmbH
Corporate Research Centre Germany
Dept. LG-AS
81663 Munich/Germany
 
email: mailto:Marian.Saeger at eads.net
http://www.eads.net


-----Ursprüngliche Nachricht-----
Von: Lisa Avila [mailto:lisa.avila at kitware.com] 
Gesendet: Montag, 17. Mai 2004 21:40
An: Saeger, Marian; 'Lisa Avila'; vtkusers at vtk.org
Betreff: Re: [vtkusers] Rendering into pre-existing OpenGL-window without
any vtkRenderWi ndow-Instance

Hello Marian,

There should be no need to not have a vtkRenderWindow - once you connect it 
to an existing window and set a few flags (turn off erase and the swapping 
of buffers) it should work just as you'd like. The vtkRenderWindow is the 
thing that holds on to the OpenGL context and can be used to make that 
context current again if necessary. Since asking an actor to render causes 
an update of its data, and that may in turn cause a render in another 
window (through a command/observer callback) it is necessary to know the 
OpenGL context in order to make it current before rendering. Also, the 
vtkRenderWindow keeps track of the size of the window, which is used in 
various calculations. It is not intended to render actors/mappers except 
through the Render method of a vtkRenderWindow.

Lisa



At 03:21 AM 5/17/2004, Saeger, Marian wrote:
>Hi!
>
>Thanks - that helped indeed.
>
>But as I worked myself through the source code to gain some knowledge about
>the internal dependencies of mappers, Actors, Renderers and Renderwindows,
I
>stumbled about the slightly irritating fact, that even Mappers (i.e. the
>vtkOpenGLmapper) have direct references to a render window. Is that
>reference essentially necessary?!?
>
>Maybe I'm wrong, but that makes it quite tricky to use a mapper/actor and
>ask him to render itself without having an actual renderwindow-instance. =|
>
>Is there any interest, apart from my own, to have a Renderer which doesn't
>care about a render window and just generates "plain" OpenGL-calls?!? Maybe
>I would find the time to code one....
>
>
>
>Greetings, Marian
>
>
>
>-----Ursprüngliche Nachricht-----
>Von: Lisa Avila [mailto:lisa.avila at kitware.com]
>Gesendet: Mittwoch, 12. Mai 2004 21:10
>An: John Biddiscombe; Saeger, Marian; vtkusers at vtk.org
>Betreff: Re: [vtkusers] Rendering into pre-existing OpenGL-window without
>any vtkRenderWi ndow-Instance
>
>
>This is already possible - you just need to work with the vtkRenderWindow
>down at the subclass level - for example, vtkWin32OpenGLRenderWindow on
>Windows. There are some ivars that can be set with existing windows. Keep
>in mind that you'll need to do some extra things such as not clearing the
>window and not swapping the buffers if you are doing that elsewhere.
>
>Lisa
>
>
>
>At 05:53 AM 5/12/2004, John Biddiscombe wrote:
> >Your best bet would be to modify vtkRenderWindow (subclasses) to have
some
> >new methods which allow you to pass in a pre-existing window/rendering
> >context and bypass all the window creation/initialization code. Then
you'd
> >in principle be able to associate an interactor, renderer and all the
rest
> >with it and use it just like any other vtk renderwindow.
> >
> >JB
> >
> >
> >
> >----- Original Message -----
> >From: "Saeger, Marian" <Marian.Saeger at eads.net>
> >To: <vtkusers at vtk.org>
> >Sent: Wednesday, May 12, 2004 10:23 AM
> >Subject: [vtkusers] Rendering into pre-existing OpenGL-window without any
> >vtkRenderWi ndow-Instance
> >
> >
> > > Hi!
> > >
> > > Similar questions have been raised before, but not exactly this one -
>and
> > > existing solutions aren't nailing down my problem.
> > >
> > > So I would be thankful, if anyone could give me a hint on this one:
> > >
> > > I want vtk to render into a pre-existing OpenGL-window without having
to
> > > create a vtkRenderWindow instance. I.e., I want to use glut to create
a
> > > window and then tell my vtkRenderer-Instance just to render into that
> > > window.
> > >
> > > But for that, I would need a vtkRenderer who doesn't care about a
> > > RenderWindow and just creates gl-function-calls - unfortunately, as I
>see
> > > it, vtkRenderer assumes that there _is_ a RenderWindow associated with
>it,
> > > so my idea isn't applicable.
> > >
> > > Next idea was to create a vtkRenderWindow-Instance and assign a new
> > > Device-/Render-Context via SetContextId(), SetDisplayId() and
> > > SetDeviceContext() - methods. But that methods are Win32-specific -
>which
> >is
> > > not what I want.
> > >
> > > Another drawback would be, that I can't use any Interactor without
>having
> >a
> > > RenderWindow-Instance to assign to it - am I right?!?
> > >
> > > Is anybody out there with a similar problem and could give me some
tips?
> > > What would be the best solution - to create a specific RenderWindow,
or
>to
> > > subclass vtkRenderer to create a "GimmePlainGL-class" to suits my
>needs?!?
> > > =|
> > >
> > >
> > > Thanks in advance!
> > >
> > > Greetings, Marian
> > >
> > > _______________________________________________
> > > This is the private VTK discussion list.
> > > Please keep messages on-topic. Check the FAQ at:
> ><http://public.kitware.com/cgi-bin/vtkfaq>
> > > Follow this link to subscribe/unsubscribe:
> > > http://www.vtk.org/mailman/listinfo/vtkusers
> >
> >_______________________________________________
> >This is the private VTK discussion list.
> >Please keep messages on-topic. Check the FAQ at:
> ><http://public.kitware.com/cgi-bin/vtkfaq>
> >Follow this link to subscribe/unsubscribe:
> >http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
><http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list