diff options
Diffstat (limited to 'src/opengl/qgl.h')
-rw-r--r-- | src/opengl/qgl.h | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h index bbcef9d..1d9f623 100644 --- a/src/opengl/qgl.h +++ b/src/opengl/qgl.h @@ -45,6 +45,7 @@ #include <QtGui/qwidget.h> #include <QtOpenGL/qglcolormap.h> #include <QtCore/qmap.h> +#include <QtCore/qscopedpointer.h> QT_BEGIN_HEADER @@ -287,6 +288,29 @@ public: virtual void swapBuffers() const; + enum BindOption { + NoBindOption = 0x0000, + InvertedYBindOption = 0x0001, + MipmapBindOption = 0x0002, + PremultipliedAlphaBindOption = 0x0004, + LinearFilteringBindOption = 0x0008, + + MemoryManagedBindOption = 0x0010, // internal flag + CanFlipNativePixmapBindOption = 0x0020, // 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, @@ -303,6 +327,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); @@ -348,7 +376,7 @@ protected: static QGLContext* currentCtx; private: - QGLContextPrivate* d_ptr; + QScopedPointer<QGLContextPrivate> d_ptr; friend class QGLPixelBuffer; friend class QGLPixelBufferPrivate; @@ -363,6 +391,8 @@ private: friend class QGLWindowSurface; friend class QGLPixmapData; friend class QGLPixmapFilterBase; + friend class QGLTextureGlyphCache; + friend class QGLShareRegister; friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags(); #ifdef Q_WS_MAC public: @@ -371,9 +401,9 @@ private: friend class QMacGLWindowChangeEvent; friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *); #endif -#ifdef Q_WS_WIN friend class QGLFramebufferObject; friend class QGLFramebufferObjectPrivate; +#ifdef Q_WS_WIN friend bool qt_resolve_GLSL_functions(QGLContext *ctx); friend bool qt_createGLSLProgram(QGLContext *ctx, GLuint &program, const char *shader_src, GLuint &shader); #endif @@ -381,6 +411,7 @@ private: Q_DISABLE_COPY(QGLContext) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions); class Q_OPENGL_EXPORT QGLWidget : public QWidget { @@ -443,10 +474,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); @@ -459,6 +496,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); |