Hi Martin, There isn't a technical problem, just a need of greater understanding of what's happening in OpenGL and the CPU and GPU. OpenGL has a deep FIFO buffer than your application put all the required OpenGL tokens and data into, the OpenGL driver packages this up and send it the GPU. This pipeline enables the CPU and GPU to be run asynchronously, and at perform at a high performance level.
However, the asynchronous nature provided by the OpenGL FIFO is broken any time you need to get data from GPU, a glReadPixels is one such operation - to handle this OpenGL call the driver has to block the application thread and wait for all the data in the FIFO to be processed by the GPU, then it can copy the data back to the CPU and return it to your application. This round trip to the GPU is therefore extremely costly. In your case attaching an osg::Image to a RTT Camera forces the OSG to use a glReadPixels. There are different techniques to address this issue, which is appropriate depends upon your needs. One approach is to do all render to texture work down on the GPU and avoid ever needing to copy data back to the main memory. Another approach is to use double buffer PBO's to read the data back in the subsequent frame. However, in all these changes perhaps they aren't needed. You are getting 380fps which is many times faster than screen refresh, and if you app is rev'ing faster than screen refresh then you are wasting your time worrying about optimizing. Just stick vsync on, reduce your energy consumption and noise pollution, and enjoy the better visual quality. If there does come a day when you app starts breaking frame then worry about it. Robert. 2010/11/26 "Martin Großer" <[email protected]>: > Hello, > > I've implemented a RTT example with osg and I my scene object is the > cessna.osg. Without the RTT-Implementation I have around 4500 fps. But with > the RTT I have only 380 fps. My Texture is 512 x 512. What is the Problem? > > I have got a GeForce 470 and a intel processor i7 820. I guess the hardware > is ok. My Implementation is: > > osg::Vec3 eye(40,-40,40); > osg::Vec3 point(0,0,0); > > c->addChild(in); > c->setReferenceFrame(osg::Transform::ABSOLUTE_RF); > > c->setProjectionMatrixAsPerspective(30.0,1.0,0.1,100.0); > c->setViewMatrixAsLookAt(eye,point,osg::Vec3(0,0,1)); > c->setClearColor(osg::Vec4(0.4,0.0,0.0,0.0)); > c->setViewport(0,0,512,512); > c->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); > c->setRenderOrder(osg::Camera::PRE_RENDER, 0); > c->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT ); > c->attach(osg::Camera::COLOR_BUFFER, img, 0, 0); > > Is my implementation the problem? > > In OpenGL I can use glCopyTexImage2D(...). There are a Wrapper in OSG for > this functionality? > > Cheers, > > Martin > -- > Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! > Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail > _______________________________________________ > 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

