I am completely a starter of OSG. I just read a few tutorials about OSG. But now, I need to implement my code in openGL to OSG in one week.
The main idea is to render the scene twice. The first time I render it in a low resolution, read back from the frame buffer, use the data I get from the buffer to render the second time in normal resolution. Only the second time, the user can see the result. A friend of mine suggest me to read the prerender example, I am doing it, though very slowly. I just want to make sure I am in the right way because the deadline is approaching.
Thank you!
Alice
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30631#30631
_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
The osgdistortion example would probably be a good place to start, as
it renders the scene to texture using a slave render to texture
camera, then has another slave camera render a screen aligned geometry
using that texture. The only thing you'd need to change is the
osgdistortion example alters the tex coords to achieve the desired
distortion, in your case you could just use a single quad with
undistorted tex coords.
One thing you absolutely don't want to be doing is reading the
contents of the frame buffer back into main memory though, this will
certainly kill performance - always use a FrameBufferObject (FBO) and
associated Texture to render to. The osgdistortion example sets up
the render to texture camera to use FBO by default.
Robert.
Thank you for your advice.
I managed to use a prerender camera which helps me to attach the frame buffer content to an image each frame.
My only concern now is since I have two cameras now, one prerender, one normal, how can I control these two at the same time?
I do it by attaching two geometry nodes with the same MatrixTransform callback, but in this way, I have to set up each kind of interaction myself, like scaling, moving and rotating. Can I use the default interaction in OSG viewer to control the prerender camera, too?
Thank you!
Alice
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=30808#30808
On Mon, Aug 16, 2010 at 9:52 PM, Alice Yin <yin...@ymail.com> wrote:
> My only concern now is since I have two cameras now, one prerender, one normal, how can I control these two at the same time?
There are a number of different ways to control slave cameras, or
cameras in the scene graph. If you want to use the usual viewer
CameraManipulator such as the TrackballManipulator then you should set
up your slave Camera to inherit it's view and projection matrix from
the viewer's master Camera by setting a RELATIVE_RF ReferenceFrame.
For the slave Camera that is independent from the viewer's master
Camera this you'd use an ABSOLUTE_RF ReferenceFrame and set the
projection and view matrices on the Camera directly either at start up
on on each new frame. The osgdistortion example does just this.
Robert.