[osg-users] Large Screen Capture - render to texture?

Robert Osfield robert.osfield at gmail.com
Thu Sep 6 10:39:59 PDT 2007


Hi Mark,

If you screen resolution is 1280x1024 then OpenGL just manages a
window that is that size, do a read pixels of an image larger than
this will at best just result in black pixels, but the result will
actually be undefined.

If you want to create a screenshot at a higher res than the on screen
size then you'll need to create an FBO or Pbuffer of the desired size
and then render to this, then do the read pixels.

Robert.

On 9/6/07, russelmg at gdls.com <russelmg at gdls.com> wrote:
>
> I need to get a large screen shot (preferably 2352x1796) of my scene.   I
> followed the basic screengrab code:
> osg::ref_ptr<osg::Image> image = new osg::Image;
>  image->readPixels(x,y,width,height,
> GL_RGB,GL_UNSIGNED_BYTE);
>  osgDB::writeImageFile(*image,_filename);
>
> But it didn't work like I wanted it to.  By passing in 2353 and 1796 for my
> width and height, the app would create an image of that size, but it would
> only capture 1280x1024 (my screen resolution) of the actual scene and the
> rest of the image was black.
>
> I think the right way to do this is to capture to texture.   I looked at the
> osgprerender.cpp example but am not clear on how to modify it to do what I'd
> like and how to capture the texture to a file.
>
> Also, if I do capture this texture to a file, is there a way to apply this
> texture to a quad?
> regards -
>
>
> Mark Russell
>  --------------------------------------------------
>  Modeling & Sim Software Engineer
>  (586) 825-4783
>  russelmg at gdls.com This is an e-mail from General Dynamics Land Systems. It
> is for the intended recipient only and may contain confidential and
> privileged information. No one else may read, print, store, copy, forward or
> act in reliance on it or its attachments. If you are not the intended
> recipient, please return this message to the sender and delete the message
> and any attachments from your computer. Your cooperation is appreciated.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>



More information about the osg-users mailing list