diff --git a/Engine/source/gfx/gl/gfxGLStateBlock.cpp b/Engine/source/gfx/gl/gfxGLStateBlock.cpp index 12eab71b0..1d2968776 100644 --- a/Engine/source/gfx/gl/gfxGLStateBlock.cpp +++ b/Engine/source/gfx/gl/gfxGLStateBlock.cpp @@ -55,7 +55,16 @@ GFXGLStateBlock::GFXGLStateBlock(const GFXStateBlockDesc& desc) : glSamplerParameteri(id, GL_TEXTURE_WRAP_S, GFXGLTextureAddress[ssd.addressModeU]); glSamplerParameteri(id, GL_TEXTURE_WRAP_T, GFXGLTextureAddress[ssd.addressModeV]); glSamplerParameteri(id, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); - + + if (ssd.addressModeU == GFXAddressBorder || + ssd.addressModeV == GFXAddressBorder || + ssd.addressModeW == GFXAddressBorder) + { + LinearColorF bc = LinearColorF(ssd.borderColor); + GLfloat color[4] = { bc.red, bc.green, bc.blue, bc.alpha }; + glSamplerParameterfv(id, GL_TEXTURE_BORDER_COLOR, color); + } + //compare modes const bool comparison = ssd.samplerFunc != GFXCmpNever; glSamplerParameteri(id, GL_TEXTURE_COMPARE_MODE, comparison ? GL_COMPARE_R_TO_TEXTURE_ARB : GL_NONE ); diff --git a/Engine/source/gfx/gl/gfxGLTextureObject.cpp b/Engine/source/gfx/gl/gfxGLTextureObject.cpp index 07f72802f..06ee43dc0 100644 --- a/Engine/source/gfx/gl/gfxGLTextureObject.cpp +++ b/Engine/source/gfx/gl/gfxGLTextureObject.cpp @@ -219,10 +219,7 @@ void GFXGLTextureObject::initSamplerState(const GFXSamplerStateDesc &ssd) glTexParameteri(mBinding, GL_TEXTURE_WRAP_R, GFXGLTextureAddress[ssd.addressModeW]); if(static_cast< GFXGLDevice* >( GFX )->supportsAnisotropic() ) glTexParameterf(mBinding, GL_TEXTURE_MAX_ANISOTROPY_EXT, ssd.maxAnisotropy); - - LinearColorF bc = LinearColorF(ssd.borderColor); - GLfloat color[4]={bc.red, bc.green, bc.blue, bc.alpha}; - glTexParameterfv(mBinding, GL_TEXTURE_BORDER_COLOR, color); + mNeedInitSamplerState = false; mSampler = ssd; }