Hello Bastian, Bastian Sdorra wrote: > I try to render a small sub-tree of my scenegraph to a depth texture. > For this > purpose I use a combination of SimpleStageNode, VisitSubTreeNode and > FrameBufferObject. > > The sub-tree is encapsulated in an own class with a > renderDepthImage()-method on it, which does the depth to texture rendering. > I'm now wondering about the kind of window and viewport to use in the > class for the render call.
hm, you could render the depth texture as part of the normal scene, by adding your SimpleStage as the first child of the root node [1]. It would then use the window that is used to render the rest of the scene (but not affect what is visible in that window, it would still write to the depth texture). > Currently, I pass a PassiveWindow with a Viewport pointing to the root of > the complete scenegraph to the class after I created it. It works, but I > really > want to avoid the window passing. > Is there a way to let the class hold it's own window and viewport to do > the rendering step? a window in OpenSG represents an OpenGL context, so if you create a second window you'd have a second context that is used to render the depth texture. > I previously tried to create the PassiveWindow in the class constructor > and use > it with a viewport pointing to the VisitSubTree root or the SimpleStage > parent, > but both without success. I suppose, there is a context problem with the > Passive > Window... the PassiveWindow remembers the OpenGL context that is active when init() is running. What OS are you using and what do you use to create the application window (e.g. glut, X11, WIN32) ? Cheers, Carsten [1] making it the first child ensures that it is rendered before the rest of the scene, in case you need the depth texture as input when drawing the scene itself. ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users