Hi Philip,

I'm not a windows users so can't directly help, but can provide a few
things to look into.

First up, check that your hardware supports pbuffers.

Second up I very very strongly recommend upgrading to OSG-2.6, the API
changes between 2.0 and 2.6 are quite modest - most of the time you
should be able to just do a rebuild of your code.  The benefit of this
upgrade is a lots of lots of bug fixes, and lots of performance
improvements and better features.

Once you've upgraded it also make it much easier for others to help
out as you'll be working from the same base, so problems that you have
will be reproducible by others.

Finally, you don't mention anything about the hardware and drivers you
are using - this has a huge baring on the capabilities of your system
and the effect it'll have on functionality/bugs (i.e. driver bugs).

Robert.

On Thu, Aug 21, 2008 at 5:59 AM, Tessier, Philip <[EMAIL PROTECTED]> wrote:
> All,
>
> I submitted the following (as "Off-screen rendering") some time ago (and 
> received helpful replies - Thank you), but I have yet to get this working 
> correctly.  I have been digging into how this works, and I hopefully can ask 
> my question so as to illicit whatever bit of knowledge I am lacking...
>
> In order to capture an image to an off-screen buffer, I'm using the following 
> (which has been carved down for clarity):
>    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
> osg::GraphicsContext::Traits;
>        ...
>    traits->pbuffer = true;
>    osg::GraphicsContext* _gc= 
> osg::GraphicsContext::createGraphicsContext(traits.get());
>
> But, this fails every time.  I'm using Win32.
>
> I came across 
> http://www.openscenegraph.org/projects/osg/wiki/Community/Tasks/osgViewer 
> tonight, (last updated 6th June 2007), which includes, as future work, 
> "Support for pbuffers under Win32, X11 and Carbon."
>
> I'm currently using OSG 2.0.  Was pbuffer support present in Win32 
> implementation in OSG 2.0?
>
> Thanks,
> Phil
>
> Philip A. Tessier
> Northrop Grumman IT
> [EMAIL PROTECTED]
>
>
> Previous thread follows:
>
> From: osg-users-bounces <at> lists.openscenegraph.org [mailto:[EMAIL 
> PROTECTED] On Behalf Of Rafa Gaitan
> Sent: Sunday, April 27, 2008 4:53 PM
> To: [EMAIL PROTECTED]; OpenSceneGraph Users
>
> Subject: Re: [osg-users] Off-screen rendering
>
> Hi Philip and xbee
>
> We have this code and is working for us:
>
>    osg::ref_ptr<osg::GraphicsContext::Traits> traits = new 
> osg::GraphicsContext::Traits;
>    traits->x =x;
>    traits->y = y;
>    traits->width = width;
>    traits->height = height;
>    traits->windowDecoration = false;
>    traits->doubleBuffer = false;
>    traits->sharedContext = 0;
>    traits->pbuffer = true;
>
>    osg::GraphicsContext* _gc= 
> osg::GraphicsContext::createGraphicsContext(traits.get());
>
>    if (!_gc)
>    {
>        osg::notify(osg::NOTICE)<<"Failed to create pbuffer, failing back to 
> normal graphics window."<<std::endl;
>
>        traits->pbuffer = false;
>        _gc = osg::GraphicsContext::createGraphicsContext(traits.get());
>    }
>    v->getCamera()->setGraphicsContext(_gc);
>    v->getCamera()->setViewport(new osg::Viewport(x,y,width,height));
>
> v is an osgViewer::Viewer.
>
> Hope this helps.
>
>
>
> On Sun, Apr 27, 2008 at 7:49 PM, xbee <xbee-vHHsQtDGzY/[EMAIL PROTECTED]> 
> wrote:
>
> Tessier, Philip a écrit :
>
>> 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
>>
>
> _______________________________________________
> 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