[osg-users] performance issues with RTT

Steffen Kim mailto.stk at web.de
Fri Sep 5 06:12:17 PDT 2008

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
	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->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
		renderTexture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);

	// Configure cameras of the camera model
	for(int i = 0; i < _cameras->getNumberOfCameras(); i++){
		osg::ref_ptr<osg::Camera> textureCamera = _cameras->getIteratorCamera();
		textureCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		textureCamera->setViewport(0,0, winWidth, winHeight);
		textureCamera->attach(osg::Camera::COLOR_BUFFER, _interlacer->getIteratorTexture().get());

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,

Schon gehört? Bei WEB.DE gibt' s viele kostenlose Spiele:

More information about the osg-users mailing list