Hi Daniel,

I'm rather lost with exactly what you want to do and the code you've used.
It's probably most productive to just point you in the direction of code
that probably does something similar to what you are after.  The
osgdistortion example is probably a good place to start - this renders the
main view to a texture, then renders a camera to the main window using the
texture rendering from the first camera.

Robert.

On 16 November 2012 14:57, Daniel Schmid <daniel.sch...@swiss-simtec.ch>wrote:

>  Hi all****
>
> ** **
>
> I have a composite viewer, where the main camera renders to texture. No I
> added a slave camera (POST_RENDER that uses the same graphics context as
> the main camera). I had a screen quad child on which I would like to render
> the texture from the main camera. But all I get is a black screen.****
>
> ** **
>
> Regards****
>
> Daniel****
>
> ** **
>
> [code]****
>
>     osg::Camera* camera = new osg::Camera;****
>
> ** **
>
>     // set the projection matrix****
>
>     camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1920,0,1200));****
>
> ** **
>
>     // set the view matrix****
>
>     camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);****
>
>     camera->setViewMatrix(osg::Matrix::identity());****
>
> ** **
>
>     // only clear the depth buffer****
>
>     camera->setClearMask(0);****
>
> ** **
>
>     // draw subgraph after main camera view.****
>
>     camera->setRenderOrder(osg::Camera::POST_RENDER);****
>
> ** **
>
>     //GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;****
>
>     camera->setDrawBuffer(GL_BACK);****
>
>     camera->setReadBuffer(GL_BACK);****
>
> ** **
>
> ** **
>
>     // we don't want the camera to grab event focus from the viewers main
> camera(s).****
>
>     camera->setAllowEventFocus(false);****
>
> ** **
>
> ** **
>
>
> camera->setGraphicsContext(a_viewer->getCamera()->getGraphicsContext());**
> **
>
>     camera->setViewport(a_viewer->getCamera()->getViewport());****
>
> ** **
>
>     camera->addChild( createScreenQuad(1.0f, 1.0f) );****
>
> ** **
>
>     osg::Camera::BufferAttachmentMap& map =
> a_viewer->getCamera()->getBufferAttachmentMap();****
>
>     osg::Texture* input = map[osg::Camera::COLOR_BUFFER0]._texture.get();*
> ***
>
>     camera->getOrCreateStateSet()->setTextureAttributeAndModes(0, input);*
> ***
>
> ** **
>
>     a_viewer->addSlave(camera, false);****
>
> [/code]****
>
> ** **
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to