Re: [osg-users] Using pbuffer as a texture.

2015-01-19 Thread Nicolas Baillard
Hi Trajce.

Thank you very much for your answer. Unfortunately this isn't what I'm looking 
for. The prerender example does pretty much the same thing as the distortion 
example : it creates a window with a view and a scene graph and does render to 
texture within this graph. I, on the other hand, must do render to texture 
within a graph that is not linked to any window (offscreen).

Here is a use case example. I'm making an airplane simulation. I have a window 
with a view displaying the outside world as seen from the cockpit. Now, when 
the user press a button, I want to make a photo of what is below the plane. 
This photo must not be displayed on any window at the moment it is taken (not 
yet), it must be rendered offscreen and stored for later use.

What I tried to do is creating a pbuffer (using the createGraphicsContext() 
function and setting pbuffer = true in the traits), then assign a view to this 
pbuffer and use it for my offscreen rendering. It didn't work. It seems it 
isn't possible to create both a window and a pbuffer within the same 
application. If I create a pbuffer first and a window later I get an error in 
wglMakeCurrent() saying the pixel format is invalid. If I create the window 
first and then the pbuffer then I get no error but the window doesn't show up.

Regards

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





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


Re: [osg-users] Using pbuffer as a texture.

2015-01-19 Thread Robert Osfield
Hi Nicolas,

Personally I'd just create a osg::Camera an assign a FBO attachments and a
FinalDrawCallback to do a glReadPixels/osg::Image::readPixels() and then
store the osg::Image.  You could attach this Camera to the main
GraphicsContext/Window of your application and just use it's NodeMask to
toggle it on/off when you need to take a picture.

There isn't any need to create a pbuffer these days, unless you want a
totally offscreen application that never has an onscreen windows to
associated an FBO with.

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


Re: [osg-users] Using pbuffer as a texture.

2015-01-17 Thread Trajce Nikolov NICK
Hi Nicolas,

yes it is possible. Have a look at osgprerender example. You have to attach
the texture to the camera. Look for

camera-attach(osg::Camera::COLOR_BUFFER, texture,.

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