Hi,
another FBO ping pong technique (without overriding) is shown in the
osggameoflife example.
You could also have a look at osgPPU.
cheers
jp
On 03/06/10 14:39, Julien Valentin wrote:
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
--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard.
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their support.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org