[osg-users] getGraphicsContext()/getState() segfault issue
Fabien Boco
fabien.boco at gmail.com
Fri Nov 25 08:52:18 PST 2016
Hi,
I'm trying to do the folowing :
Code:
m_fboTexture->apply( *camera->getGraphicsContext()->getState() );
But it crashes... More precisely, "applyTexParameters()" crashes. Everything has been initialized.
Here is the complete sequence :
Code:
m_osgViewer = new osgViewer::Viewer();
m_osgViewer->setUpViewerAsEmbeddedInWindow( 0, 0, m_width, m_height );
m_osgViewer->getEventQueue()->windowResize( 0, 0, m_width, m_height );
osg::Camera *camera = m_osgViewer->getCamera();
camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
camera->setViewport( 0, 0, m_width, m_height );
camera->setProjectionMatrixAsPerspective( m_fov, m_width / m_height, m_zNear, m_zFar );
camera->setNearFarRatio( m_zNearFarRatio );
camera->setClearMask( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
camera->setClearColor( m_color );
m_fboTexture = new osg::Texture2D();
m_fboTexture->setTextureSize( m_width, m_height );
m_fboTexture->setInternalFormat( GL_RGBA );
m_fboTexture->setFilter( osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR );
m_fboTexture->setFilter( osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR );
m_fboTexture->apply( *camera->getGraphicsContext()->getState() );
camera->attach( osg::Camera::COLOR_BUFFER, m_fboTexture, 0, 0 );
Seems there's an issue with the graphicsContext or/and State aquisition because this line crashes too :
Code:
unsigned int ctxId = m_osgViewer->getCamera()->getGraphicsContext()->getState()->getContextID();
Thank you!
Cheers,
Fabien[/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=69500#69500
More information about the osg-users
mailing list