From 3444c952614ac2f7af3ce217a24e5d3c0b1efc4e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 27 Feb 2002 22:00:47 +0000 Subject: [PATCH] Integrated support for GL_CLAMP_TO_BORDER_ARB extension to osg::Texture, submitted by Sasa Bistrovic. --- include/osg/Texture | 7 ++++++- src/osg/Texture.cpp | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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 );