Fixed compile of QtOpenGL on Mac & QPA.
[profile/ivi/qtbase.git] / src / opengl / qgl.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtOpenGL module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QGL_H
43 #define QGL_H
44
45 #include <QtGui/qwidget.h>
46 #include <QtGui/qpaintengine.h>
47 #include <QtOpenGL/qglcolormap.h>
48 #include <QtCore/qmap.h>
49 #include <QtCore/qscopedpointer.h>
50
51 #ifdef Q_WS_QPA
52 #include <QtGui/QPlatformWindowFormat>
53 #endif
54
55 QT_BEGIN_HEADER
56
57 #if defined(Q_WS_WIN)
58 # include <QtCore/qt_windows.h>
59 #endif
60
61 #if defined(QT_OPENGL_ES_1)
62 # if defined(Q_OS_MAC)
63 #  include <OpenGLES/ES1/gl.h>
64 # else
65 #  include <GLES/gl.h>
66 # endif
67 # ifndef GL_DOUBLE
68 #  define GL_DOUBLE GL_FLOAT
69 # endif
70 # ifndef GLdouble
71 typedef GLfloat GLdouble;
72 # endif
73 #elif defined(QT_OPENGL_ES_2)
74 # if defined(Q_OS_MAC)
75 #  include <OpenGLES/ES2/gl.h>
76 # else
77 #  include <GLES2/gl2.h>
78 # endif
79 # ifndef GL_DOUBLE
80 #  define GL_DOUBLE GL_FLOAT
81 # endif
82 # ifndef GLdouble
83 typedef GLfloat GLdouble;
84 # endif
85 #else
86 # if defined(Q_OS_MAC)
87 #  include <OpenGL/gl.h>
88 # else
89 #  include <GL/gl.h>
90 # endif
91 #endif
92
93 QT_BEGIN_NAMESPACE
94
95 QT_MODULE(OpenGL)
96
97 #if defined(Q_WS_MAC) && defined (QT_BUILD_OPENGL_LIB) && !defined(QT_MAC_USE_COCOA) && !defined(QDOC)
98 #define Q_MAC_COMPAT_GL_FUNCTIONS
99
100 template <typename T>
101 struct QMacGLCompatTypes
102 {
103     typedef long CompatGLint;
104     typedef unsigned long CompatGLuint;
105     typedef unsigned long CompatGLenum;
106 };
107
108 template <>
109 struct QMacGLCompatTypes<long>
110 {
111     typedef int CompatGLint;
112     typedef unsigned int CompatGLuint;
113     typedef unsigned int CompatGLenum;
114 };
115
116 typedef QMacGLCompatTypes<GLint>::CompatGLint QMacCompatGLint;
117 typedef QMacGLCompatTypes<GLint>::CompatGLuint QMacCompatGLuint;
118 typedef QMacGLCompatTypes<GLint>::CompatGLenum QMacCompatGLenum;
119
120 #endif
121
122 #ifdef QT3_SUPPORT
123 #define QGL_VERSION        460
124 #define QGL_VERSION_STR        "4.6"
125 inline QT3_SUPPORT const char *qGLVersion() {
126     return QGL_VERSION_STR;
127 }
128 #endif
129
130 #if defined(Q_WS_WIN) || defined(Q_WS_MAC)
131 class QGLCmap;
132 #endif
133
134 class QPixmap;
135 #if defined(Q_WS_X11) && !defined(QT_OPENGL_ES)
136 class QGLOverlayWidget;
137 #endif
138 class QGLWidgetPrivate;
139 class QGLContextPrivate;
140
141 // Namespace class:
142 namespace QGL
143 {
144     Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType);
145
146     enum FormatOption {
147         DoubleBuffer            = 0x0001,
148         DepthBuffer             = 0x0002,
149         Rgba                    = 0x0004,
150         AlphaChannel            = 0x0008,
151         AccumBuffer             = 0x0010,
152         StencilBuffer           = 0x0020,
153         StereoBuffers           = 0x0040,
154         DirectRendering         = 0x0080,
155         HasOverlay              = 0x0100,
156         SampleBuffers           = 0x0200,
157         DeprecatedFunctions     = 0x0400,
158         SingleBuffer            = DoubleBuffer    << 16,
159         NoDepthBuffer           = DepthBuffer     << 16,
160         ColorIndex              = Rgba            << 16,
161         NoAlphaChannel          = AlphaChannel    << 16,
162         NoAccumBuffer           = AccumBuffer     << 16,
163         NoStencilBuffer         = StencilBuffer   << 16,
164         NoStereoBuffers         = StereoBuffers   << 16,
165         IndirectRendering       = DirectRendering << 16,
166         NoOverlay               = HasOverlay      << 16,
167         NoSampleBuffers         = SampleBuffers   << 16,
168         NoDeprecatedFunctions   = DeprecatedFunctions << 16
169     };
170     Q_DECLARE_FLAGS(FormatOptions, FormatOption)
171 }
172
173 Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions)
174
175 class QGLFormatPrivate;
176
177 class Q_OPENGL_EXPORT QGLFormat
178 {
179 public:
180     QGLFormat();
181     QGLFormat(QGL::FormatOptions options, int plane = 0);
182     QGLFormat(const QGLFormat &other);
183     QGLFormat &operator=(const QGLFormat &other);
184     ~QGLFormat();
185
186     void setDepthBufferSize(int size);
187     int  depthBufferSize() const;
188
189     void setAccumBufferSize(int size);
190     int  accumBufferSize() const;
191
192     void setRedBufferSize(int size);
193     int  redBufferSize() const;
194
195     void setGreenBufferSize(int size);
196     int  greenBufferSize() const;
197
198     void setBlueBufferSize(int size);
199     int  blueBufferSize() const;
200
201     void setAlphaBufferSize(int size);
202     int  alphaBufferSize() const;
203
204     void setStencilBufferSize(int size);
205     int  stencilBufferSize() const;
206
207     void setSampleBuffers(bool enable);
208     bool sampleBuffers() const;
209
210     void setSamples(int numSamples);
211     int  samples() const;
212
213     void setSwapInterval(int interval);
214     int  swapInterval() const;
215
216     bool doubleBuffer() const;
217     void setDoubleBuffer(bool enable);
218     bool depth() const;
219     void setDepth(bool enable);
220     bool rgba() const;
221     void setRgba(bool enable);
222     bool alpha() const;
223     void setAlpha(bool enable);
224     bool accum() const;
225     void setAccum(bool enable);
226     bool stencil() const;
227     void setStencil(bool enable);
228     bool stereo() const;
229     void setStereo(bool enable);
230     bool directRendering() const;
231     void setDirectRendering(bool enable);
232     bool hasOverlay() const;
233     void setOverlay(bool enable);
234
235     int plane() const;
236     void setPlane(int plane);
237
238     void setOption(QGL::FormatOptions opt);
239     bool testOption(QGL::FormatOptions opt) const;
240
241     static QGLFormat defaultFormat();
242     static void setDefaultFormat(const QGLFormat& f);
243
244     static QGLFormat defaultOverlayFormat();
245     static void setDefaultOverlayFormat(const QGLFormat& f);
246
247     static bool hasOpenGL();
248     static bool hasOpenGLOverlays();
249
250     void setVersion(int major, int minor);
251     int majorVersion() const;
252     int minorVersion() const;
253
254     enum OpenGLContextProfile {
255         NoProfile,
256         CoreProfile,
257         CompatibilityProfile
258     };
259
260     void setProfile(OpenGLContextProfile profile);
261     OpenGLContextProfile profile() const;
262
263     enum OpenGLVersionFlag {
264         OpenGL_Version_None               = 0x00000000,
265         OpenGL_Version_1_1                = 0x00000001,
266         OpenGL_Version_1_2                = 0x00000002,
267         OpenGL_Version_1_3                = 0x00000004,
268         OpenGL_Version_1_4                = 0x00000008,
269         OpenGL_Version_1_5                = 0x00000010,
270         OpenGL_Version_2_0                = 0x00000020,
271         OpenGL_Version_2_1                = 0x00000040,
272         OpenGL_ES_Common_Version_1_0      = 0x00000080,
273         OpenGL_ES_CommonLite_Version_1_0  = 0x00000100,
274         OpenGL_ES_Common_Version_1_1      = 0x00000200,
275         OpenGL_ES_CommonLite_Version_1_1  = 0x00000400,
276         OpenGL_ES_Version_2_0             = 0x00000800,
277         OpenGL_Version_3_0                = 0x00001000,
278         OpenGL_Version_3_1                = 0x00002000,
279         OpenGL_Version_3_2                = 0x00004000,
280         OpenGL_Version_3_3                = 0x00008000,
281         OpenGL_Version_4_0                = 0x00010000
282     };
283     Q_DECLARE_FLAGS(OpenGLVersionFlags, OpenGLVersionFlag)
284
285     static OpenGLVersionFlags openGLVersionFlags();
286
287 #if defined(Q_WS_QPA)
288     static QGLFormat fromPlatformWindowFormat(const QPlatformWindowFormat &format);
289     static QPlatformWindowFormat toPlatformWindowFormat(const QGLFormat &format);
290 #endif
291 private:
292     QGLFormatPrivate *d;
293
294     void detach();
295
296     friend Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
297     friend Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
298 #ifndef QT_NO_DEBUG_STREAM
299     friend Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
300 #endif
301 };
302
303 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFormat::OpenGLVersionFlags)
304
305 Q_OPENGL_EXPORT bool operator==(const QGLFormat&, const QGLFormat&);
306 Q_OPENGL_EXPORT bool operator!=(const QGLFormat&, const QGLFormat&);
307
308 #ifndef QT_NO_DEBUG_STREAM
309 Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &);
310 #endif
311
312 class QGLFunctions;
313
314 class Q_OPENGL_EXPORT QGLContext
315 {
316     Q_DECLARE_PRIVATE(QGLContext)
317 public:
318     QGLContext(const QGLFormat& format, QPaintDevice* device);
319     QGLContext(const QGLFormat& format);
320     virtual ~QGLContext();
321
322     virtual bool create(const QGLContext* shareContext = 0);
323     bool isValid() const;
324     bool isSharing() const;
325     void reset();
326
327     static bool areSharing(const QGLContext *context1, const QGLContext *context2);
328
329     QGLFormat format() const;
330     QGLFormat requestedFormat() const;
331     void setFormat(const QGLFormat& format);
332
333     // ### Qt 5: return bools + maybe remove virtuals
334     virtual void makeCurrent();
335     virtual void doneCurrent();
336
337     virtual void swapBuffers() const;
338
339     QGLFunctions *functions() const;
340
341     enum BindOption {
342         NoBindOption                            = 0x0000,
343         InvertedYBindOption                     = 0x0001,
344         MipmapBindOption                        = 0x0002,
345         PremultipliedAlphaBindOption            = 0x0004,
346         LinearFilteringBindOption               = 0x0008,
347
348         MemoryManagedBindOption                 = 0x0010, // internal flag
349         CanFlipNativePixmapBindOption           = 0x0020, // internal flag
350         TemporarilyCachedBindOption             = 0x0040, // internal flag
351
352         DefaultBindOption                       = LinearFilteringBindOption
353                                                   | InvertedYBindOption
354                                                   | MipmapBindOption,
355         InternalBindOption                      = MemoryManagedBindOption
356                                                   | PremultipliedAlphaBindOption
357     };
358     Q_DECLARE_FLAGS(BindOptions, BindOption)
359
360     GLuint bindTexture(const QImage &image, GLenum target, GLint format,
361                        BindOptions options);
362     GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
363                        BindOptions options);
364
365     GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
366                        GLint format = GL_RGBA);
367     GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
368                        GLint format = GL_RGBA);
369     GLuint bindTexture(const QString &fileName);
370
371     void deleteTexture(GLuint tx_id);
372
373     void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
374     void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
375
376 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS
377     GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D,
378                        QMacCompatGLint format = GL_RGBA);
379     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
380                        QMacCompatGLint format = GL_RGBA);
381     GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
382                        BindOptions);
383     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
384                        BindOptions);
385
386     void deleteTexture(QMacCompatGLuint tx_id);
387
388     void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
389     void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
390 #endif
391
392     static void setTextureCacheLimit(int size);
393     static int textureCacheLimit();
394
395     void *getProcAddress(const QString &proc) const;
396     QPaintDevice* device() const;
397     QColor overlayTransparentColor() const;
398
399     static const QGLContext* currentContext();
400
401 #ifdef Q_WS_QPA
402     static QGLContext *fromPlatformGLContext(QPlatformGLContext *platformContext);
403 #endif
404 protected:
405     virtual bool chooseContext(const QGLContext* shareContext = 0);
406
407 #if defined(Q_WS_WIN)
408     virtual int choosePixelFormat(void* pfd, HDC pdc);
409 #endif
410 #if defined(Q_WS_X11) && defined(QT_NO_EGL)
411     virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
412     virtual void* chooseVisual();
413 #endif
414 #if defined(Q_WS_MAC)
415     virtual void* chooseMacVisual(GDHandle);
416 #endif
417
418     bool deviceIsPixmap() const;
419     bool windowCreated() const;
420     void setWindowCreated(bool on);
421     bool initialized() const;
422     void setInitialized(bool on);
423     void generateFontDisplayLists(const QFont & fnt, int listBase); // ### Qt 5: remove
424
425     uint colorIndex(const QColor& c) const;
426     void setValid(bool valid);
427     void setDevice(QPaintDevice *pDev);
428
429 protected:
430     static QGLContext* currentCtx;
431
432 private:
433 #ifdef Q_WS_QPA
434     QGLContext(QPlatformGLContext *platformContext);
435 #endif
436
437     QScopedPointer<QGLContextPrivate> d_ptr;
438
439     friend class QGLPixelBuffer;
440     friend class QGLPixelBufferPrivate;
441     friend class QGLWidget;
442     friend class QGLWidgetPrivate;
443     friend class QGLGlyphCache;
444     friend class QOpenGLPaintEngine;
445     friend class QOpenGLPaintEnginePrivate;
446     friend class QGL2PaintEngineEx;
447     friend class QGL2PaintEngineExPrivate;
448     friend class QGLEngineShaderManager;
449     friend class QGLWindowSurface;
450     friend class QGLPixmapData;
451     friend class QGLPixmapFilterBase;
452     friend class QGLTextureGlyphCache;
453     friend struct QGLGlyphTexture;
454     friend class QGLContextGroup;
455     friend class QGLSharedResourceGuard;
456     friend class QGLPixmapBlurFilter;
457     friend class QGLExtensions;
458     friend class QGLTexture;
459     friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
460 #ifdef Q_WS_MAC
461 public:
462     void updatePaintDevice();
463 private:
464     friend class QMacGLWindowChangeEvent;
465     friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *);
466 #endif
467     friend class QGLFramebufferObject;
468     friend class QGLFramebufferObjectPrivate;
469     friend class QGLFBOGLPaintDevice;
470     friend class QGLPaintDevice;
471     friend class QGLWidgetGLPaintDevice;
472     friend class QX11GLPixmapData;
473     friend class QX11GLSharedContexts;
474     friend class QGLContextResourceBase;
475     friend class QSGDistanceFieldGlyphCache;
476 private:
477     Q_DISABLE_COPY(QGLContext)
478 };
479
480 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions)
481
482 class Q_OPENGL_EXPORT QGLWidget : public QWidget
483 {
484     Q_OBJECT
485     Q_DECLARE_PRIVATE(QGLWidget)
486 public:
487     explicit QGLWidget(QWidget* parent=0,
488                        const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
489     explicit QGLWidget(QGLContext *context, QWidget* parent=0,
490                        const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
491     explicit QGLWidget(const QGLFormat& format, QWidget* parent=0,
492                        const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
493 #ifdef QT3_SUPPORT
494     QT3_SUPPORT_CONSTRUCTOR QGLWidget(QWidget* parent, const char* name,
495                                     const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
496     QT3_SUPPORT_CONSTRUCTOR QGLWidget(QGLContext *context, QWidget* parent, const char* name,
497                                     const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
498     QT3_SUPPORT_CONSTRUCTOR QGLWidget(const QGLFormat& format, QWidget* parent, const char* name,
499                                     const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
500 #endif
501     ~QGLWidget();
502
503     void qglColor(const QColor& c) const;
504     void qglClearColor(const QColor& c) const;
505
506     bool isValid() const;
507     bool isSharing() const;
508
509     // ### Qt 5: return bools
510     void makeCurrent();
511     void doneCurrent();
512
513     bool doubleBuffer() const;
514     void swapBuffers();
515
516     QGLFormat format() const;
517     void setFormat(const QGLFormat& format);
518
519     const QGLContext* context() const;
520     void setContext(QGLContext* context, const QGLContext* shareContext = 0,
521                     bool deleteOldContext = true);
522
523     QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false);
524     QImage grabFrameBuffer(bool withAlpha = false);
525
526     void makeOverlayCurrent();
527     const QGLContext* overlayContext() const;
528
529     static QImage convertToGLFormat(const QImage& img);
530
531     void setMouseTracking(bool enable);
532
533     const QGLColormap & colormap() const;
534     void  setColormap(const QGLColormap & map);
535
536     void renderText(int x, int y, const QString & str,
537                      const QFont & fnt = QFont(), int listBase = 2000);
538     void renderText(double x, double y, double z, const QString & str,
539                      const QFont & fnt = QFont(), int listBase = 2000);
540     QPaintEngine *paintEngine() const;
541
542     GLuint bindTexture(const QImage &image, GLenum target, GLint format,
543                        QGLContext::BindOptions options);
544     GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
545                        QGLContext::BindOptions options);
546
547     GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
548                        GLint format = GL_RGBA);
549     GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
550                        GLint format = GL_RGBA);
551
552     GLuint bindTexture(const QString &fileName);
553
554     void deleteTexture(GLuint tx_id);
555
556     void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
557     void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
558
559 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS
560     GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D,
561                        QMacCompatGLint format = GL_RGBA);
562     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
563                        QMacCompatGLint format = GL_RGBA);
564     GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
565                        QGLContext::BindOptions);
566     GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
567                        QGLContext::BindOptions);
568
569     void deleteTexture(QMacCompatGLuint tx_id);
570
571     void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
572     void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
573 #endif
574
575 public Q_SLOTS:
576     virtual void updateGL();
577     virtual void updateOverlayGL();
578
579 protected:
580     bool event(QEvent *);
581     virtual void initializeGL();
582     virtual void resizeGL(int w, int h);
583     virtual void paintGL();
584
585     virtual void initializeOverlayGL();
586     virtual void resizeOverlayGL(int w, int h);
587     virtual void paintOverlayGL();
588
589     void setAutoBufferSwap(bool on);
590     bool autoBufferSwap() const;
591
592     void paintEvent(QPaintEvent*);
593     void resizeEvent(QResizeEvent*);
594
595     virtual void glInit();
596     virtual void glDraw();
597     int fontDisplayListBase(const QFont & fnt, int listBase = 2000); // ### Qt 5: remove
598
599     QGLWidget(QGLWidgetPrivate &dd,
600               const QGLFormat &format = QGLFormat(),
601               QWidget *parent = 0,
602               const QGLWidget* shareWidget = 0,
603               Qt::WindowFlags f = 0);
604 private:
605     Q_DISABLE_COPY(QGLWidget)
606
607 #ifdef Q_WS_MAC
608     friend class QMacGLWindowChangeEvent;
609 #endif
610     friend class QGLDrawable;
611     friend class QGLPixelBuffer;
612     friend class QGLPixelBufferPrivate;
613     friend class QGLContext;
614     friend class QGLContextPrivate;
615     friend class QGLOverlayWidget;
616     friend class QOpenGLPaintEngine;
617     friend class QGLPaintDevice;
618     friend class QGLWidgetGLPaintDevice;
619 };
620
621
622 //
623 // QGLFormat inline functions
624 //
625
626 inline bool QGLFormat::doubleBuffer() const
627 {
628     return testOption(QGL::DoubleBuffer);
629 }
630
631 inline bool QGLFormat::depth() const
632 {
633     return testOption(QGL::DepthBuffer);
634 }
635
636 inline bool QGLFormat::rgba() const
637 {
638     return testOption(QGL::Rgba);
639 }
640
641 inline bool QGLFormat::alpha() const
642 {
643     return testOption(QGL::AlphaChannel);
644 }
645
646 inline bool QGLFormat::accum() const
647 {
648     return testOption(QGL::AccumBuffer);
649 }
650
651 inline bool QGLFormat::stencil() const
652 {
653     return testOption(QGL::StencilBuffer);
654 }
655
656 inline bool QGLFormat::stereo() const
657 {
658     return testOption(QGL::StereoBuffers);
659 }
660
661 inline bool QGLFormat::directRendering() const
662 {
663     return testOption(QGL::DirectRendering);
664 }
665
666 inline bool QGLFormat::hasOverlay() const
667 {
668     return testOption(QGL::HasOverlay);
669 }
670
671 inline bool QGLFormat::sampleBuffers() const
672 {
673     return testOption(QGL::SampleBuffers);
674 }
675
676 QT_END_NAMESPACE
677
678 QT_END_HEADER
679
680 #endif // QGL_H