Use GL_BGRA instead of GL_RGBA when creating textures.
GL_BGRA is the native format, and should be faster since it doesn't require any internal swizzling. svn path=/trunk/KDE/kdebase/workspace/; revision=1102455
This commit is contained in:
parent
8d03842c05
commit
7e68fc7c44
1 changed files with 4 additions and 4 deletions
|
@ -374,7 +374,7 @@ GLTexture::GLTexture( int width, int height )
|
||||||
|
|
||||||
glGenTextures( 1, &mTexture );
|
glGenTextures( 1, &mTexture );
|
||||||
bind();
|
bind();
|
||||||
glTexImage2D( mTarget, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
glTexImage2D( mTarget, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0);
|
||||||
unbind();
|
unbind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,8 +451,8 @@ bool GLTexture::load( const QImage& image, GLenum target )
|
||||||
if( isNull())
|
if( isNull())
|
||||||
glGenTextures( 1, &mTexture );
|
glGenTextures( 1, &mTexture );
|
||||||
bind();
|
bind();
|
||||||
glTexImage2D( mTarget, 0, GL_RGBA, img.width(), img.height(), 0,
|
glTexImage2D( mTarget, 0, GL_RGBA8, img.width(), img.height(), 0,
|
||||||
GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
|
GL_BGRA, GL_UNSIGNED_BYTE, img.bits());
|
||||||
unbind();
|
unbind();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +721,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu
|
||||||
QImage GLTexture::convertToGLFormat( const QImage& img ) const
|
QImage GLTexture::convertToGLFormat( const QImage& img ) const
|
||||||
{ // Copied from Qt's QGLWidget::convertToGLFormat()
|
{ // Copied from Qt's QGLWidget::convertToGLFormat()
|
||||||
QImage res(img.size(), QImage::Format_ARGB32);
|
QImage res(img.size(), QImage::Format_ARGB32);
|
||||||
convertToGLFormatHelper(res, img.convertToFormat(QImage::Format_ARGB32), GL_RGBA);
|
convertToGLFormatHelper(res, img.convertToFormat(QImage::Format_ARGB32), GL_BGRA);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue