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