Re: [osg-users] Using pbuffer as a texture.
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.
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.
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
[osg-users] Using pbuffer as a texture.
Hello everyone. Looking at the screen capture example I see that I can use pixel buffers to do offline rendering. But then how can I use the content of the pixel buffer as a texture ? I've seen the distortion example as well. It does render to texture too, but that's not quiet what I want. The distortion example doesn't do offline rendering. In my case I need to render a scene to a buffer at a moment when there is no visible view on the screen, and then use this buffer as a texture at a later time. Is this possible ? Regards. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=62340#62340 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org