Merge pull request #568 from emminizer/fix-flt-texture-export-gl3

OpenFlight: Textures now correctly export in GLCORE mode.
This commit is contained in:
OpenSceneGraph git repository 2018-06-27 20:59:09 +01:00 committed by GitHub
commit aa5e25db8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,12 @@ bool
FltExportVisitor::isTextured( int unit, const osg::Geometry& geom ) const FltExportVisitor::isTextured( int unit, const osg::Geometry& geom ) const
{ {
const osg::StateSet* ss = getCurrentStateSet(); const osg::StateSet* ss = getCurrentStateSet();
#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
bool texOn( ss->getTextureMode( unit, GL_TEXTURE_2D ) & osg::StateAttribute::ON ); bool texOn( ss->getTextureMode( unit, GL_TEXTURE_2D ) & osg::StateAttribute::ON );
#else
// In this mode, osg::Texture::getModeUsage() is undefined, so just detect if a texture is present
bool texOn = (ss->getTextureAttribute(0, osg::StateAttribute::TEXTURE) != NULL);
#endif
bool hasCoords( geom.getTexCoordArray( unit ) != NULL ); bool hasCoords( geom.getTexCoordArray( unit ) != NULL );
return( texOn && hasCoords ); return( texOn && hasCoords );