Hi Paul, Yes. I based it almost verbatim off of the osghud example. If you look at the top ~20 lines of createHUD in osghud.cpp, that is exactly what I am doing. Thanks, Justin
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Martz Sent: Thursday, February 28, 2008 1:30 PM To: 'OpenSceneGraph Users' Subject: Re: [osg-users] Camera POST_RENDER vs. postDrawCallback ... whowins? Hi Justin -- Are you clearing the depth buffer before rendering the HUD? camera->setClearMask(GL_DEPTH_BUFFER_BIT); -Paul > Hi Robert, > Thanks for getting back to me. I still seem to be having an > issue with this. I've attached 3 simple images illustrating > the issue. The text overly should say "MOOOOOOOOOOOO!". > When I use a post render HUD camera, it shows up visually > correct at runtime (POST_RENDER_Screenshot.jpg), but I can > get the overlay text into the frame grab > (POST_RENDER_FrameGrab.jpg). However, any combination of > NESTED_RENDER and render bins gives me the problem > illustrated in NESTED_RENDER_FrameGrab.jpg. The "world > space" objects can obscure the HUD items. > > 1.) I have a viewer (osg::Viewer named "viewer1") with a > camera (osg::Camera named "ViewCamera"), and a scene graph > that includes a HUD camera (osg::Camera named "HUDCamera") > which has its rendering order set to POST_RENDER, and I have > added a postDrawCallback to the first camera ("ViewCamera"). > This is the frame grabbing callback. Your response to > question 1 would indicate to me that the subgraph inside of > "HUDCamera" > is supposed to draw before the "ViewCamera" postDrawCallback > is called. > It looks like this is happening in the reverse order. The > postDrawCallback of "ViewCamera" is being called before the > "HUDCamera" > subgraph is rendering which is why I can't see the text in > the frame grab. > > osg::Viewer("viewer1") > | > osg::View("view1") > | > osg::Camera("ViewCamera") > ->setPostDrawCallback(foo). > | > osg::Group("SceenRootNode") > / \ > / \ > osg::Group("OtherStuff") osg::Camera("HUDCamera") > ->setRenderOrder(POST_RENDER) > > > 2.) I've tried adding a postDrawCallback to the HUD camera, > but I'm using the CompositeViewer class so I have potentially > N views into the scene. These callbacks are doing pixel > reads and saving them to images (frame capturing), so I need > the viewport dimensions of the current viewer's camera (not > the HUD camera). I'm also controlling the frame grabbing on > a per-view basis. At present, the osg::Camera class only > allows me to add 1 postDrawCallback, so the HUD cannot > support any more than a single callback. I'm trying to work > something out with nested callbacks, but I'm having trouble > figuring out which viewer has finished rendering by the time > the HUD callback is called. Is there any way to know which > viewer is currently rendering the scene inside of the > osg:Camera::DrawCallback::operator(const osg::camera&) method?. > > > osg::CompositeViewer("CompView") > / \ > / \ > osg::Viewer("viewer1") osg::Viewer("viewer2") > | | > osg::View("view1") osg::View("view2") > | | > osg::Camera("ViewCamera1") osg::Camera("ViewCamera2") <- > postDrawCallbacks attached to each camera. > \ / > \ / > osg::Group("SceenRootNode") > / \ > / \ > osg::Group("OtherStuff") osg::Camera("HUDCamera") > ->setRenderOrder(POST_RENDER) > > > Sorry for the Novel, > Justin > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Robert Osfield > Sent: Thursday, February 28, 2008 4:22 AM > To: OpenSceneGraph Users > Subject: Re: [osg-users] Camera POST_RENDER vs. postDrawCallback ... > whowins? > > On Thu, Feb 28, 2008 at 1:05 AM, Vican, Justin E. <[EMAIL PROTECTED]> > wrote: > Hi Justin, > > > 1.) Are postDrawCallbacks supposed to be called before the > POST_RENDER > > camera sub graphs are rendered? > > A camera post draw callback should be called after its whole > subgraph is rendered. > > > 2.) Is there a way to ensure that the HUD displays are always > drawn on > > top of the world space objects and make sure that the > postDrawCallback > will > > be called after they are rendered? > > If the HUD is drawn last why not attach the callback to it? > > Robert. > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-opensce negraph.or > g > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

