Qt 4.8
qgl.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtOpenGL module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
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 
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 
92 
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 {
143 
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,
158  ColorIndex = Rgba << 16,
167  };
168  Q_DECLARE_FLAGS(FormatOptions, FormatOption)
169 }
170 
171 Q_DECLARE_OPERATORS_FOR_FLAGS(QGL::FormatOptions)
172 
173 class QGLFormatPrivate;
174 
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 
255  CompatibilityProfile
256  };
257 
258  void setProfile(OpenGLContextProfile profile);
259  OpenGLContextProfile profile() const;
260 
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 fromPlatformWindowFormat(const QPlatformWindowFormat &format);
287  static QPlatformWindowFormat toPlatformWindowFormat(const QGLFormat &format);
288 #endif
289 private:
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
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
308 #endif
309 
311 {
313 public:
314  QGLContext(const QGLFormat& format, QPaintDevice* device);
315  QGLContext(const QGLFormat& format);
316  virtual ~QGLContext();
317 
318  virtual bool create(const QGLContext* shareContext = 0);
319  bool isValid() const;
320  bool isSharing() const;
321  void reset();
322 
323  static bool areSharing(const QGLContext *context1, const QGLContext *context2);
324 
325  QGLFormat format() const;
326  QGLFormat requestedFormat() const;
327  void setFormat(const QGLFormat& format);
328 
329  // ### Qt 5: return bools + maybe remove virtuals
330  virtual void makeCurrent();
331  virtual void doneCurrent();
332 
333  virtual void swapBuffers() 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 
345  DefaultBindOption = LinearFilteringBindOption
346  | InvertedYBindOption
347  | MipmapBindOption,
348  InternalBindOption = MemoryManagedBindOption
349  | PremultipliedAlphaBindOption
350  };
351  Q_DECLARE_FLAGS(BindOptions, BindOption)
352 
353  GLuint bindTexture(const QImage &image, GLenum target, GLint format,
354  BindOptions options);
355  GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
356  BindOptions options);
357 
358  GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
359  GLint format = GL_RGBA);
360  GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
361  GLint format = GL_RGBA);
362  GLuint bindTexture(const QString &fileName);
363 
364  void deleteTexture(GLuint tx_id);
365 
366  void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
367  void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
368 
369 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS
370  GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D,
371  QMacCompatGLint format = GL_RGBA);
372  GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
373  QMacCompatGLint format = GL_RGBA);
374  GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
375  BindOptions);
376  GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
377  BindOptions);
378 
379  void deleteTexture(QMacCompatGLuint tx_id);
380 
381  void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
382  void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
383 #endif
384 
385  static void setTextureCacheLimit(int size);
386  static int textureCacheLimit();
387 
388  void *getProcAddress(const QString &proc) const;
389  QPaintDevice* device() const;
390  QColor overlayTransparentColor() const;
391 
392  static const QGLContext* currentContext();
393 
394 #ifdef Q_WS_QPA
395  static QGLContext *fromPlatformGLContext(QPlatformGLContext *platformContext);
396 #endif
397 protected:
398  virtual bool chooseContext(const QGLContext* shareContext = 0);
399 
400 #if defined(Q_WS_WIN)
401  virtual int choosePixelFormat(void* pfd, HDC pdc);
402 #endif
403 #if defined(Q_WS_X11)
404  virtual void* tryVisual(const QGLFormat& f, int bufDepth = 1);
405  virtual void* chooseVisual();
406 #endif
407 #if defined(Q_WS_MAC)
408  virtual void* chooseMacVisual(GDHandle);
409 #endif
410 
411  bool deviceIsPixmap() const;
412  bool windowCreated() const;
413  void setWindowCreated(bool on);
414  bool initialized() const;
415  void setInitialized(bool on);
416  void generateFontDisplayLists(const QFont & fnt, int listBase); // ### Qt 5: remove
417 
418  uint colorIndex(const QColor& c) const;
419  void setValid(bool valid);
420  void setDevice(QPaintDevice *pDev);
421 
422 protected:
424 
425 private:
426 #ifdef Q_WS_QPA
427  QGLContext(QPlatformGLContext *platformContext);
428 #endif
429 
431 
432  friend class QGLPixelBuffer;
433  friend class QGLPixelBufferPrivate;
434  friend class QGLWidget;
435  friend class QGLWidgetPrivate;
436  friend class QGLGlyphCache;
437  friend class QOpenGLPaintEngine;
439  friend class QGL2PaintEngineEx;
442  friend class QGLWindowSurface;
443  friend class QGLPixmapData;
444  friend class QGLPixmapFilterBase;
445  friend class QGLTextureGlyphCache;
446  friend struct QGLGlyphTexture;
447  friend class QGLContextGroup;
449  friend class QGLPixmapBlurFilter;
450  friend class QGLExtensions;
451  friend class QGLTexture;
452  friend QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags();
453 #ifdef Q_WS_MAC
454 public:
455  void updatePaintDevice();
456 private:
457  friend class QMacGLWindowChangeEvent;
458  friend QGLContextPrivate *qt_phonon_get_dptr(const QGLContext *);
459 #endif
460  friend class QGLFramebufferObject;
462  friend class QGLFBOGLPaintDevice;
463  friend class QGLPaintDevice;
465  friend class QX11GLPixmapData;
466  friend class QX11GLSharedContexts;
468 private:
470 };
471 
472 Q_DECLARE_OPERATORS_FOR_FLAGS(QGLContext::BindOptions)
473 
475 {
476  Q_OBJECT
478 public:
479  explicit QGLWidget(QWidget* parent=0,
480  const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
481  explicit QGLWidget(QGLContext *context, QWidget* parent=0,
482  const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
483  explicit QGLWidget(const QGLFormat& format, QWidget* parent=0,
484  const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
485 #ifdef QT3_SUPPORT
486  QT3_SUPPORT_CONSTRUCTOR QGLWidget(QWidget* parent, const char* name,
487  const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
488  QT3_SUPPORT_CONSTRUCTOR QGLWidget(QGLContext *context, QWidget* parent, const char* name,
489  const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
490  QT3_SUPPORT_CONSTRUCTOR QGLWidget(const QGLFormat& format, QWidget* parent, const char* name,
491  const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
492 #endif
493  ~QGLWidget();
494 
495  void qglColor(const QColor& c) const;
496  void qglClearColor(const QColor& c) const;
497 
498  bool isValid() const;
499  bool isSharing() const;
500 
501  // ### Qt 5: return bools
502  void makeCurrent();
503  void doneCurrent();
504 
505  bool doubleBuffer() const;
506  void swapBuffers();
507 
508  QGLFormat format() const;
509  void setFormat(const QGLFormat& format);
510 
511  const QGLContext* context() const;
512  void setContext(QGLContext* context, const QGLContext* shareContext = 0,
513  bool deleteOldContext = true);
514 
515  QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false);
516  QImage grabFrameBuffer(bool withAlpha = false);
517 
518  void makeOverlayCurrent();
519  const QGLContext* overlayContext() const;
520 
521  static QImage convertToGLFormat(const QImage& img);
522 
523  void setMouseTracking(bool enable);
524 
525  const QGLColormap & colormap() const;
526  void setColormap(const QGLColormap & map);
527 
528  void renderText(int x, int y, const QString & str,
529  const QFont & fnt = QFont(), int listBase = 2000);
530  void renderText(double x, double y, double z, const QString & str,
531  const QFont & fnt = QFont(), int listBase = 2000);
532  QPaintEngine *paintEngine() const;
533 
534  GLuint bindTexture(const QImage &image, GLenum target, GLint format,
535  QGLContext::BindOptions options);
536  GLuint bindTexture(const QPixmap &pixmap, GLenum target, GLint format,
537  QGLContext::BindOptions options);
538 
539  GLuint bindTexture(const QImage &image, GLenum target = GL_TEXTURE_2D,
540  GLint format = GL_RGBA);
541  GLuint bindTexture(const QPixmap &pixmap, GLenum target = GL_TEXTURE_2D,
542  GLint format = GL_RGBA);
543 
544  GLuint bindTexture(const QString &fileName);
545 
546  void deleteTexture(GLuint tx_id);
547 
548  void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
549  void drawTexture(const QPointF &point, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);
550 
551 #ifdef Q_MAC_COMPAT_GL_FUNCTIONS
552  GLuint bindTexture(const QImage &image, QMacCompatGLenum = GL_TEXTURE_2D,
553  QMacCompatGLint format = GL_RGBA);
554  GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum = GL_TEXTURE_2D,
555  QMacCompatGLint format = GL_RGBA);
556  GLuint bindTexture(const QImage &image, QMacCompatGLenum, QMacCompatGLint format,
557  QGLContext::BindOptions);
558  GLuint bindTexture(const QPixmap &pixmap, QMacCompatGLenum, QMacCompatGLint format,
559  QGLContext::BindOptions);
560 
561  void deleteTexture(QMacCompatGLuint tx_id);
562 
563  void drawTexture(const QRectF &target, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
564  void drawTexture(const QPointF &point, QMacCompatGLuint textureId, QMacCompatGLenum textureTarget = GL_TEXTURE_2D);
565 #endif
566 
567 public Q_SLOTS:
568  virtual void updateGL();
569  virtual void updateOverlayGL();
570 
571 protected:
572  bool event(QEvent *);
573  virtual void initializeGL();
574  virtual void resizeGL(int w, int h);
575  virtual void paintGL();
576 
577  virtual void initializeOverlayGL();
578  virtual void resizeOverlayGL(int w, int h);
579  virtual void paintOverlayGL();
580 
581  void setAutoBufferSwap(bool on);
582  bool autoBufferSwap() const;
583 
584  void paintEvent(QPaintEvent*);
585  void resizeEvent(QResizeEvent*);
586 
587  virtual void glInit();
588  virtual void glDraw();
589  int fontDisplayListBase(const QFont & fnt, int listBase = 2000); // ### Qt 5: remove
590 
591 private:
592  Q_DISABLE_COPY(QGLWidget)
593 
594 #ifdef Q_WS_MAC
595  friend class QMacGLWindowChangeEvent;
596 #endif
597  friend class QGLDrawable;
598  friend class QGLPixelBuffer;
599  friend class QGLPixelBufferPrivate;
600  friend class QGLContext;
601  friend class QGLContextPrivate;
602  friend class QGLOverlayWidget;
603  friend class QOpenGLPaintEngine;
604  friend class QGLPaintDevice;
606 };
607 
608 
609 //
610 // QGLFormat inline functions
611 //
612 
613 inline bool QGLFormat::doubleBuffer() const
614 {
615  return testOption(QGL::DoubleBuffer);
616 }
617 
618 inline bool QGLFormat::depth() const
619 {
620  return testOption(QGL::DepthBuffer);
621 }
622 
623 inline bool QGLFormat::rgba() const
624 {
625  return testOption(QGL::Rgba);
626 }
627 
628 inline bool QGLFormat::alpha() const
629 {
630  return testOption(QGL::AlphaChannel);
631 }
632 
633 inline bool QGLFormat::accum() const
634 {
635  return testOption(QGL::AccumBuffer);
636 }
637 
638 inline bool QGLFormat::stencil() const
639 {
640  return testOption(QGL::StencilBuffer);
641 }
642 
643 inline bool QGLFormat::stereo() const
644 {
645  return testOption(QGL::StereoBuffers);
646 }
647 
648 inline bool QGLFormat::directRendering() const
649 {
650  return testOption(QGL::DirectRendering);
651 }
652 
653 inline bool QGLFormat::hasOverlay() const
654 {
655  return testOption(QGL::HasOverlay);
656 }
657 
658 inline bool QGLFormat::sampleBuffers() const
659 {
660  return testOption(QGL::SampleBuffers);
661 }
662 
664 
666 
667 #endif // QGL_H
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
OpenGLContextProfile
This enum describes the OpenGL context profiles that can be specified for contexts implementing OpenG...
Definition: qgl.h:252
The QGL namespace specifies miscellaneous identifiers used in the Qt OpenGL module.
FormatOption
This enum specifies the format options that can be used to configure an OpenGL context.
Definition: qgl.h:144
QScopedPointer< QGLContextPrivate > d_ptr
Definition: qgl.h:430
Q_OPENGL_EXPORT void setPreferredPaintEngine(QPaintEngine::Type engineType)
Sets the preferred OpenGL paint engine that is used to draw onto QGLWidget, QGLPixelBuffer and QGLFra...
Definition: qgl.cpp:299
bool rgba() const
Returns true if RGBA color mode is set.
Definition: qgl.h:623
static OpenGLVersionFlags openGLVersionFlags()
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
EventRef event
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_DECLARE_FLAGS(Flags, Enum)
The Q_DECLARE_FLAGS() macro expands to.
Definition: qglobal.h:2348
#define Q_OPENGL_EXPORT
Definition: qglobal.h:1455
The QGLFramebufferObject class encapsulates an OpenGL framebuffer object.
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
Definition: qgl.h:147
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QPlatformWindowFormat class specifies the display format of an OpenGL rendering context and if po...
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
#define Q_SLOTS
Definition: qobjectdefs.h:71
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define GL_TEXTURE_2D
bool directRendering() const
Returns true if direct rendering is enabled; otherwise returns false.
Definition: qgl.h:648
bool sampleBuffers() const
Returns true if multisample buffer support is enabled; otherwise returns false.
Definition: qgl.h:658
Q_OPENGL_EXPORT bool operator!=(const QGLFormat &, const QGLFormat &)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
bool depth() const
Returns true if the depth buffer is enabled; otherwise returns false.
Definition: qgl.h:618
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
The Q_DECLARE_OPERATORS_FOR_FLAGS() macro declares global operator|() functions for Flags...
Definition: qglobal.h:2355
The QGLFormat class specifies the display format of an OpenGL rendering context.
Definition: qgl.h:175
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
const char * name
BindOption
A set of options to decide how to bind a texture using bindTexture().
Definition: qgl.h:335
bool stencil() const
Returns true if the stencil buffer is enabled; otherwise returns false.
Definition: qgl.h:638
The QResizeEvent class contains event parameters for resize events.
Definition: qevent.h:349
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
The QGLPixelBuffer class encapsulates an OpenGL pbuffer.
bool accum() const
Returns true if the accumulation buffer is enabled; otherwise returns false.
Definition: qgl.h:633
handler setDevice(device)
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
Definition: qpaintengine.h:90
static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &src=QRectF())
The QGLColormap class is used for installing custom colormaps into a QGLWidget.
Definition: qglcolormap.h:54
#define Q_OBJECT
Definition: qobjectdefs.h:157
OpenGLVersionFlag
This enum describes the various OpenGL versions that are recognized by Qt.
Definition: qgl.h:261
Q_OPENGL_EXPORT QDebug operator<<(QDebug, const QGLFormat &)
Definition: qgl.cpp:1620
The QGLWidget class is a widget for rendering OpenGL graphics.
Definition: qgl.h:474
bool hasOverlay() const
Returns true if overlay plane is enabled; otherwise returns false.
Definition: qgl.h:653
The QPlatformGLContext class provides an abstraction for native GL contexts.
unsigned int GLenum
Definition: main.cpp:50
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
QGLFormatPrivate * d
Definition: qgl.h:290
bool alpha() const
Returns true if the alpha buffer in the framebuffer is enabled; otherwise returns false...
Definition: qgl.h:628
bool doubleBuffer() const
Returns true if double buffering is enabled; otherwise returns false.
Definition: qgl.h:613
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
typedef GLint
Definition: glfunctions.h:67
#define GL_RGBA
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
#define class
Q_OPENGL_EXPORT bool operator==(const QGLFormat &, const QGLFormat &)
static QGLContext * currentCtx
Definition: qgl.h:423
bool stereo() const
Returns true if stereo buffering is enabled; otherwise returns false.
Definition: qgl.h:643
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
#define QT_END_HEADER
Definition: qglobal.h:137
static QString fileName(const QString &fileUrl)
GDPtr * GDHandle