Hi Gaurav,

A possible solution I think (but never tested it) is to set a draw
callback to left/right render stage (stages can be obtained from
camera->getRenderer()->getSceneView()->getRenderStageLeft(), and then
use RenderBin::setDrawCallback... Oops). And you may know if left or
right render stage is drawing in the callback and change your shader
inputs in time. But this is really ugly and unsafe in multithreading
mode...

Maybe it is good for OSG to add a flag in RenderInfo to indicate if
current drawing process is for left or right eye. And I just do wonder
if there are some better ideas not to change your stereo inputs on the
fly (maybe you can only change the contents and dirty them).

Wang Rui


2012/10/2 Gaurav Chaurasia <[email protected]>:
> Hi,
> Is there a way to know which eye (left/right) is currently being drawn inside 
> osg::Camera::DrawCallback. There is the UserData field in RenderInfo, but I 
> don't think I can use it for my purpose without having to patch 
> osgUtil::SceneView.cpp - the patch being that I update UserData before 
> drawing each eye.
>
> Actually, I am doing render passes with render targets for a stereo 
> application. So I need to switch shader inputs like textures,uniforms for 
> each eye just before the draw call. I figured I can use the PreDrawCallback 
> for the purpose because it is called inside RenderStage::draw just before the 
> actual rendering happens. If someone has a cleaner solution, I would be most 
> grateful.
>
> Thank you!
>
> Cheers,
> Gaurav
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=50378#50378
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to