Hello everybody,
I try to render an image into a texture using a FrameBufferObject. I used
the code of the /Examples/Simple/fbotexture.cpp example, but I don't
understand how to render the created SimpleStage.
Here is my code:
OSG::ImageRefPtr fboTexImg = OSG::Image::create();
OSG::TextureObjChunkRefPtr fboTex = OSG::TextureObjChunk::create();
OSG::FrameBufferObjectRefPtr fbo = OSG::FrameBufferObject::create();
OSG::TextureBufferRefPtr texBuf = OSG::TextureBuffer::create();
// set up the texture ...
fboTexImg->set(OSG::Image::OSG_RGB_PF, maxWidth, maxHeight);
fboTex->setImage(fboTexImg);
// ... and add it to the texture buffer
texBuf->setTexture(fboTex);
texBuf->setReadBack(true); // ??
// make the fbo render to the texture
fbo->setWidth (maxWidth );
fbo->setHeight(maxHeight);
fbo->setColorAttachment(texBuf, 0);
fbo->editMFDrawBuffers()->clear();
fbo->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT);
fbo->setPostProcessOnDeactivate(true);
// ... and add a camera
OSG::TileCameraDecoratorRefPtr camdec =
OSG::TileCameraDecorator::create();
camdec->setFullSize(ResX, ResY);
camdec->setDecoratee(mMgr_->getCamera());
OSG::SimpleStageRefPtr simpleStage = OSG::SimpleStage::create();
simpleStage->setSize( 0, 0, maxWidth, maxHeight );
simpleStage->setCamera( camdec );
simpleStage->setBackground(mMgr_->getWindow()->getPort(0)->getBackground());
simpleStage->setRenderTarget(fbo);
As you see I have the SimpleStage and don't know how to render the whole
thing. A root node with a scene exists.
Thanks for helping
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users