Hi,

I'm having trouble attaching integer format textures to an FBO camera. The 
following code: 


Code:

#include "stdafx.h"
#include <osgViewer/Viewer>
#include <osg/Texture2D>

int main(int argc, char* argv[])
{
osg::ref_ptr<osg::Texture2D> targetTex = new osg::Texture2D; 
targetTex->setTextureSize(800, 600); 
targetTex->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST); 
targetTex->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST); 
targetTex->setInternalFormat(GL_R32UI); 
targetTex->setSourceFormat(GL_RED); 
targetTex->setSourceType(GL_UNSIGNED_INT); 

osg::Camera* rttCamera = new osg::Camera;
rttCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
rttCamera->attach(osg::Camera::COLOR_BUFFER, targetTex);

osgViewer::Viewer viewer;
viewer.setSceneData(rttCamera);
return viewer.run();
}



will produce:

Code:

RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6
Warning: detected OpenGL error 'invalid operation' at start of State::apply()
RenderStage::runCameraSetUp(), FBO setup failed, FBO status= 0x8cd6




If I replace the format selection lines with:

Code:

targetTex->setInternalFormat(GL_R32F); 
targetTex->setSourceFormat(GL_RED); 
targetTex->setSourceType(GL_FLOAT); 



everything returns to normal (no errors).

Am I missing something obvious? I am using version 3.1.4 and I have a GTX 480 
with OpenGL 4.3 driver support (I have compute shaders working, so I should be 
relatively up to speed!).

Thank you!

Cheers,
Michael

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=53878#53878





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

Reply via email to