[osg-users] Camera POST_RENDER vs. postDrawCallback ... whowins?
Vican, Justin E.
jvican at draper.com
Thu Feb 28 09:40:17 PST 2008
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: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] 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. <jvican at draper.com>
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
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
-------------- next part --------------
A non-text attachment was scrubbed...
Name: POST_RENDER_Screenshot.jpg
Type: image/jpeg
Size: 101302 bytes
Desc: POST_RENDER_Screenshot.jpg
Url : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080228/ee7cd554/attachment-0003.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: POST_RENDER_FrameGrab.jpg
Type: image/jpeg
Size: 51531 bytes
Desc: POST_RENDER_FrameGrab.jpg
Url : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080228/ee7cd554/attachment-0004.jpg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NESTED_RENDER_FrameGrab.jpg
Type: image/jpeg
Size: 150563 bytes
Desc: NESTED_RENDER_FrameGrab.jpg
Url : http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080228/ee7cd554/attachment-0005.jpg
More information about the osg-users
mailing list