Hi,

I want to make a screenshot of a osgShadow::ShadowScene.
I have created an osg::Camera this way :

Code:

  camera->setClearColor(osg::Vec4(0.8f,0.8f,0.8f,1.0f));
  camera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
  camera->setProjectionMatrixAsPerspective(90,1.0,x,2*x);
  camera->setViewMatrixAsLookAt(_position,
                                _lookAt,
                                osg::Vec3f(0.0f,0.0f,1.0f)
                                );    
  camera->setViewport(0,0, xres, yres);
  camera->setRenderOrder(osg::Camera::POST_RENDER);
  camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

  camera->attach(osg::Camera::COLOR_BUFFER, myImage);
  camera->setFinalDrawCallback(new WriteCallback(filename, camera, myImage));
    
  camera->addChild(_originalModel);
[\code]

If I make 
viewer.realize();
viewer.frame();

I will not see my 3D model.
If I do viewer.frame() once more I will see my 3D model but no shadow on it.

I know the problem is coming from the camera because if i create a viewer and 
run it with the same _originalModel before entering my screenshot procedure 
there is no problem.

Someone could explain me the logic behind it ? I mean do I have to make a trick 
for having shadow on my screenshot. I have read about 2 cameras on another 
topic but not sure about.

Thank you all :)

Cheers,
Benoît



------------------------
-- 
Benoît Bayol
benoit.ba...@gmail.com

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19891#19891





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to