From Andreas Henne, OpenGL core profile fixes required for OSX.

git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14669 16af8721-9629-0410-8352-f15c8da7e697
This commit is contained in:
Robert Osfield 2015-01-21 15:35:19 +00:00
parent 7fbeeefea8
commit d5f2c34f24
4 changed files with 18 additions and 13 deletions

View File

@ -441,7 +441,9 @@ class OSG_EXPORT Texture : public osg::StateAttribute
virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
{ {
usage.usesTextureMode(getTextureTarget()); #ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
usage.usesTextureMode(getTextureTarget());
#endif
return true; return true;
} }

View File

@ -68,18 +68,18 @@ PolygonMode::Mode PolygonMode::getMode(Face face) const
void PolygonMode::apply(State&) const void PolygonMode::apply(State&) const
{ {
#ifdef OSG_GL1_AVAILABLE
if (_modeFront==_modeBack) if (_modeFront==_modeBack)
{ {
glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront); glPolygonMode(GL_FRONT_AND_BACK,(GLenum)_modeFront);
} }
else else
{ {
glPolygonMode(GL_FRONT,(GLenum)_modeFront); #ifdef OSG_GL1_AVAILABLE
glPolygonMode(GL_BACK,(GLenum)_modeBack); 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."<<std::endl;
#endif
} }

View File

@ -945,13 +945,14 @@ void State::initializeExtensionProcs()
setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedARB","glDrawArraysInstancedEXT"); setGLExtensionFuncPtr(_glDrawArraysInstanced, "glDrawArraysInstanced","glDrawArraysInstancedARB","glDrawArraysInstancedEXT");
setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedARB","glDrawElementsInstancedEXT"); setGLExtensionFuncPtr(_glDrawElementsInstanced, "glDrawElementsInstanced","glDrawElementsInstancedARB","glDrawElementsInstancedEXT");
if ( osg::getGLVersionNumber() >= 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); 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; _glMaxTextureCoords = _glMaxTextureUnits;
else #endif
glGetIntegerv(GL_MAX_TEXTURE_COORDS,&_glMaxTextureCoords);
} }
else if ( osg::getGLVersionNumber() >= 1.3 || else if ( osg::getGLVersionNumber() >= 1.3 ||
osg::isGLExtensionSupported(_contextID,"GL_ARB_multitexture") || osg::isGLExtensionSupported(_contextID,"GL_ARB_multitexture") ||

View File

@ -1909,7 +1909,7 @@ void Texture::applyTexParameters(GLenum target, State& state) const
wr = CLAMP; 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 (ws == CLAMP) ws = CLAMP_TO_EDGE;
if (wt == CLAMP) wt = CLAMP_TO_EDGE; if (wt == CLAMP) wt = CLAMP_TO_EDGE;
if (wr == CLAMP) wr = 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_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameteri(target, GL_TEXTURE_COMPARE_FUNC_ARB, _shadow_compare_func); 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 // if ambient value is 0 - it is default behaviour of GL_ARB_shadow
// no need for GL_ARB_shadow_ambient in this case // no need for GL_ARB_shadow_ambient in this case