Hi everybody.

I have some performance problems with rendering to texture. 
I am doing some interlacing for an autostereoscopic display. Therefor I need 5 
different views on the scene, which I render into textures I later use as input 
for the interlacing API.
But doing the RTT slows down my application significantly (even in 
Release-mode).

I first thought it would be the interlacer that takes that much time but when I 
disabled all interlacing and everything that updates the cameras after the 
master camera was moved it didn't really change.
Even now, when everything I do is displaying the picture of the master camera 
and additionally rendering to five textures, it runs very halting.

I define 5 target textures and 5 rtt-cameras via

        // Configure source textures for the interlacer
        _interlacer->resetIterator();
        for(int i = 0; i < _interlacer->getNumberOfTextures(); i++){
                osg::ref_ptr<osg::Texture2D> renderTexture = 
_interlacer->getIteratorTexture();
                
renderTexture->setTextureSize(_interlacer->getResultTexture()->getTextureWidth(),
 _interlacer->getResultTexture()->getTextureHeight());
                renderTexture->setInternalFormat(GL_RGBA);
                renderTexture->setFilter(osg::Texture2D::MIN_FILTER, 
osg::Texture2D::LINEAR);
                renderTexture->setFilter(osg::Texture2D::MAG_FILTER, 
osg::Texture2D::LINEAR);
                _interlacer->incIterator();
        }

        // Configure cameras of the camera model
        _cameras->resetIterator();
        _interlacer->resetIterator();
        for(int i = 0; i < _cameras->getNumberOfCameras(); i++){
                osg::ref_ptr<osg::Camera> textureCamera = 
_cameras->getIteratorCamera();
                textureCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
                textureCamera->setClearMask(GL_COLOR_BUFFER_BIT | 
GL_DEPTH_BUFFER_BIT);
                textureCamera->setViewport(0,0, winWidth, winHeight);
                
textureCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
                textureCamera->setRenderOrder(osg::Camera::PRE_RENDER);
                
textureCamera->setGraphicsContext(_billInterface->getGraphicsContext());
                textureCamera->setAllowEventFocus(false);
                textureCamera->addChild(_billInterface->getScene());
                textureCamera->attach(osg::Camera::COLOR_BUFFER, 
_interlacer->getIteratorTexture().get());
                _cameras->incIterator();
                _interlacer->incIterator();
        }

The five RTT-cameras are children of a group node, which I add to the root node 
of my scene graph.

Is there a way to speed up the rendering somehow? I could make the resolution 
of the textures smaller (currently it's 1280x1024) but this would decrease the 
quality of the final image and I would have to scale the textures before 
interlacing what probably also takes some time.

Thanks for any hints,
Steffen

________________________________________________________________________
Schon gehört? Bei WEB.DE gibt' s viele kostenlose Spiele:
http://games.entertainment.web.de/de/entertainment/games/free/index.html

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

Reply via email to