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
This commit is contained in:
Rivo Laks 2007-04-28 12:25:54 +00:00
parent 9342f6902c
commit 6e62dcb922
3 changed files with 10 additions and 0 deletions

View file

@ -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() )

View file

@ -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;

View file

@ -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();