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