diff --git a/include/osg/Texture b/include/osg/Texture index ed55e955a..364f66d3d 100644 --- a/include/osg/Texture +++ b/include/osg/Texture @@ -53,6 +53,10 @@ #define GL_CLAMP_TO_EDGE 0x812F #endif +#ifndef GL_CLAMP_TO_BORDER_ARB +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + #ifndef GL_GENERATE_MIPMAP_SGIS #define GL_GENERATE_MIPMAP_SGIS 0x8191 #define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 @@ -145,7 +149,8 @@ class SG_EXPORT Texture : public StateAttribute CLAMP = GL_CLAMP, CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, REPEAT = GL_REPEAT, - MIRROR = GL_MIRRORED_REPEAT_IBM + MIRROR = GL_MIRRORED_REPEAT_IBM, + CLAMP_TO_BORDER_ARB = GL_CLAMP_TO_BORDER_ARB }; /** Set the texture wrap mode.*/ diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp index 16fdc4d24..b1ea15925 100644 --- a/src/osg/Texture.cpp +++ b/src/osg/Texture.cpp @@ -275,6 +275,15 @@ void Texture::applyImmediateMode(State& state) const wt = CLAMP; } + static bool s_borderClampSupported = isGLExtensionSupported("GL_ARB_texture_border_clamp"); + if(!s_borderClampSupported) + { + if(ws == CLAMP_TO_BORDER_ARB) + ws = CLAMP; + if(wt == CLAMP_TO_BORDER_ARB) + wt = CLAMP; + } + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, ws ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wt );