diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-08-26 06:47:40 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-08-27 03:43:22 (GMT) |
commit | 6576cf1ac0ce0443925f5f63f996f0a6be95c5d1 (patch) | |
tree | 42bbc519f1e6e002b79e345eeed18f3db9c3c508 /src/opengl/qgl.h | |
parent | 878569545a06a904635b273c862a0c41dba298e2 (diff) | |
download | Qt-6576cf1ac0ce0443925f5f63f996f0a6be95c5d1.zip Qt-6576cf1ac0ce0443925f5f63f996f0a6be95c5d1.tar.gz Qt-6576cf1ac0ce0443925f5f63f996f0a6be95c5d1.tar.bz2 |
New variant of QGLContext::bindTexture that does not require mipmap generation
and y-axis inversion and overall less conversion, making significantly faster
for plain usecases
Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qgl.h')
-rw-r--r-- | src/opengl/qgl.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index 678bbb7..a928d64 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -288,6 +288,25 @@ public: virtual void swapBuffers() const; + enum BindOption { + NoBindOption = 0x0000, + InvertedYBindOption = 0x0001, + MipmapBindOption = 0x0002, + PremultipliedAlphaBindOption = 0x0004, + LinearFilteringBindOption = 0x0008, + + MemoryManagedBindOption = 0x1000, // internal flag + + DefaultBindOption = LinearFilteringBindOption | InvertedYBindOption | MipmapBindOption, + InternalBindOption = MemoryManagedBindOption | PremultipliedAlphaBindOption + }; + Q_DECLARE_FLAGS(BindOptions, BindOption); + + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + BindOptions options); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, @@ -304,6 +323,10 @@ public: QMacCompatGLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + BindOptions); void deleteTexture(QMacCompatGLuint tx_id); @@ -446,10 +469,16 @@ public: const QFont & fnt = QFont(), int listBase = 2000); QPaintEngine *paintEngine() const; + GLuint bindTexture(const QImage &image, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format, + QGLContext::BindOptions options); + GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D, GLint format = GL_RGBA); + GLuint bindTexture(const QString &fileName); void deleteTexture(GLuint tx_id); @@ -462,6 +491,10 @@ public: QMacCompatGLint format = GL_RGBA); GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D, QMacCompatGLint format = GL_RGBA); + GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); + GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format, + QGLContext::BindOptions); void deleteTexture(QMacCompatGLuint tx_id); |