diff --git a/include/osg/Texture b/include/osg/Texture index be5a33b62..8ed68f3e8 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -441,7 +441,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const { - usage.usesTextureMode(getTextureTarget()); + #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE + usage.usesTextureMode(getTextureTarget()); + #endif return true; } diff --git a/src/osg/PolygonMode.cpp b/src/osg/PolygonMode.cpp index 238c2eaf2..4beafa11b 100644 --- a/src/osg/PolygonMode.cpp +++ b/src/osg/PolygonMode.cpp @@ -68,18 +68,18 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const void PolygonMode::apply(State&) const { -#ifdef OSG_GL1_AVAILABLE if (_modeFront==_modeBack) { glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront); } else { - glPolygonMode(GL_FRONT,(GLenum)_modeFront); - glPolygonMode(GL_BACK,(GLenum)_modeBack); + #ifdef OSG_GL1_AVAILABLE + glPolygonMode(GL_FRONT,(GLenum)_modeFront); + glPolygonMode(GL_BACK,(GLenum)_modeBack); + #else + OSG_NOTICE << "Warning: PolygonMode::apply(State&) - only GL_FRONT_AND_BACK is supported." << std::endl; + #endif } -#else - OSG_NOTICE<<"Warning: PolygonMode::apply(State&) - not supported."<= 2.0 || osg::isGLExtensionSupported(_contextID,"GL_ARB_vertex_shader") || OSG_GLES2_FEATURES) + if (osg::getGLVersionNumber() >= 2.0 || osg::isGLExtensionSupported(_contextID, "GL_ARB_vertex_shader") || OSG_GLES2_FEATURES || OSG_GL3_FEATURES) { glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,&_glMaxTextureUnits); - if(OSG_GLES2_FEATURES) + #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE + glGetIntegerv(GL_MAX_TEXTURE_COORDS, &_glMaxTextureCoords); + #else _glMaxTextureCoords = _glMaxTextureUnits; - else - glGetIntegerv(GL_MAX_TEXTURE_COORDS,&_glMaxTextureCoords); + #endif } else if ( osg::getGLVersionNumber() >= 1.3 || osg::isGLExtensionSupported(_contextID,"GL_ARB_multitexture") || diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index f3336f998..b04055d50 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -1909,7 +1909,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const wr = CLAMP; } - #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) + #if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) || defined(OSG_GL3_AVAILABLE) if (ws == CLAMP) ws = CLAMP_TO_EDGE; if (wt == CLAMP) wt = CLAMP_TO_EDGE; if (wr == CLAMP) wr = CLAMP_TO_EDGE; @@ -1982,7 +1982,9 @@ void Texture::applyTexParameters(GLenum target, State& state) const { glTexParameteri(target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC_ARB, _shadow_compare_func); - glTexParameteri(target, GL_DEPTH_TEXTURE_MODE_ARB, _shadow_texture_mode); + #if defined(OSG_GL1_AVAILABLE) || defined(OSG_GL2_AVAILABLE) + glTexParameteri(target, GL_DEPTH_TEXTURE_MODE_ARB, _shadow_texture_mode); + #endif // if ambient value is 0 - it is default behaviour of GL_ARB_shadow // no need for GL_ARB_shadow_ambient in this case