Hi everyone, For a new feature for the Drile instrument ( http://vimeo.com/15945215 ), I have been trying for several days to get render to texture to work using the fbotexture tutorial (with a multidisplaywindow). I have a scene of several objects which should be rendered on a plane. All I get is a black plane, I don't even see the gradient background. No errors are displayed.
Does anyone have an idea ? Here is my code : //I setup the fbo texture, material and the stage float fboWidth=640, fboHeight=480; m_fboTexImg = OSG::Image::create(); m_fboTex = OSG::TextureObjChunk::create(); m_fbo = OSG::FrameBufferObject::create(); m_texBuf = OSG::TextureBuffer::create(); m_depthBuf = OSG::RenderBuffer::create(); m_fboTexImg->set(OSG::Image::OSG_RGB_PF, fboWidth, fboHeight); m_fboTex->setImage(m_fboTexImg); m_texBuf->setTexture(m_fboTex); m_depthBuf->setInternalFormat(GL_DEPTH_COMPONENT24); m_fbo->setColorAttachment(m_texBuf, 0); m_fbo->setDepthAttachment(m_depthBuf); m_fbo->editMFDrawBuffers()->push_back(GL_COLOR_ATTACHMENT0_EXT); m_fbo->setWidth (fboWidth ); m_fbo->setHeight(fboHeight); m_fbo->setPostProcessOnDeactivate(true); m_fboMaterial = OSG::SimpleMaterial::create(); OSG::TextureEnvChunkRefPtr fboTexEnv = OSG::TextureEnvChunk::create(); fboTexEnv->setEnvMode(GL_REPLACE); m_fboMaterial->addChunk(m_fboTex); m_fboMaterial->addChunk(fboTexEnv); m_fboMaterial->addChunk( OSG::StateChunkRefPtr(OSG::TwoSidedLightingChunk::create())); m_fboMaterial->setSpecular(OSG::Color3f(0.7f, 0.7f, 0.7f)); m_fboMaterial->setDiffuse (OSG::Color3f(0.7f, 0.7f, 0.7f)); m_stage = OSG::SimpleStage::create(); m_stageNode = OSG::makeNodeFor(m_stage); m_stageVisitCore = OSG::VisitSubTree::create(); m_stageNode->setCore(m_stageVisitCore); m_stage->setRenderTarget(m_fbo); m_stage->setSize(0.0f, 0.0f, 1.0f, 1.0f); m_stageCam = OSG::PerspectiveCamera::create(); m_stageCamBeaconNode=OSG::Node::create(); m_stageCamBeaconNodeTrans=OSG::ComponentTransform::create(); m_stageCamBeaconNode->setCore(m_stageCamBeaconNodeTrans); m_stageCamBeaconNodeTrans->setTranslation(OSG::Vec3f(0,0,20)); m_stageCam->setBeacon(m_stageCamBeaconNode); m_stageCam->setNear(0.1f); m_stageCam->setFar(1000.0); m_stageCam->setFov(1.5); m_stage->setCamera(m_stageCam); OSG::GradientBackgroundRefPtr gb = OSG::GradientBackground::create(); gb->addLine(OSG::Color3f(1, 1, 1), 0.0); gb->addLine(OSG::Color3f(0, 0, 0), 1.0); m_stage->setBackground(gb); //then I add a node (parent of some nodes) as root of the visitsubtree m_stageVisitCore->setSubTreeRoot(m_wormsRoot); //finally I set the material to a geometry m_virtualCameraGeom = OSG::makePlaneGeo(m_diameterSend*4, m_diameterSend*4,1, 1); m_virtualCameraGeom->setMaterial(m_fboMaterial); Thank you Regards Florent -- Florent Berthaut ----------------------------- Research on Immersive Virtual Musical Instruments Software for audiovisual performance Improvised Live-Looped Electronic Music ----------------------------- http://www.hitmuri.net ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Opensg-users mailing list Opensg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensg-users