Hi Julien,

aren't you supposed to attach a texture to the framebuffer ? I don't see a call 
to glFramebufferTexture2D or something equivalent in your code.
In OSG term, it's the Camera::attach method that should be called.

-Fred

----- "Julien Valentin" <[email protected]> a écrit :

> Hello,
> 
> I would like to do RTT via FBO .
> For this i overload osg::Geometry class
> and reimplements the drawimplementation method
> it now looks like it:
> 
> Code:
> 
> myGeometry::drawimplemetation(renderinfo)const{
> 
> (_ext)->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbos[*_curst]);
> glPushAttrib(GL_VIEWPORT_BIT | GL_COLOR_BUFFER_BIT);
> osg::ref_ptr<osg::State> st=new osg::State;
> //load the pass dependant stateset
> st->apply(_StateSet[*_curst].get());
> renderInfo.setState(st);
> glViewport(0,0,256, 256);
> 
> // Set the render target
> glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
> 
> // Render as normal here
> // output goes to the FBO and it’s attached textures
> osg::Geometry::drawimplementation(renderinfo);
> 
> glPopAttrib();
> 
> //pingpong the render passes
> if(*_curst==0)*_curst=1;
> else *_curst=0;
> }
> 
> 
> 
> To do my prerender stuff i add a prerender camera that draw the stuff
> 
> Code:
> 
> _Camera->setClearMask(GL_DEPTH_BUFFER_BIT);
> // projection and view
> _Camera->setProjectionMatrix(osg::Matrix::ortho2D(0,_TextureHeight,0,_TextureHeight));
> _Camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1,0,1));
> _Camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
> _Camera->setViewMatrix(osg::Matrix::identity());
> // viewport
> _Camera->setViewport(0, 0, _TextureWidth, _TextureHeight);
> _Camera->setRenderOrder(osg::Camera::PRE_RENDER,0);
> 
> 
> 
> and an other camera that display the generated texture
> 
> However I get an opengl error 0x506
> I think it's due to the camera that handle the preprocess pass cause i
> don't know how to setup the render implementation as i overload it
> during myGeometry::drawimplementation
> 
> Can anyone give me an advice on how to do it ?
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=28539#28539
> 
> 
> 
> 
> 
> _______________________________________________
> 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

Reply via email to