Do you really need a screen shot, or do you just need a count of visible pixels? If the latter, then occlusion query will do this for you. You'd need to add a draw callback to the object that issues the query, draws it, then waits for the pixel count query result.

Paul Martz
Skew Matrix Software LLC
_http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
+1 303 859 9466



Martin Aasen wrote:
Hi,

I have a scene with a "hidden" object for the person using the application to 
discover and identify. What I want is a screen shot functionality which focuses on this 
object but keeps the resolution of the original rendering, to be able to analyze how many 
pixels the object covered when it was identified etc. I have used the screen shot 
tutorial available at osgHelp to capture a screen shot of the whole rendering:

osg::ref_ptr<osg::Image> rImage = new osg::Image;
                rImage->readPixels( 0, 0, 512, 512, GL_RGB, GL_UNSIGNED_BYTE );
                osgDB::writeImageFile( *rImage, "screenshot.jpg" );

What I want to do is:

osg::ref_ptr<osg::Image> rImage = new osg::Image;
                rImage->readPixels( objectXmin, objectYmin, objectXmax, 
objectYmax, GL_RGB, GL_UNSIGNED_BYTE );
                osgDB::writeImageFile( *rImage, "screenshot.jpg" );

Can anyone give me some pointers on how to get the coordinates objectXmin and 
so on?

Help is much appreciated!

Cheers,
Martin

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





_______________________________________________
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