HI Mathias, I've haven't read through your post with a fine tooth come, but it does kinda look like your are making things more complicated than they need to be. Setting up a pbuffer is as simple as setting the osg::GraphicsContext::Traits::pbuffer to true, you shouldn't need to directly construct a PixelBufferWIn32. See the osgscreencapture example.
Robert. On Fri, Oct 31, 2008 at 9:54 AM, <[EMAIL PROTECTED]> wrote: > Hi, > > I currently try to render a setup of multiple cameras off screen in > order to read them to an osg::Image (raw data of some kind would be > enough - I know how to convert it to an osg::Image). > The point is, I want those cameras to be nicely arranged (the way I can > arrange them on other graphics contexts like osgViewer::CompositeViewer) > I tried different approaches but none worked so far. > The simplest one would be: > > > osg::GraphicsContext::Traits* t = new osg::GraphicsContext::Traits(); > t->x = 1; > t->y = 1; > t->width = 1024; > t->height = 692; > t->pbuffer = true; > pb = new osgViewer::PixelBufferWin32(t); > > camera->setGraphicsContext(pb); > camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER); > camera->setViewport(new osg::Viewport(x0,y0,w,h)); > > ... > > frame(); > img->readPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE); > do_something(img); > > > Another approached was using PBOs. Something like: > > > img = new osg::Image; > img->allocateImage(1024,692,1,GL_BGRA,GL_UNSIGNED_BYTE); > > osg::GraphicsContext::Traits* t = new osg::GraphicsContext::Traits(); > t->x = 1; > t->y = 1; > t->width = 1024; > t->height = 692; > t->pbuffer = true; > pb = new osgViewer::PixelBufferWin32(t); > > pb->getState()->setCurrentPixelBufferObject(img->getPixelBufferObject); > > camera->setGraphicsContext(pb); > camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); > camera->setViewport(new osg::Viewport(x0,y0,w,h)); > > ... > > pb->getState()->bindPixelBufferObject(img->getPixelBufferObject); > frame(); > do_something(img); > pb->getState()->unbindPixelBufferObject(img->getPixelBufferObject); > > > But this doesen't work either. > Had some other approaches too, but those threw OpenGL errors claiming > some operation is not supported... > > I'm kind of stuck with this. I know the data is some where - things like > attaching an image to a camera and reading it work - but I just can't > find it. > I would be really thankful for at least a hint. > > Matthias > _______________________________________________ > 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.org

