[osg-users] rtt not working with opengl embedded osg

Sebastian Schmidt herrdersuppen at gmail.com
Wed Feb 20 23:18:13 PST 2019


Inside my scenegraph i have a ReaderWriter node, which basically render opengl stuff to a texture. This is not working if i try to run my osg project wrapped in a opengl app /plugin with a GraphicsWindowEmbedded view.

main loop:

Code:

void osgplugin::draw( bool on )
{
	GLint currentFrameBuffer;
	glGetIntegerv(GL_FRAMEBUFFER_BINDING, &currentFrameBuffer);
        glBindFramebuffer(GL_FRAMEBUFFER, 0);

        m_pViewer->frame();

        glBindFramebuffer(GL_FRAMEBUFFER, currentFrameBuffer);
}




setup of the rtt camera:

Code:

        m_pCam->setClearColor(osg::Vec4(0,0,0,1));
        m_pCam->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
        m_pCam->setClearStencil(0);

        m_pCam->setProjectionMatrix(osg::Matrix::ortho2D(0,TEX_WIDTH,0,TEX_HEIGHT));
        m_pCam->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
        m_pCam->setViewMatrix(osg::Matrix::identity());

        m_pCam->setViewport(0,0,TEX_WIDTH,TEX_HEIGHT);

        m_pCam->setRenderOrder(osg::Camera::PRE_RENDER);

        m_pCam->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

        m_pCam->attach(osg::Camera::PACKED_DEPTH_STENCIL_BUFFER, GL_DEPTH_STENCIL_EXT);
        m_pCam->attach(osg::Camera::COLOR_BUFFER, m_pTexture, 0, 0, true, 4, 4);




When i use FRAME_BUFFER_OBJECT for the rtt camera's rendertarget, the texture is blank. When i change it to FRAME_BUFFER, i can see the texture rendered to the whole screen.[/code]

------------------------
OSG Version: 3.4.1
OS: OpenSuse Leap 42.1

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







More information about the osg-users mailing list