From 6e62dcb922705f476c0443598c9a6d644f2ece5c Mon Sep 17 00:00:00 2001 From: Rivo Laks Date: Sat, 28 Apr 2007 12:25:54 +0000 Subject: [PATCH] Add GLTexture::setWrapMode() call to set texture's OpenGL wrap mode. Liquid demo effect now sets wrap mode to CLAMP to ensure that the texture won't wrap at edges of the screen, which would make other side of the screen visible there. svn path=/branches/work/kwin_composite/; revision=658748 --- effects/demo_liquid.cpp | 1 + lib/kwinglutils.cpp | 8 ++++++++ lib/kwinglutils.h | 1 + 3 files changed, 10 insertions(+) diff --git a/effects/demo_liquid.cpp b/effects/demo_liquid.cpp index 766a1f7d7b..45f1d6e54d 100644 --- a/effects/demo_liquid.cpp +++ b/effects/demo_liquid.cpp @@ -38,6 +38,7 @@ bool LiquidEffect::loadData() // Create texture and render target mTexture = new GLTexture(displayWidth(), displayHeight()); mTexture->setFilter(GL_LINEAR_MIPMAP_LINEAR); + mTexture->setWrapMode(GL_CLAMP); mRenderTarget = new GLRenderTarget(mTexture); if( !mRenderTarget->valid() ) diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index bb8fa17ae0..0b79f4e094 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -401,6 +401,14 @@ void GLTexture::setFilter( GLenum filter ) mFilter = filter; } +void GLTexture::setWrapMode( GLenum mode ) + { + bind(); + glTexParameteri( mTarget, GL_TEXTURE_WRAP_S, mode ); + glTexParameteri( mTarget, GL_TEXTURE_WRAP_T, mode ); + unbind(); + } + void GLTexture::setDirty() { has_valid_mipmaps = false; diff --git a/lib/kwinglutils.h b/lib/kwinglutils.h index 46086f15c0..c383606e94 100644 --- a/lib/kwinglutils.h +++ b/lib/kwinglutils.h @@ -99,6 +99,7 @@ class KWIN_EXPORT GLTexture void setTexture( GLuint texture ); void setTarget( GLenum target ); void setFilter( GLenum filter ); + void setWrapMode( GLenum mode ); virtual void setDirty(); static void initStatic();