> Hello,
> I would like to make a prerender camera that loop over the rendering of
its
> son's geometries until an event happens and then display the result as a
> texture with the main camera..
>
> mainloop(){
>       while(condition){
>            tex=prerender_camera.draw() //render to texture using fbo
>      }
>      maincamera.draw()  //render the main scene using texture tex
> }
>
> (The condition depends on the post draw opengl state : an occlusion
> query..  )
> I have try a few tricks without success

here's my code:




//Setup prerendercamera
// clearing
    _Camera->setClearMask(GL_DEPTH_BUFFER_BIT);

    // projection and view
    _Camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1,0,1));
    _Camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    _Camera->setViewMatrix(osg::Matrix::identity());

    // viewport
    _Camera->setViewport(0, 0, _TextureWidth, _TextureHeight);

    _Camera->setRenderOrder(osg::Camera::PRE_RENDER);

_Camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

    _Camera->attach(osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER),
_OutTexture.get());

_camera->addchild(prerenderscene); //prerenderscene is a occlusion query
node

//mainscene has a state set that use OutTexture
mainscene->addChild(_Camera);


I would like:
1) to draw Scene from _Camera
2)test number of fragment drawn with an occlusionquery
3)test my condition  and loop to 1) if it's wrong
4)if true draw mainscene using resulting OutTexture
> Can you help me for this?.

May I use a recursive Renderstage a postDrawCallback
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to