- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

# qgl.h

Go to the documentation of this file.

    00001 /****************************************************************************
    00002 **
    00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    00004 ** All rights reserved.
    00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
    00006 **
    00007 ** This file is part of the QtOpenGL module of the Qt Toolkit.
    00008 **
    00009 ** $QT_BEGIN_LICENSE:LGPL$
    00010 ** Commercial Usage
    00011 ** Licensees holding valid Qt Commercial licenses may use this file in
    00012 ** accordance with the Qt Commercial License Agreement provided with the
    00013 ** Software or, alternatively, in accordance with the terms contained in
    00014 ** a written agreement between you and Nokia.
    00015 **
    00016 ** GNU Lesser General Public License Usage
    00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
    00018 ** General Public License version 2.1 as published by the Free Software
    00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
    00020 ** packaging of this file.  Please review the following information to
    00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
    00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    00023 **
    00024 ** In addition, as a special exception, Nokia gives you certain additional
    00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
    00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
    00027 **
    00028 ** GNU General Public License Usage
    00029 ** Alternatively, this file may be used under the terms of the GNU
    00030 ** General Public License version 3.0 as published by the Free Software
    00031 ** Foundation and appearing in the file LICENSE.GPL included in the
    00032 ** packaging of this file.  Please review the following information to
    00033 ** ensure the GNU General Public License version 3.0 requirements will be
    00034 ** met: http://www.gnu.org/copyleft/gpl.html.
    00035 **
    00036 ** If you have questions regarding the use of this file, please contact
    00037 ** Nokia at qt-info@nokia.com.
    00038 ** $QT_END_LICENSE$
    00039 **
    00040 ****************************************************************************/
    00041
    00042 #ifndef QGL_H
    00043 #define QGL_H
    00044
    00045 #include <QtGui/qwidget.h>
    00046 #include <QtGui/qpaintengine.h>
    00047 #include <QtOpenGL/qglcolormap.h>
    00048 #include <QtCore/qmap.h>
    00049 #include <QtCore/qscopedpointer.h>
    00050
    00051 QT_BEGIN_HEADER
    00052
    00053 #if defined(Q_WS_WIN)
    00054 # include <QtCore/qt_windows.h>
    00055 #endif
    00056
    00057 #if defined(Q_WS_MAC)
    00058 # include <OpenGL/gl.h>
    00059 # include <OpenGL/glu.h>
    00060 #elif defined(QT_OPENGL_ES_1)
    00061 # include <GLES/gl.h>
    00062 #ifndef GL_DOUBLE
    00063 # define GL_DOUBLE GL_FLOAT
    00064 #endif
    00065 #ifndef GLdouble
    00066 typedef GLfloat GLdouble;
    00067 #endif
    00068 #elif defined(QT_OPENGL_ES_2)
    00069 # include <GLES2/gl2.h>
    00070 #ifndef GL_DOUBLE
    00071 # define GL_DOUBLE GL_FLOAT
    00072 #endif
    00073 #ifndef GLdouble
    00074 typedef GLfloat GLdouble;
    00075 #endif
    00076 #else
    00077 # include <GL/gl.h>
    00078 # ifndef QT_LINUXBASE
    00079 #   include <GL/glu.h>
    00080 # endif
    00081 #endif
    00082
    00083 QT_BEGIN_NAMESPACE
    00084
    00085 QT_MODULE(OpenGL)
    00086
    00087 #if defined(Q_WS_MAC) && defined (QT_BUILD_OPENGL_LIB) && !defined(QT_MAC_USE_COCOA) && !defined(QDOC)
    00088 #define Q_MAC_COMPAT_GL_FUNCTIONS
    00089
    00090 template <typename T>
    00091 struct QMacGLCompatTypes
    00092 {
    00093     typedef long CompatGLint;
    00094     typedef unsigned long CompatGLuint;
    00095     typedef unsigned long CompatGLenum;
    00096 };
    00097
    00098 template <>
    00099 struct QMacGLCompatTypes<long>
    00100 {
    00101     typedef int CompatGLint;
    00102     typedef unsigned int CompatGLuint;
    00103     typedef unsigned int CompatGLenum;
    00104 };
    00105
    00106 typedef QMacGLCompatTypes<GLint>::CompatGLint QMacCompatGLint;
    00107 typedef QMacGLCompatTypes<GLint>::CompatGLuint QMacCompatGLuint;
    00108 typedef QMacGLCompatTypes<GLint>::CompatGLenum QMacCompatGLenum;
    00109
    00110 #endif
    00111
    00112 #ifdef QT3_SUPPORT
    00113 #define QGL_VERSION        460
    00114 #define QGL_VERSION_STR        "4.6"
    00115 inline QT3_SUPPORT const char *qGLVersion() {
    00116     return QGL_VERSION_STR;
    00117 }
    00118 #endif
    00119
    00120 #if defined(Q_WS_WIN) || defined(Q_WS_MAC)
    00121 class QGLCmap;
    00122 #endif
    00123
    00124 class QPixmap;
    00125 #if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
    00126 class QGLOverlayWidget;
    00127 #endif
    00128 class QGLWidgetPrivate;
    00129 class QGLContextPrivate;
    00130
    00131 // Namespace class:
    00132 namespace QGL
    00133 {
    00134     Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType);
    00135
    00136     enum FormatOption {
    00137         DoubleBuffer            = 0x0001,
    00138         DepthBuffer             = 0x0002,
    00139         Rgba                    = 0x0004,
    00140         AlphaChannel            = 0x0008,
    00141         AccumBuffer             = 0x0010,
    00142         StencilBuffer           = 0x0020,
    00143         StereoBuffers           = 0x0040,
    00144         DirectRendering         = 0x0080,
    00145         HasOverlay              = 0x0100,
    00146         SampleBuffers           = 0x0200,
    00147         DeprecatedFunctions     = 0x0400,
    00148         SingleBuffer            = DoubleBuffer    << 16,
    00149         NoDepthBuffer           = DepthBuffer     << 16,
    00150         ColorIndex              = Rgba            << 16,
    00151         NoAlphaChannel          = AlphaChannel    << 16,
    00152         NoAccumBuffer           = AccumBuffer     << 16,
    00153         NoStencilBuffer         = StencilBuffer   << 16,
    00154         NoStereoBuffers         = StereoBuffers   << 16,
    00155         IndirectRendering       = DirectRendering << 16,
    00156         NoOverlay               = HasOverlay      << 16,
    00157         NoSampleBuffers         = SampleBuffers   << 16,
    00158         NoDeprecatedFunctions   = DeprecatedFunctions << 16
    00159     };
    00160     Q_DECLARE_FLAGS(FormatOptions, FormatOption)
    00161 }
    00162
    00163 Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions)
    00164
    00165 class QGLFormatPrivate;
    00166
    00167 class Q_OPENGL_EXPORT QGLFormat
    00168 {
    00169 public:
    00170     QGLFormat();
    00171     QGLFormat(QGL::FormatOptions options, int plane = 0);
    00172     QGLFormat(const QGLFormat &other);
    00173     QGLFormat &operator=(const QGLFormat &other);
    00174     ~QGLFormat();
    00175
    00176     void setDepthBufferSize(int size);
    00177     int  depthBufferSize() const;
    00178
    00179     void setAccumBufferSize(int size);
    00180     int  accumBufferSize() const;
    00181
    00182     void setRedBufferSize(int size);
    00183     int  redBufferSize() const;
    00184
    00185     void setGreenBufferSize(int size);
    00186     int  greenBufferSize() const;
    00187
    00188     void setBlueBufferSize(int size);
    00189     int  blueBufferSize() const;
    00190
    00191     void setAlphaBufferSize(int size);
    00192     int  alphaBufferSize() const;
    00193
    00194     void setStencilBufferSize(int size);
    00195     int  stencilBufferSize() const;
    00196
    00197     void setSampleBuffers(bool enable);
    00198     bool sampleBuffers() const;
    00199
    00200     void setSamples(int numSamples);
    00201     int  samples() const;
    00202
    00203     void setSwapInterval(int interval);
    00204     int  swapInterval() const;
    00205
    00206     bool doubleBuffer() const;
    00207     void setDoubleBuffer(bool enable);
    00208     bool depth() const;
    00209     void setDepth(bool enable);
    00210     bool rgba() const;
    00211     void setRgba(bool enable);
    00212     bool alpha() const;
    00213     void setAlpha(bool enable);
    00214     bool accum() const;
    00215     void setAccum(bool enable);
    00216     bool stencil() const;
    00217     void setStencil(bool enable);
    00218     bool stereo() const;
    00219     void setStereo(bool enable);
    00220     bool directRendering() const;
    00221     void setDirectRendering(bool enable);
    00222     bool hasOverlay() const;
    00223     void setOverlay(bool enable);
    00224
    00225     int plane() const;
    00226     void setPlane(int plane);
    00227
    00228     void setOption(QGL::FormatOptions opt);
    00229     bool testOption(QGL::FormatOptions opt) const;
    00230
    00231     static QGLFormat defaultFormat();
    00232     static void setDefaultFormat(const QGLFormat& f);
    00233
    00234     static QGLFormat defaultOverlayFormat();
    00235     static void setDefaultOverlayFormat(const QGLFormat& f);
    00236
    00237     static bool hasOpenGL();
    00238     static bool hasOpenGLOverlays();
    00239
    00240     void setVersion(int major, int minor);
    00241     int majorVersion() const;
    00242     int minorVersion() const;
    00243
    00244     enum OpenGLContextProfile {
    00245         NoProfile,
    00246         CoreProfile,
    00247         CompatibilityProfile
    00248     };
    00249
    00250     void setProfile(OpenGLContextProfile profile);
    00251     OpenGLContextProfile profile() const;
    00252
    00253     enum OpenGLVersionFlag {
    00254         OpenGL_Version_None               = 0x00000000,
    00255         OpenGL_Version_1_1                = 0x00000001,
    00256         OpenGL_Version_1_2                = 0x00000002,
    00257         OpenGL_Version_1_3                = 0x00000004,
    00258         OpenGL_Version_1_4                = 0x00000008,
    00259         OpenGL_Version_1_5                = 0x00000010,
    00260         OpenGL_Version_2_0                = 0x00000020,
    00261         OpenGL_Version_2_1                = 0x00000040,
    00262         OpenGL_ES_Common_Version_1_0      = 0x00000080,
    00263         OpenGL_ES_CommonLite_Version_1_0  = 0x00000100,
    00264         OpenGL_ES_Common_Version_1_1      = 0x00000200,
    00265         OpenGL_ES_CommonLite_Version_1_1  = 0x00000400,
    00266         OpenGL_ES_Version_2_0             = 0x00000800,
    00267         OpenGL_Version_3_0                = 0x00001000,
    00268         OpenGL_Version_3_1                = 0x00002000,
    00269         OpenGL_Version_3_2                = 0x00004000,
    00270         OpenGL_Version_3_3                = 0x00008000,
    00271         OpenGL_Version_4_0                = 0x00010000
    00272     };
    00273     Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag)
    00274
    00275     static OpenGLVersionFlags openGLVersionFlags();
    00276
    00277 private:
    00278     QGLFormatPrivate *d;
    00279
    00280     void detach();
    00281
    00282     friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
    00283     friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
    00284 #ifndef QT_NO_DEBUG_STREAM
    00285     friend Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
    00286 #endif
    00287 };
    00288
    00289 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags)
    00290
    00291 Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
    00292 Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
    00293
    00294 #ifndef QT_NO_DEBUG_STREAM
    00295 Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
    00296 #endif
    00297
    00298 class Q_OPENGL_EXPORT QGLContext
    00299 {
    00300     Q_DECLARE_PRIVATE(QGLContext)
    00301 public:
    00302     QGLContext(const QGLFormat& format, QPaintDevice* device);
    00303     QGLContext(const QGLFormat& format);
    00304     virtual ~QGLContext();
    00305
    00306     virtual bool create(const QGLContext* shareContext = 0);
    00307     bool isValid() const;
    00308     bool isSharing() const;
    00309     void reset();
    00310
    00311     static bool areSharing(const QGLContext *context1, const QGLContext *context2);
    00312
    00313     QGLFormat format() const;
    00314     QGLFormat requestedFormat() const;
    00315     void setFormat(const QGLFormat& format);
    00316
    00317     // ### Qt 5: return bools + maybe remove virtuals
    00318     virtual void makeCurrent();
    00319     virtual void doneCurrent();
    00320
    00321     virtual void swapBuffers() const;
    00322
    00323     enum BindOption {
    00324         NoBindOption                            = 0x0000,
    00325         InvertedYBindOption                     = 0x0001,
    00326         MipmapBindOption                        = 0x0002,
    00327         PremultipliedAlphaBindOption            = 0x0004,
    00328         LinearFilteringBindOption               = 0x0008,
    00329
    00330         MemoryManagedBindOption                 = 0x0010, // internal flag
    00331         CanFlipNativePixmapBindOption           = 0x0020, // internal flag
    00332
    00333         DefaultBindOption                       = LinearFilteringBindOption
    00334                                                   | InvertedYBindOption
    00335                                                   | MipmapBindOption,
    00336         InternalBindOption                      = MemoryManagedBindOption
    00337                                                   | PremultipliedAlphaBindOption
    00338     };
    00339     Q_DECLARE_FLAGS(BindOptions, BindOption)
    00340
    00341     GLuint bindTexture(const QImage &image, GLenum target, GLint format,
    00342                        BindOptions options);
    00343     GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
    00344                        BindOptions options);
    00345
    00346     GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
    00347                        GLint format = GL_RGBA);
    00348     GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
    00349                        GLint format = GL_RGBA);
    00350     GLuint bindTexture(const QString &fileName);
    00351
    00352     void deleteTexture(GLuint tx_id);
    00353
    00354     void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
    00355     void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
    00356
    00357 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS
    00358     GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D,
    00359                        QMacCompatGLint format = GL_RGBA);
    00360     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
    00361                        QMacCompatGLint format = GL_RGBA);
    00362     GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
    00363                        BindOptions);
    00364     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
    00365                        BindOptions);
    00366
    00367     void deleteTexture(QMacCompatGLuint tx_id);
    00368
    00369     void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
    00370     void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
    00371 #endif
    00372
    00373     static void setTextureCacheLimit(int size);
    00374     static int textureCacheLimit();
    00375
    00376     void *getProcAddress(const QString &proc) const;
    00377     QPaintDevice* device() const;
    00378     QColor overlayTransparentColor() const;
    00379
    00380     static const QGLContext* currentContext();
    00381
    00382 protected:
    00383     virtual bool chooseContext(const QGLContext* shareContext = 0);
    00384
    00385 #if defined(Q_WS_WIN)
    00386     virtual int choosePixelFormat(void* pfd, HDC pdc);
    00387 #endif
    00388 #if defined(Q_WS_X11) && defined(QT_NO_EGL)
    00389     virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
    00390     virtual void* chooseVisual();
    00391 #endif
    00392 #if defined(Q_WS_MAC)
    00393     virtual void* chooseMacVisual(GDHandle);
    00394 #endif
    00395
    00396     bool deviceIsPixmap() const;
    00397     bool windowCreated() const;
    00398     void setWindowCreated(bool on);
    00399     bool initialized() const;
    00400     void setInitialized(bool on);
    00401     void generateFontDisplayLists(const QFont & fnt, int listBase); // ### Qt 5: remove
    00402
    00403     uint colorIndex(const QColor& c) const;
    00404     void setValid(bool valid);
    00405     void setDevice(QPaintDevice *pDev);
    00406
    00407 protected:
    00408     static QGLContext* currentCtx;
    00409
    00410 private:
    00411     QScopedPointer<QGLContextPrivate> d_ptr;
    00412
    00413     friend class QGLPixelBuffer;
    00414     friend class QGLPixelBufferPrivate;
    00415     friend class QGLWidget;
    00416     friend class QGLWidgetPrivate;
    00417     friend class QGLGlyphCache;
    00418     friend class QOpenGLPaintEngine;
    00419     friend class QOpenGLPaintEnginePrivate;
    00420     friend class QGL2PaintEngineEx;
    00421     friend class QGL2PaintEngineExPrivate;
    00422     friend class QGLEngineShaderManager;
    00423     friend class QGLWindowSurface;
    00424     friend class QGLPixmapData;
    00425     friend class QGLPixmapFilterBase;
    00426     friend class QGLTextureGlyphCache;
    00427     friend class QGLContextGroup;
    00428     friend class QGLSharedResourceGuard;
    00429     friend class QGLPixmapBlurFilter;
    00430     friend class QGLExtensions;
    00431     friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
    00432 #ifdef Q_WS_MAC
    00433 public:
    00434     void updatePaintDevice();
    00435 private:
    00436     friend class QMacGLWindowChangeEvent;
    00437     friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *);
    00438 #endif
    00439     friend class QGLFramebufferObject;
    00440     friend class QGLFramebufferObjectPrivate;
    00441     friend class QGLFBOGLPaintDevice;
    00442     friend class QGLPaintDevice;
    00443     friend class QGLWidgetGLPaintDevice;
    00444     friend class QX11GLPixmapData;
    00445     friend class QX11GLSharedContexts;
    00446 private:
    00447     Q_DISABLE_COPY(QGLContext)
    00448 };
    00449
    00450 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions)
    00451
    00452 class Q_OPENGL_EXPORT QGLWidget : public QWidget
    00453 {
    00454     Q_OBJECT
    00455     Q_DECLARE_PRIVATE(QGLWidget)
    00456 public:
    00457     explicit QGLWidget(QWidget* parent=0,
    00458                        const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
    00459     explicit QGLWidget(QGLContext *context, QWidget* parent=0,
    00460                        const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
    00461     explicit QGLWidget(const QGLFormat& format, QWidget* parent=0,
    00462                        const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
    00463 #ifdef QT3_SUPPORT
    00464     QT3_SUPPORT_CONSTRUCTOR QGLWidget(QWidget* parent, const char* name,
    00465                                     const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
    00466     QT3_SUPPORT_CONSTRUCTOR QGLWidget(QGLContext *context, QWidget* parent, const char* name,
    00467                                     const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
    00468     QT3_SUPPORT_CONSTRUCTOR QGLWidget(const QGLFormat& format, QWidget* parent, const char* name,
    00469                                     const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
    00470 #endif
    00471     ~QGLWidget();
    00472
    00473     void qglColor(const QColor& c) const;
    00474     void qglClearColor(const QColor& c) const;
    00475
    00476     bool isValid() const;
    00477     bool isSharing() const;
    00478
    00479     // ### Qt 5: return bools
    00480     void makeCurrent();
    00481     void doneCurrent();
    00482
    00483     bool doubleBuffer() const;
    00484     void swapBuffers();
    00485
    00486     QGLFormat format() const;
    00487     void setFormat(const QGLFormat& format);
    00488
    00489     const QGLContext* context() const;
    00490     void setContext(QGLContext* context, const QGLContext* shareContext = 0,
    00491                     bool deleteOldContext = true);
    00492
    00493     QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false);
    00494     QImage grabFrameBuffer(bool withAlpha = false);
    00495
    00496     void makeOverlayCurrent();
    00497     const QGLContext* overlayContext() const;
    00498
    00499     static QImage convertToGLFormat(const QImage& img);
    00500
    00501     void setMouseTracking(bool enable);
    00502
    00503     const QGLColormap & colormap() const;
    00504     void  setColormap(const QGLColormap & map);
    00505
    00506     void renderText(int x, int y, const QString & str,
    00507                      const QFont & fnt = QFont(), int listBase = 2000);
    00508     void renderText(double x, double y, double z, const QString & str,
    00509                      const QFont & fnt = QFont(), int listBase = 2000);
    00510     QPaintEngine *paintEngine() const;
    00511
    00512     GLuint bindTexture(const QImage &image, GLenum target, GLint format,
    00513                        QGLContext::BindOptions options);
    00514     GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
    00515                        QGLContext::BindOptions options);
    00516
    00517     GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
    00518                        GLint format = GL_RGBA);
    00519     GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
    00520                        GLint format = GL_RGBA);
    00521
    00522     GLuint bindTexture(const QString &fileName);
    00523
    00524     void deleteTexture(GLuint tx_id);
    00525
    00526     void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
    00527     void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
    00528
    00529 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS
    00530     GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D,
    00531                        QMacCompatGLint format = GL_RGBA);
    00532     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
    00533                        QMacCompatGLint format = GL_RGBA);
    00534     GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
    00535                        QGLContext::BindOptions);
    00536     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
    00537                        QGLContext::BindOptions);
    00538
    00539     void deleteTexture(QMacCompatGLuint tx_id);
    00540
    00541     void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
    00542     void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
    00543 #endif
    00544
    00545 public Q_SLOTS:
    00546     virtual void updateGL();
    00547     virtual void updateOverlayGL();
    00548
    00549 protected:
    00550     bool event(QEvent *);
    00551     virtual void initializeGL();
    00552     virtual void resizeGL(int w, int h);
    00553     virtual void paintGL();
    00554
    00555     virtual void initializeOverlayGL();
    00556     virtual void resizeOverlayGL(int w, int h);
    00557     virtual void paintOverlayGL();
    00558
    00559     void setAutoBufferSwap(bool on);
    00560     bool autoBufferSwap() const;
    00561
    00562     void paintEvent(QPaintEvent*);
    00563     void resizeEvent(QResizeEvent*);
    00564
    00565     virtual void glInit();
    00566     virtual void glDraw();
    00567     int fontDisplayListBase(const QFont & fnt, int listBase = 2000); // ### Qt 5: remove
    00568
    00569 private:
    00570     Q_DISABLE_COPY(QGLWidget)
    00571
    00572 #ifdef Q_WS_MAC
    00573     friend class QMacGLWindowChangeEvent;
    00574 #endif
    00575     friend class QGLDrawable;
    00576     friend class QGLPixelBuffer;
    00577     friend class QGLPixelBufferPrivate;
    00578     friend class QGLContext;
    00579     friend class QGLContextPrivate;
    00580     friend class QGLOverlayWidget;
    00581     friend class QOpenGLPaintEngine;
    00582     friend class QGLPaintDevice;
    00583     friend class QGLWidgetGLPaintDevice;
    00584 };
    00585
    00586
    00587 //
    00588 // QGLFormat inline functions
    00589 //
    00590
    00591 inline bool QGLFormat::doubleBuffer() const
    00592 {
    00593     return testOption(QGL::DoubleBuffer);
    00594 }
    00595
    00596 inline bool QGLFormat::depth() const
    00597 {
    00598     return testOption(QGL::DepthBuffer);
    00599 }
    00600
    00601 inline bool QGLFormat::rgba() const
    00602 {
    00603     return testOption(QGL::Rgba);
    00604 }
    00605
    00606 inline bool QGLFormat::alpha() const
    00607 {
    00608     return testOption(QGL::AlphaChannel);
    00609 }
    00610
    00611 inline bool QGLFormat::accum() const
    00612 {
    00613     return testOption(QGL::AccumBuffer);
    00614 }
    00615
    00616 inline bool QGLFormat::stencil() const
    00617 {
    00618     return testOption(QGL::StencilBuffer);
    00619 }
    00620
    00621 inline bool QGLFormat::stereo() const
    00622 {
    00623     return testOption(QGL::StereoBuffers);
    00624 }
    00625
    00626 inline bool QGLFormat::directRendering() const
    00627 {
    00628     return testOption(QGL::DirectRendering);
    00629 }
    00630
    00631 inline bool QGLFormat::hasOverlay() const
    00632 {
    00633     return testOption(QGL::HasOverlay);
    00634 }
    00635
    00636 inline bool QGLFormat::sampleBuffers() const
    00637 {
    00638     return testOption(QGL::SampleBuffers);
    00639 }
    00640
    00641 QT_END_NAMESPACE
    00642
    00643 QT_END_HEADER
    00644
    00645 #endif // QGL_H