Hi Gerwin, thanks for the code! Sadly I can't run it, because my osgViewer.View class has no addSlave method. That puzzles me, I use osg 2.6, which defines this method...
Thx, Mathias -----Ursprüngliche Nachricht----- Von: "Gerwin de Haan" <[email protected]> Gesendet: 21.02.09 11:51:21 An: OpenSceneGraph Users <[email protected]> Betreff: Re: [osg-users] osgswig: snapshot as numpy array? Hi Mathias, I've used the following python snippet to make hi-res screenshots using a slave camera and an FBO. I'm sure you could (or should) do this with a draw callback, but I started with explicitly calling this function myself to do some experimentation first. I did have some trouble on one machine, where the context (and so the image) would only contain the clear color. You could fill a numpy array from the image I guess. I would be interested in that. regards, Gerwin --- def fboshot(pFileName="screenshot.png", pWidth=1024,pHeight=768): """ screenshot experiment with a frame buffer object creates a new slave camera, attached to the viewer, draws, saves to image, removes the camera again """ import osg import osgDB viewer= __main__.viewer cam = viewer.getCamera() #prepare an image, to which a camera can render shot = osg.Image() shot.allocateImage(pWidth,pHeight,1, osg.GL_RGB, osg.GL_UNSIGNED_BYTE) #create a camera with an fbo render target hicam = osg.Camera() hicam.setGraphicsContext(cam.getGraphicsContext()) hicam.setRenderTargetImplementation(osg.Camera.FRAME_BUFFER_OBJECT) hicam.attach(osg.Camera.COLOR_BUFFER,shot) hicam.setViewport(0,0,pWidth,pHeight) #add a slave camera viewer.addSlave(hicam) #render one frame viewer.frame() #store the shot taken osgDB.writeImageFile(shot,pFileName) #remove this camera again viewer.removeSlave(0) _______________________________________________________________________ Jetzt 1 Monat kostenlos! WEB.DE FreeDSL - Telefonanschluss + DSL für nur 17,95 EURO/mtl.!* http://dsl.web.de/?ac=OM.AD.AD008K15039B7069a _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

