Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopenglwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
6#include <QtGui/QOpenGLFunctions>
7#include <QtGui/private/qpaintdevicewindow_p.h>
8#include <QtGui/private/qopenglextensions_p.h>
9#include <QtGui/private/qopenglcontext_p.h>
10#include <QtGui/QMatrix4x4>
11#include <QtGui/QOffscreenSurface>
12
13#include <QtOpenGL/private/qopenglframebufferobject_p.h>
14#include <QtOpenGL/QOpenGLFramebufferObject>
15#include <QtOpenGL/QOpenGLTextureBlitter>
16#include <QtOpenGL/QOpenGLPaintDevice>
17
19
20/*!
21 \class QOpenGLWindow
22 \inmodule QtOpenGL
23 \since 5.4
24 \brief The QOpenGLWindow class is a convenience subclass of QWindow to perform OpenGL painting.
25
26 QOpenGLWindow is an enhanced QWindow that allows easily creating windows that
27 perform OpenGL rendering using an API that is compatible with QOpenGLWidget
28 Unlike QOpenGLWidget, QOpenGLWindow has no dependency on the widgets module
29 and offers better performance.
30
31 A typical application will subclass QOpenGLWindow and reimplement the following
32 virtual functions:
33
34 \list
35
36 \li initializeGL() to perform OpenGL resource initialization
37
38 \li resizeGL() to set up the transformation matrices and other window size dependent resources
39
40 \li paintGL() to issue OpenGL commands or draw using QPainter
41
42 \endlist
43
44 To schedule a repaint, call the update() function. Note that this will not
45 immediately result in a call to paintGL(). Calling update() multiple times in
46 a row will not change the behavior in any way.
47
48 This is a slot so it can be connected to a \l QChronoTimer::timeout() signal to
49 perform animation. Note however that in the modern OpenGL world it is a much
50 better choice to rely on synchronization to the vertical refresh rate of the
51 display. See \l{QSurfaceFormat::setSwapInterval()}{setSwapInterval()} on a
52 description of the swap interval. With a swap interval of \c 1, which is the
53 case on most systems by default, the
54 \l{QOpenGLContext::swapBuffers()}{swapBuffers()} call, that is executed
55 internally by QOpenGLWindow after each repaint, will block and wait for
56 vsync. This means that whenever the swap is done, an update can be scheduled
57 again by calling update(), without relying on timers.
58
59 To request a specific configuration for the context, use setFormat()
60 like for any other QWindow. This allows, among others, requesting a
61 given OpenGL version and profile, or enabling depth and stencil
62 buffers.
63
64 \note It is up to the application to ensure depth and stencil buffers are
65 requested from the underlying windowing system interface. Without requesting
66 a non-zero depth buffer size there is no guarantee that a depth buffer will
67 be available, and as a result depth testing related OpenGL operations may fail
68 to function as expected.
69
70 Commonly used depth and stencil buffer size requests are 24 and 8,
71 respectively. For example, a QOpenGLWindow subclass could do this in its
72 constructor:
73
74 \code
75 QSurfaceFormat format;
76 format.setDepthBufferSize(24);
77 format.setStencilBufferSize(8);
78 setFormat(format);
79 \endcode
80
81 Unlike QWindow, QOpenGLWindow allows opening a painter on itself and perform
82 QPainter-based drawing.
83
84 QOpenGLWindow supports multiple update behaviors. The default,
85 \c NoPartialUpdate is equivalent to a regular, OpenGL-based QWindow. In
86 contrast, \c PartialUpdateBlit and \c PartialUpdateBlend are
87 more in line with QOpenGLWidget's way of working, where there is always an
88 extra, dedicated framebuffer object present. These modes allow, by
89 sacrificing some performance, redrawing only a smaller area on each paint and
90 having the rest of the content preserved from of the previous frame. This is
91 useful for applications than render incrementally using QPainter, because
92 this way they do not have to redraw the entire window content on each
93 paintGL() call.
94
95 Similarly to QOpenGLWidget, QOpenGLWindow supports the Qt::AA_ShareOpenGLContexts
96 attribute. When enabled, the OpenGL contexts of all QOpenGLWindow instances will share
97 with each other. This allows accessing each other's shareable OpenGL resources.
98
99 For more information on graphics in Qt, see \l {Graphics}.
100 */
101
102/*!
103 \enum QOpenGLWindow::UpdateBehavior
104
105 This enum describes the update strategy of the QOpenGLWindow.
106
107 \value NoPartialUpdate Indicates that the entire window surface will
108 redrawn on each update and so no additional framebuffers are needed.
109 This is the setting used in most cases and is equivalent to how drawing
110 directly via QWindow would function.
111
112 \value PartialUpdateBlit Indicates that the drawing performed in paintGL()
113 does not cover the entire window. In this case an extra framebuffer object
114 is created under the hood, and rendering performed in paintGL() will target
115 this framebuffer. This framebuffer is then blitted onto the window surface's
116 default framebuffer after each paint. This allows having QPainter-based drawing
117 code in paintGL() which only repaints a smaller area at a time, because, unlike
118 NoPartialUpdate, the previous content is preserved.
119
120 \value PartialUpdateBlend Similar to PartialUpdateBlit, but instead of using
121 framebuffer blits, the contents of the extra framebuffer is rendered by
122 drawing a textured quad with blending enabled. This, unlike PartialUpdateBlit,
123 allows alpha blended content and works even when the glBlitFramebuffer is
124 not available. Performance-wise this setting is likely to be somewhat slower
125 than PartialUpdateBlit.
126
127 \note PartialUpdateBlit and PartialUpdateBlend require framebuffer object
128 support. When this is not available, for example with an OpenGL 1.1
129 implementation, NoPartialUpdate is used instead.
130 */
131
132/*!
133 \fn void QOpenGLWindow::frameSwapped()
134
135 This signal is emitted after the potentially blocking
136 \l{QOpenGLContext::swapBuffers()}{buffer swap} has been done. Applications
137 that wish to continuously repaint synchronized to the vertical refresh,
138 should issue an update() upon this signal. This allows for a much smoother
139 experience compared to the traditional usage of timers.
140*/
141
142// GLES2 builds won't have these constants with the suffixless names
143#ifndef GL_READ_FRAMEBUFFER
144#define GL_READ_FRAMEBUFFER 0x8CA8
145#endif
146#ifndef GL_DRAW_FRAMEBUFFER
147#define GL_DRAW_FRAMEBUFFER 0x8CA9
148#endif
149
158
193
194QOpenGLWindowPrivate::~QOpenGLWindowPrivate()
195{
196}
197
199{
200 Q_Q(QOpenGLWindow);
201
202 if (context)
203 return;
204
205 if (!q->handle())
206 qWarning("Attempted to initialize QOpenGLWindow without a platform window");
207
208 context.reset(new QOpenGLContext);
209 context->setShareContext(shareContext);
210 context->setFormat(q->requestedFormat());
211 if (!context->create())
212 qWarning("QOpenGLWindow::beginPaint: Failed to create context");
213 if (!context->makeCurrent(q))
214 qWarning("QOpenGLWindow::beginPaint: Failed to make context current");
215
216 if (updateBehavior > QOpenGLWindow::NoPartialUpdate
217 && !context->functions()->hasOpenGLFeature(QOpenGLFunctions::Framebuffers))
218 {
219 qWarning("QOpenGLWindow: Framebuffer objects are not supported, falling back to NoPartialUpdate");
220 updateBehavior = QOpenGLWindow::NoPartialUpdate;
221 }
222
223 paintDevice.reset(new QOpenGLWindowPaintDevice(q));
224 if (updateBehavior == QOpenGLWindow::PartialUpdateBlit)
225 hasFboBlit = QOpenGLFramebufferObject::hasOpenGLFramebufferBlit();
226
227 q->initializeGL();
228}
229
230void QOpenGLWindowPrivate::beginPaint(const QRegion &region)
231{
232 Q_UNUSED(region);
233 Q_Q(QOpenGLWindow);
234
236 context->makeCurrent(q);
237
238 // Note: deviceSize is computed using rounding (not truncating), in
239 // order to match framebuffer and window size.
240 const QSize deviceSize = q->size() * q->devicePixelRatio();
241 const int deviceWidth = deviceSize.width();
242 const int deviceHeight = deviceSize.height();
243 if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
244 if (!fbo || fbo->size() != deviceSize) {
245 QOpenGLFramebufferObjectFormat fboFormat;
246 fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
247 const int samples = q->requestedFormat().samples();
248 if (samples > 0) {
249 if (updateBehavior != QOpenGLWindow::PartialUpdateBlend)
250 fboFormat.setSamples(samples);
251 else
252 qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling");
253 }
254 fbo.reset(new QOpenGLFramebufferObject(deviceSize, fboFormat));
255 markWindowAsDirty();
256 }
257 } else {
258 markWindowAsDirty();
259 }
260
261 paintDevice->setSize(QSize(deviceWidth, deviceHeight));
262 paintDevice->setDevicePixelRatio(q->devicePixelRatio());
263 context->functions()->glViewport(0, 0, deviceWidth, deviceHeight);
264
265 if (context->functions()->hasOpenGLFeature(QOpenGLFunctions::Framebuffers))
266 context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
267
268 q->paintUnderGL();
269
270 if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
271 fbo->bind();
272}
273
275{
276 Q_Q(QOpenGLWindow);
277
278 if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
279 fbo->release();
280
281 if (context->functions()->hasOpenGLFeature(QOpenGLFunctions::Framebuffers))
282 context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
283
284 if (updateBehavior == QOpenGLWindow::PartialUpdateBlit && hasFboBlit) {
285 const QSize deviceSize = q->size() * q->devicePixelRatio();
286 const int deviceWidth = deviceSize.width();
287 const int deviceHeight = deviceSize.height();
288 QOpenGLExtensions extensions(context.data());
289 extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->handle());
290 extensions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, context->defaultFramebufferObject());
291 extensions.glBlitFramebuffer(0, 0, deviceWidth, deviceHeight,
292 0, 0, deviceWidth, deviceHeight,
293 GL_COLOR_BUFFER_BIT, GL_NEAREST);
294 } else if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
295 if (updateBehavior == QOpenGLWindow::PartialUpdateBlend) {
296 context->functions()->glEnable(GL_BLEND);
297 context->functions()->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
298 }
299 if (!blitter.isCreated())
300 blitter.create();
301
302 QRect windowRect(QPoint(0, 0), fbo->size());
303 QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect);
304 blitter.bind();
305 blitter.blit(fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
306 blitter.release();
307
308 if (updateBehavior == QOpenGLWindow::PartialUpdateBlend)
309 context->functions()->glDisable(GL_BLEND);
310 }
311
312 q->paintOverGL();
313}
314
316{
317 if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
318 fbo->bind();
319 else if (context->functions()->hasOpenGLFeature(QOpenGLFunctions::Framebuffers))
320 QOpenGLFramebufferObject::bindDefault();
321}
322
323void QOpenGLWindowPrivate::flush(const QRegion &region)
324{
325 Q_UNUSED(region);
326 Q_Q(QOpenGLWindow);
327 context->swapBuffers(q);
328 emit q->frameSwapped();
329}
330
332{
333 QOpenGLWindowPrivate::get(m_window)->bindFBO();
334}
335
336/*!
337 Constructs a new QOpenGLWindow with the given \a parent and \a updateBehavior.
338
339 \sa QOpenGLWindow::UpdateBehavior
340 */
341QOpenGLWindow::QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior, QWindow *parent)
342 : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(nullptr, updateBehavior)), parent)
343{
344 setSurfaceType(QSurface::OpenGLSurface);
345}
346
347/*!
348 Constructs a new QOpenGLWindow with the given \a parent and \a updateBehavior.
349 The QOpenGLWindow's context will share with \a shareContext.
350
351 \sa QOpenGLWindow::UpdateBehavior, shareContext
352*/
353QOpenGLWindow::QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior, QWindow *parent)
354 : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(shareContext, updateBehavior)), parent)
355{
356 setSurfaceType(QSurface::OpenGLSurface);
357}
358
359/*!
360 Destroys the QOpenGLWindow instance, freeing its resources.
361
362 The OpenGLWindow's context is made current in the destructor, allowing for
363 safe destruction of any child object that may need to release OpenGL
364 resources belonging to the context provided by this window.
365
366 \warning if you have objects wrapping OpenGL resources (such as
367 QOpenGLBuffer, QOpenGLShaderProgram, etc.) as members of a QOpenGLWindow
368 subclass, you may need to add a call to makeCurrent() in that subclass'
369 destructor as well. Due to the rules of C++ object destruction, those objects
370 will be destroyed \e{before} calling this function (but after that the
371 destructor of the subclass has run), therefore making the OpenGL context
372 current in this function happens too late for their safe disposal.
373
374 \sa makeCurrent
375
376 \since 5.5
377*/
378QOpenGLWindow::~QOpenGLWindow()
379{
380 Q_D(QOpenGLWindow);
381
382 makeCurrent(); // this works even when the platformwindow is destroyed
383 if (isValid()) {
384 d->paintDevice.reset(nullptr);
385 d->fbo.reset(nullptr);
386 d->blitter.destroy();
387 }
388 doneCurrent();
389}
390
391/*!
392 \return the update behavior for this QOpenGLWindow.
393*/
394QOpenGLWindow::UpdateBehavior QOpenGLWindow::updateBehavior() const
395{
396 Q_D(const QOpenGLWindow);
397 return d->updateBehavior;
398}
399
400/*!
401 \return \c true if the window's OpenGL resources, like the context, have
402 been successfully initialized. Note that the return value is always \c false
403 until the window becomes exposed (shown).
404*/
405bool QOpenGLWindow::isValid() const
406{
407 Q_D(const QOpenGLWindow);
408 return d->context && d->context->isValid();
409}
410
411/*!
412 Prepares for rendering OpenGL content for this window by making the
413 corresponding context current and binding the framebuffer object, if there is
414 one, in that context.
415
416 It is not necessary to call this function in most cases, because it is called
417 automatically before invoking paintGL(). It is provided nonetheless to support
418 advanced, multi-threaded scenarios where a thread different than the GUI or main
419 thread may want to update the surface or framebuffer contents. See QOpenGLContext
420 for more information on threading related issues.
421
422 This function is suitable for calling also when the underlying platform window
423 is already destroyed. This means that it is safe to call this function from
424 a QOpenGLWindow subclass' destructor. If there is no native window anymore,
425 an offscreen surface is used instead. This ensures that OpenGL resource
426 cleanup operations in the destructor will always work, as long as
427 this function is called first.
428
429 \sa QOpenGLContext, context(), paintGL(), doneCurrent()
430 */
431void QOpenGLWindow::makeCurrent()
432{
433 Q_D(QOpenGLWindow);
434
435 if (!isValid())
436 return;
437
438 // The platform window may be destroyed at this stage and therefore
439 // makeCurrent() may not safely be called with 'this'.
440 if (handle()) {
441 d->context->makeCurrent(this);
442 } else {
443 if (!d->offscreenSurface) {
444 d->offscreenSurface.reset(new QOffscreenSurface(screen()));
445 d->offscreenSurface->setFormat(d->context->format());
446 d->offscreenSurface->create();
447 }
448 d->context->makeCurrent(d->offscreenSurface.data());
449 }
450
451 d->bindFBO();
452}
453
454/*!
455 Releases the context.
456
457 It is not necessary to call this function in most cases, since the widget
458 will make sure the context is bound and released properly when invoking
459 paintGL().
460
461 \sa makeCurrent()
462 */
463void QOpenGLWindow::doneCurrent()
464{
465 Q_D(QOpenGLWindow);
466
467 if (!isValid())
468 return;
469
470 d->context->doneCurrent();
471}
472
473/*!
474 \return The QOpenGLContext used by this window or \c 0 if not yet initialized.
475 */
476QOpenGLContext *QOpenGLWindow::context() const
477{
478 Q_D(const QOpenGLWindow);
479 return d->context.data();
480}
481
482/*!
483 \return The QOpenGLContext requested to be shared with this window's QOpenGLContext.
484*/
485QOpenGLContext *QOpenGLWindow::shareContext() const
486{
487 Q_D(const QOpenGLWindow);
488 return d->shareContext;
489}
490
491/*!
492 The framebuffer object handle used by this window.
493
494 When the update behavior is set to \c NoPartialUpdate, there is no separate
495 framebuffer object. In this case the returned value is the ID of the
496 default framebuffer.
497
498 Otherwise the value of the ID of the framebuffer object or \c 0 if not
499 yet initialized.
500 */
501GLuint QOpenGLWindow::defaultFramebufferObject() const
502{
503 Q_D(const QOpenGLWindow);
504 if (d->updateBehavior > NoPartialUpdate && d->fbo)
505 return d->fbo->handle();
506 else if (QOpenGLContext *ctx = QOpenGLContext::currentContext())
507 return ctx->defaultFramebufferObject();
508 else
509 return 0;
510}
511
512/*!
513 Returns a copy of the framebuffer.
514
515 \note This is a potentially expensive operation because it relies on
516 glReadPixels() to read back the pixels. This may be slow and can stall the
517 GPU pipeline.
518
519 \note When used together with update behavior \c NoPartialUpdate, the returned
520 image may not contain the desired content when called after the front and back
521 buffers have been swapped (unless preserved swap is enabled in the underlying
522 windowing system interface). In this mode the function reads from the back
523 buffer and the contents of that may not match the content on the screen (the
524 front buffer). In this case the only place where this function can safely be
525 used is paintGL() or paintOverGL().
526 */
527QImage QOpenGLWindow::grabFramebuffer()
528{
529 if (!isValid())
530 return QImage();
531
532 makeCurrent();
533
534 const bool hasAlpha = format().hasAlpha();
535 QImage img = qt_gl_read_framebuffer(size() * devicePixelRatio(), hasAlpha, hasAlpha);
536 img.setDevicePixelRatio(devicePixelRatio());
537 return img;
538}
539
540/*!
541 This virtual function is called once before the first call to paintGL() or
542 resizeGL(). Reimplement it in a subclass.
543
544 This function should set up any required OpenGL resources and state.
545
546 There is no need to call makeCurrent() because this has already been done
547 when this function is called. Note however that the framebuffer, in case
548 partial update mode is used, is not yet available at this stage, so avoid
549 issuing draw calls from here. Defer such calls to paintGL() instead.
550
551 \sa paintGL(), resizeGL()
552 */
553void QOpenGLWindow::initializeGL()
554{
555}
556
557/*!
558 This virtual function is called whenever the widget has been resized.
559 Reimplement it in a subclass. The new size is passed in \a w and \a h.
560
561 \note This is merely a convenience function in order to provide an API that is
562 compatible with QOpenGLWidget. Unlike with QOpenGLWidget, derived classes are
563 free to choose to override resizeEvent() instead of this function.
564
565 \note Avoid issuing OpenGL commands from this function as there may not be a
566 context current when it is invoked. If it cannot be avoided, call makeCurrent().
567
568 \note Scheduling updates from here is not necessary. The windowing systems
569 will send expose events that trigger an update automatically.
570
571 \sa initializeGL(), paintGL()
572 */
573void QOpenGLWindow::resizeGL(int w, int h)
574{
575 Q_UNUSED(w);
576 Q_UNUSED(h);
577}
578
579/*!
580 This virtual function is called whenever the window contents needs to be
581 painted. Reimplement it in a subclass.
582
583 There is no need to call makeCurrent() because this has already
584 been done when this function is called.
585
586 Before invoking this function, the context and the framebuffer, if there is
587 one, are bound, and the viewport is set up by a call to glViewport(). No
588 other state is set and no clearing or drawing is performed by the framework.
589
590 \note When using a partial update behavior, like \c PartialUpdateBlend, the
591 output of the previous paintGL() call is preserved and, after the additional
592 drawing performed in the current invocation of the function, the content is
593 blitted or blended over the content drawn directly to the window in
594 paintUnderGL().
595
596 \sa initializeGL(), resizeGL(), paintUnderGL(), paintOverGL(), UpdateBehavior
597 */
598void QOpenGLWindow::paintGL()
599{
600}
601
602/*!
603 The virtual function is called before each invocation of paintGL().
604
605 When the update mode is set to \c NoPartialUpdate, there is no difference
606 between this function and paintGL(), performing rendering in either of them
607 leads to the same result.
608
609 The difference becomes significant when using \c PartialUpdateBlend, where an
610 extra framebuffer object is used. There, paintGL() targets this additional
611 framebuffer object, which preserves its contents, while paintUnderGL() and
612 paintOverGL() target the default framebuffer, i.e. directly the window
613 surface, the contents of which is lost after each displayed frame.
614
615 \note Avoid relying on this function when the update behavior is
616 \c PartialUpdateBlit. This mode involves blitting the extra framebuffer used by
617 paintGL() onto the default framebuffer after each invocation of paintGL(),
618 thus overwriting all drawing generated in this function.
619
620 \sa paintGL(), paintOverGL(), UpdateBehavior
621 */
622void QOpenGLWindow::paintUnderGL()
623{
624}
625
626/*!
627 This virtual function is called after each invocation of paintGL().
628
629 When the update mode is set to NoPartialUpdate, there is no difference
630 between this function and paintGL(), performing rendering in either of them
631 leads to the same result.
632
633 Like paintUnderGL(), rendering in this function targets the default
634 framebuffer of the window, regardless of the update behavior. It gets called
635 after paintGL() has returned and the blit (PartialUpdateBlit) or quad drawing
636 (PartialUpdateBlend) has been done.
637
638 \sa paintGL(), paintUnderGL(), UpdateBehavior
639 */
640void QOpenGLWindow::paintOverGL()
641{
642}
643
644/*!
645 Paint \a event handler. Calls paintGL().
646
647 \sa paintGL()
648 */
649void QOpenGLWindow::paintEvent(QPaintEvent *event)
650{
651 Q_UNUSED(event);
652 paintGL();
653}
654
655/*!
656 Resize \a event handler. Calls resizeGL().
657
658 \sa resizeGL()
659 */
660void QOpenGLWindow::resizeEvent(QResizeEvent *event)
661{
662 Q_UNUSED(event);
663 Q_D(QOpenGLWindow);
664 d->initialize();
665 resizeGL(width(), height());
666}
667
668/*!
669 \internal
670 */
671int QOpenGLWindow::metric(PaintDeviceMetric metric) const
672{
673 Q_D(const QOpenGLWindow);
674
675 switch (metric) {
676 case PdmDepth:
677 if (d->paintDevice)
678 return d->paintDevice->depth();
679 break;
680 default:
681 break;
682 }
683 return QPaintDeviceWindow::metric(metric);
684}
685
686/*!
687 \internal
688 */
689QPaintDevice *QOpenGLWindow::redirected(QPoint *) const
690{
691 Q_D(const QOpenGLWindow);
692 if (QOpenGLContext::currentContext() == d->context.data())
693 return d->paintDevice.data();
694 return nullptr;
695}
696
697QT_END_NAMESPACE
698
699#include "moc_qopenglwindow.cpp"
QOpenGLWindowPaintDevice(QOpenGLWindow *window)
void ensureActiveTarget() override
This virtual method is provided as a callback to allow re-binding a target frame buffer object or con...
QScopedPointer< QOpenGLFramebufferObject > fbo
QScopedPointer< QOpenGLContext > context
QOpenGLTextureBlitter blitter
QScopedPointer< QOpenGLWindowPaintDevice > paintDevice
void endPaint() override
static QOpenGLWindowPrivate * get(QOpenGLWindow *w)
QScopedPointer< QOffscreenSurface > offscreenSurface
void flush(const QRegion &region) override
QOpenGLContext * shareContext
void beginPaint(const QRegion &region) override
Combined button and popup list for selecting options.
#define GL_DRAW_FRAMEBUFFER
#define GL_READ_FRAMEBUFFER