[osg-users] Resizing an FBO camera with OSG 3.2.0

James Turner zakalawe at mac.com
Fri Dec 8 13:04:56 PST 2017


Hi,

I’m trying to correctly support both OSG 3.2.x and 3.4.x in a codebase (since we need to support older versions of Debian / Ubuntu which still ship OSG 3.2.x as the supported version)

I have some FBO camera which I’m resizing: in 3.4.x I use osg::Camera::resizeAttachments. In 3.2.x there’s no such method of course, so I am manually resizing the FBO backing texture via:

    _fboTexture->setTextureSize(width, height);
    _fboTexture->dirtyTextureObject();

However, after a resize, I still don’t see the contents of the FBO camera (everything works as expected if I keep the original window size: these are full-screen FBOs so I need to keep them in sync with the main window size).

I’ve look at various pieces of code across the 3.2 branch, and tried a few things to no avail: in particular I hoped this might update the attachment data:

	detach(osg::Camera::COLOR_BUFFER); 
  	attach(osg::Camera::COLOR_BUFFER, _fboTexture); 

(on my osg::Camera subclass) but to no avail.

I’ve seen some code which calls:

	osgViewer::Renderer::setCameraRequiresSetUp

.. but at least for my FBO camera the renderer is null so this doesn’t work for me/

Any hints on what else to try, to work-around this behaviour, or other examples of keeping a full-screen FBO camera in sync with 3.2.x, would be most appreciated.

Kind regards,
James



More information about the osg-users mailing list