My attempt to use createGraphicsContext() to create an off-screen
rendering context is failing. (It's returning NULL.)
I'm using Win32.
What am I missing?
I have added the following to my code:
osg::GraphicsContext * GetOffscreenGraphicsContext(
unsigned a_tex_width,
unsigned a_tex_height
)
{
osg::ref_ptr<osg::GraphicsContext::Traits> traits=new
osg::GraphicsContext::Traits;
traits->width = a_tex_width;
traits->height = a_tex_height;
// traits->doubleBuffer = true;
traits->pbuffer = true;
osg::ref_ptr<osg::GraphicsContext>
gc=osg::GraphicsContext::createGraphicsContext(traits.get());
// TODO: Above returning NULL!
return gc.get();
}
with the following to hook it in:
// Setup camera for off-screen rendering.
osg::ref_ptr<osg::GraphicsContext> gc=
GetOffscreenGraphicsContext( tex_width, tex_height);
camera->setGraphicsContext(gc.get());
Thanks,
Phil
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: Friday, April 25, 2008 2:43 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Off-screen rendering
Hi Phil,
Creating a pbuffer context and then rendering a single frame to this
should work just fine. You can create the viewer, then just run one
frame and then let it destruct.
Robert.
On Thu, Apr 24, 2008 at 9:48 PM, Tessier, Philip
<[EMAIL PROTECTED]> wrote:
>
>
>
> All,
>
> I was able to use the osgprerender example to obtain most of what I
> need - the rendering of a scene into an osg::Image. As that's ALL I
> want, I need help with a tweak to it. It uses a viewer.run() to do
> the work. I've replaced this with a viewer.frame(). This produces a
> flicker on the screen as the viewer realizes the frame. As I'm
> interested in an off-screen grab, this is annoying.
>
> I'm reasonably sure that I don't want a viewer at all, but I don't
> know what to simplify it to.
>
> Thanks, in advance,
> Phil
>
> Philip A. Tessier
> Northrop Grumman IT
> [EMAIL PROTECTED]
> 210-867-6775
>
> _______________________________________________
> 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.or
g
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org