summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qopenglwidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-1/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| * Avoid missing paints when resizing GV with QOpenGLWidget viewportLaszlo Agocs2016-05-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is nothing guaranteeing there will be a paint request after resizeViewportFramebuffer() is called. However we must not be left with a framebuffer with uninitialized content. So trigger an update. Include also a half-hearted autotest. QOpenGLWidget (or QGLWidget) viewports have not been autotested at all. Try to verify that it is functional at least, even if we cannot check the actual output. Change-Id: I34d78fe32e94c39dad919216b5a4f4bb2aea3cc2 Task-number: QTBUG-52419 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-0/+2
|\| | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * QtWidgets: includemocsMarc Mutz2016-03-181-0/+2
| | | | | | | | | | | | | | | | A very simple way to save ~3KiB in test size and 440b in data size on GCC 5.3 Linux AMD64 release builds. Change-Id: I6619148cc497116b9772a00e1bc30d573a2b2534 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2015-11-271-2/+1
|\| | | | | | | Change-Id: Ib43c6f126998eefcfed9a7c1f2bcbac8b4dd05ec
| * Send a paint after resize correctly from QOpenGLWidgetLaszlo Agocs2015-11-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to recreating the underlying framebuffer we absolutely need a re-render. However, going directly through paintGL() is wrong since application code may override paintEvent() instead. Such code would then miss these repaint requests. To overcome this, simply rely on paint events, like the normal code path does. Task-number: QTBUG-49466 Change-Id: I6ddb9eb53bedb1655a9714b9b77faa1c439766a2 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* | QtWidgets: use Q_UNLIKELY for every qWarning() (2)Marc Mutz2015-11-251-7/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qWarning(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. This change contains the changes to the accessible/, effects/, kernel/, styles/ and itemviews/ subdirs. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In QWidgetPrivate::setWindowModified_helper(), as a drive-by, I swapped the evaluation order of an &&-expression (newly wrapped in Q_UNLIKELY) to be more readable and more efficient (cheaper check first) at the same time. In qDraw* (qdrawutil.cpp), simplified boolean expressions (sometimes by skipping re-checking conditions already checked in a previous guard clause). Change-Id: I58be22be0a33522c2629a66c2f6c795771a99f3f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Support mixing native child widgets with texture-based onesLaszlo Agocs2015-11-191-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently QOpenGLWidget and QQuickWidget do not support having native child widgets inside the same top-level window. In some cases this is inevitable, f.ex. multimedia may require native windows when used from widget apps. winId() calls made for various (valid or invalid) reasons are also problematic. There are no blockers for supporting this setup, however. By storing multiple texture lists (one for each subtree where the root is a native widget), adding the missing markDirtyOnScreen calls, letting each native widget access the correct texture list (i.e. the one corresponding to its children) when they are (separately) flushed, and fixing composeAndFlush() to take the update region and the (native child) offset into account, it can all be made functional. The change also fixes the issue of keeping GL-based compositing enabled even after all render-to-texture widgets in the window become hidden. Due to the changes of how such widgets are gathered, composeAndFlush() is not invoked anymore when no such widgets are discovered for a given native parent. This is great since having compositing enabled infinitely is an issue for applications like Qt Creator that implement certain views with QQuickWidgets but cannot afford the cost of texture uploads in other places (e.g. for the text editor) on slower machines. The openglwidget manual test is greatly enhanced to test various situations (MDI, scroll areas, tab widgets, QOpenGLWidget as native child, QOpenGLWidget with non-tlw native parent, etc.) Task-number: QTBUG-48130 Task-number: QTBUG-49172 Change-Id: Iad098359c8bcf749f01c050da0853415e1550eda Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* QtWidgets: use printf-style qWarning/qDebug where possible (I)Marc Mutz2015-10-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); Change-Id: I1f6869b024103c98262f1deae014e0d7337a541c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QOpenGLWidget: Fix grabbing multisample framebuffersLaszlo Agocs2015-10-141-2/+13
| | | | | | | Task-number: QTBUG-48450 Change-Id: I0a680e0d682c7c08c3aea40d922bbf2ad66c1de0 Reviewed-by: Joni Poikelin <joni.poikelin@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* QOpenGLWidget: Do not recurse when calling grabFramebuffer() from paintGL()Laszlo Agocs2015-10-141-2/+8
| | | | | | Task-number: QTBUG-48450 Change-Id: I14b1ff40727f705d8b89371b4d3bb5d6adc139fe Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Fix up QOpenGLWidget transparency supportLaszlo Agocs2015-09-241-9/+13
| | | | | | | | | | | | | | | The glColorMask call was troublesome. In addition, the Qt::WA_TranslucentBackground was misinterpreted and recommended misleadingly in the documentation. The hellogl2 example's --transparent argument was disfunctional in practice. Replace glColorMask with glBlendFuncSeparate. The hellogl2 example and the docs are now corrected wrt enabling semi-transparency in a QOpenGLWidget that is not a top-level (which is the most common case). Task-number: QTBUG-47276 Change-Id: I6f40e732d455f5efcf158649ac9a52ff9f240e85 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Avoid multisampled contexts in QOpenGLWidgetLaszlo Agocs2015-08-051-2/+11
| | | | | | | | | | | | | | as it is not needed at all. Multisampled FBOs do not need multisampled configs. What's more, this fixes crashing Mesa with Intel and EGL, where creating a pbuffer for a config with multisampling simply crashes. (and due to other issues we disable surfaceless QOffscreenSurface for Intel so the pbuffer cannot be avoided) Task-number: QTBUG-47509 Change-Id: I3ae3fae8513a6dc64ca4ab11c61d4777c6c09cec Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Enable non-integer device pixel ratioMorten Johan Sørvig2015-07-301-11/+17
| | | | | | | | | | | | | | | | | | | | Work around QPaintDevice::metric's int return type by adding a new metric that returns a scaled devicePixelRatio. Choose a scale factor that gives us more than enough range. The QPaintDevice::devicePixelRatio() convenience accessor is public API and can unfortunately not be changed to return a qreal. Add devicePixelRatioF() which returns the (unscaled) devicePixelRatio. Change all call sites of QPaintDevice::devicePixelRatio() to use QPainDevice::devicePixelRatioF(). Task-number: QTBUG-46615 Change-Id: I97ec4000fe379b7ff5e1624a871ae2512790aad9 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix incorrect warning message in QOpenGLWidgetLaszlo Agocs2015-06-221-1/+1
| | | | | Change-Id: I3b99894171a3e63b75a14357a1be0c0dd1f45e93 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Emphasize the need for calling setDefaultFormat early on OS XLaszlo Agocs2015-05-291-0/+6
| | | | | | Task-number: QTBUG-46067 Change-Id: I0fe6e7ba309306a8fc471424b30eed4491bd39e7 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Create contexts and pbuffers with the correct screen in QOpenGLWidgetLaszlo Agocs2015-05-121-0/+2
| | | | | | | | It won't be functional otherwise with GLX when the QOpenGLWidget is targeting a separate X screen. Change-Id: Ibe5b89023f833039bb67d94b78b173de2e021ac9 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix incorrect FBO bindings with QOpenGLWidgetLaszlo Agocs2015-03-301-1/+9
| | | | | | | | | | | | | | QOpenGLContext::defaultFramebufferObject() knows nothing about QOpenGLWidget and QQuickWidget. The problem is that this function (and others that rely on it) is expected to give the widget's backing FBO in paintGL() and friends. To overcome this, we have to provide a way for such widgets that indicate what is the expected "default fbo". Task-number: QTBUG-43269 Change-Id: I43f439f8609382b9f7004707ab0ef9f091952b4f Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Add a section about QOpenGLWidget alternativesLaszlo Agocs2015-03-251-0/+17
| | | | | | | | | QOpenGLWindow with createWindowContainer() can be an option for desktop-only apps in some special cases. Document this. Task-number: QTBUG-45192 Change-Id: I7c59b7d04d6c0fe58ffe93ac72b204103bef2f4c Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Use glFinish() in QOpenGLWidget unless glFlush() is known to be enoughLaszlo Agocs2015-03-231-3/+3
| | | | | | | | | | | | | | | | | | | | The driver used on the Odroid-XU3 does not like doing just glFlush() before accessing the texture in another context. There is no guarantee that glFlush() is enough to sync access to resources between contexts, so start using glFinish() as the default, except on common desktop hw + iOS where flush is enough and presumably more efficient. To unify the code pathes, remove the separate flushes and do it only once, before the backingstore compositor indicates that it is about to access the textures. This should improve performance a bit, esp. when doing multisampling since we flush only once then. A helper function is added to the internal QOpenGLExtensions because it is highly likely that QQuickWidget will need the same. Task-number: QTBUG-45106 Change-Id: Ifb405c5723f29f2f6c04df8e15fb70280681755e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add missing flush for multisampled QOpenGLWidgetLaszlo Agocs2015-03-091-0/+1
| | | | | | | | QOpenGLWidget exhibits the same issue as QQuickWidget in the linked bug. Task-number: QTBUG-39917 Change-Id: Ib231fb88f73c6ef68f12cc3fecf462679e8184a7 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-02-101-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro src/gui/image/qimage_conversions.cpp src/gui/opengl/qopenglextensions_p.h src/gui/text/qtextengine.cpp src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/eglfs/qeglfshooks_stub.cpp src/plugins/platforms/eglfs/qeglfsscreen.cpp src/plugins/platforms/eglfs/qeglfswindow.cpp src/plugins/platforms/windows/qwindowsfontdatabase.cpp src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp src/plugins/platforms/windows/qwindowsnativeinterface.cpp src/plugins/platforms/windows/qwindowsscreen.cpp src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/windows/qwindowswindow.h src/plugins/platforms/xcb/qxcbdrag.h src/widgets/itemviews/qabstractitemview.cpp src/widgets/kernel/qwidget.cpp src/widgets/util/qsystemtrayicon_p.h tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp conflicts. Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
| * Set dpr of QImage in QOpenGLWidget grabFramebufferDyami Caliri2015-02-031-0/+1
| | | | | | | | | | | | | | | | The QImage returned from grabFramebuffer should have the dpr of the source. Change-Id: Iafeabc1ab4e032fc28b73307104917ba3e898ad5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | QOpenGLWidget/Window: improve docs for the dtorGiuseppe D'Angelo2015-02-071-1/+3
| | | | | | | | | | | | | | Remove a typo and add the standard sentence about a dtor. Change-Id: Ie21ad6d2e83977705ea43fdc872d08f496a32376 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Avoid warning in makeCurrentLaszlo Agocs2015-01-281-3/+1
| | | | | | | | | | | | | | | | This warning is not necessary. We don't warn in doneCurrent or QOpenGLWindow either. Task-number: QTBUG-44094 Change-Id: Icb3cf51137258c939d5dfb653cf98ded3c147aac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | QOpenGLWidget/QOpenGLWindow: add a destructor which calls makeCurrentGiuseppe D'Angelo2015-01-241-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generally speaking, QOpenGLWindow subclasses are going to use some various QOpenGL* wrapper object to handle their buffers, FBOs, etc. Some of those QOpenGL* wrappers are QObjects, hence it should be safe to have them as child objects, and expect Qt to clean them up properly; but that doesn't happen because of how the destruction will work. In particular, when the subclass object is deleted, there may not be the right OpenGL context set as current. The deletion will go up to ~QObject, where the child objects will be deleted, resulting in a crash. That will *also* happen if someone connected to the context's aboutToBeDestroyed() signal: the context will in fact be deleted after the child objects, since it's stored in QOpenGLWindowPrivate, whose dtor will be run after ~QObject (!). Now, in the general case, QOpenGLWindow subclasses should always have a dtor in which they call makeCurrent() (also because various QOpenGL* class are not QObjects, hence they're kept around as full members instead of pointers-to); but at the same time we should clean up properly the QObject children. All of the above of course stands for QOpenGLWidget as well. Task-number: QTBUG-44094 Change-Id: I2379041fe175416936f6d40292039f773a515b35 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Fix discard framebuffer support in QOpenGLWidgetLaszlo Agocs2014-12-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | The enum values are different for the default framebuffer and non-default ones. With QOpenGLWidget there is always a non-default fb bound, so the correct way is to use GL_COLOR_ATTACHMENT0 etc. GL_COLOR_EXT and friends are only allowed when the default framebuffer is bound, as per spec. Change-Id: Ia8c27038dc899e44d1a95eb88adbc1cac72652b0 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* | Add NoPartialUpdate support to QOpenGLWidgetJørgen Lind2014-12-111-5/+93
|/ | | | | | | | | | [ChangeLog][QtWidgets][QOpenGLWidget] Added an UpdateBehavior flag to QOpenGLWidget and enabled support for NoParitalUpdate for QOpenGLWidget. NoPartialUpdate is the default update behavior for QOpenGLWidget. Task-number: QTBUG-40717 Change-Id: I47d11460e4ef899a24cfd4964ddcac57bc3f91ff Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4.0' into 5.4Frederik Gladhorn2014-11-211-1/+1
|\ | | | | | | Change-Id: I95f235a66ce2e9b1fa435c0f911c6f7e811755f0
| * Correct the signature and access rights for the protected constructorLars Knoll2014-11-191-1/+1
| | | | | | | | | | Change-Id: Ic43398a82777f3b1a95a36f60ebc4338d60c29ec Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Fix broken resource cleanup in QOpenGLWidgetLaszlo Agocs2014-11-171-0/+10
|/ | | | | | | | | | | | | | | The context has to be made current. Otherwise we may fail to clean up or, what's worse, we may delete FBOs and textures in some random context. The latter was visible with ANGLE in the qopenglwidget example. When having two QOpenGLWidget instances, the context for the second happened to be the current one when destroying the first. This is now avoided by making sure the correct context is current when deleting the FBOs. Task-number: QTBUG-42696 Change-Id: I8c1eed7c13a869968cc67141e585d02c6bc6f279 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Avoid breaking BC with new virtuals in QOpenGLPaintDeviceLaszlo Agocs2014-10-161-11/+22
| | | | | | Task-number: QTBUG-41046 Change-Id: Iab628d2d6811d528e2cc513b6f8a74baa628541d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix QOpenGLWidget on Cocoa when used as viewportLaszlo Agocs2014-10-141-4/+66
| | | | | | | | | | | | | | | | | | | | | | | Having a QOpenGLWidget as a graphics view viewport was not functioning on OS X: it was showing incomplete content due to accessing the texture attached to the framebuffer object before the rendering is complete. On the normal path, when rendering is done via paintGL(), the flush was there. When used as a viewport however, this path is not used. The missing flush is now added for the other case too. For performance reasons, we will not flush on every paint engine end(). Instead, the flush is deferred until composition starts. QGLWidget also featured a weird on-by-default autoFillBackground concept. To maintain compatibility with apps that used QGLWidget as the viewport for QGraphicsView, we will now do the same for QOpenGLWidget, but only when it is used as a viewport. For regular QOpenGLWidgets autoFillBackground defaults to false, like for any other widget. The docs are extended with a small section about differences between QGLWidget and QOpenGLWidget. Task-number: QTBUG-41046 Change-Id: I42c2033fdd2ef5815783fd640fe11373761061e0 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Add a warning when using QOpenGLWidget as a native childLaszlo Agocs2014-10-101-0/+6
| | | | | | | | | Just like it is done for QQuickWidget. Task-number: QTBUG-41779 Change-Id: I1b27c2ed34ecb2520edf82843b675dbf6b0eab8e Reviewed-by: Michael Bruning <michael.bruning@digia.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Doc: Use title case in section1 titlesNico Vertriest2014-09-301-4/+4
| | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QOpenGLWidget: Play nice with empty paintGLLaszlo Agocs2014-09-181-0/+1
| | | | | | | | | | | Applications that do not override paintGL() (may happen in some test code) will not perform any GL rendering, not even clearing. This is fine, but to be safe we need to do a clear right after creating the FBO in order to prevent showing garbage. Task-number: QTBUG-38327 Change-Id: If062901bb18724f961e41856085470e37b49abbe Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Add a note about winId() to QOpenGLWidget docsLaszlo Agocs2014-09-181-0/+3
| | | | | | Task-number: QTBUG-40765 Change-Id: I0dbb010bb96c6b41c67392b8846782a354481e5e Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Propagate swap interval from QOpenGLWidget to the tlwLaszlo Agocs2014-09-181-1/+15
| | | | | | | | | | | Otherwise it is impossible to set a swap interval different than the one set by QSurfaceFormat::setDefaultFormat(). Both windows and xcb will pick up the updated interval from the window on the next frame. Change-Id: I55a59f83a62d3adcea687adf28639646b576ed58 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Do not drop the context when sharing globallyLaszlo Agocs2014-09-151-0/+6
| | | | | | | | | There is no point in recreating the QOpenGLWidget's context when it shares with all top-levels' shareContext(). Change-Id: I659a8ef6563de0cc1e833198af4dfb8c705e40d8 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Update QOpenGLWidget paintDevice devicePixelRatio when recreating fboDyami Caliri2014-09-101-0/+1
| | | | | | | | The QOpenGLWidget's paintDevice needs to update devicePixelRatio when changing screens. Change-Id: Iec6e7157f22ff99e04f81347cbbf70f3fc3ff424 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Expose screen change event to widgets so that they can check the dprLaszlo Agocs2014-09-101-0/+4
| | | | | | | | | | Unlike ordinary widgets, the ones that have OpenGL framebuffers must know about screen changes because the device pixel ratio may be different on the new screen. Add an internal event, ScreenChangeInternal, as the counterpart to WindowChangeInternal. Change-Id: I5e55999838e4c0284e7d9832299f7cc6b541ee3f Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Add an option to share between TLWsLaszlo Agocs2014-09-101-6/+19
| | | | | | Task-number: QTBUG-41191 Change-Id: I510d1631926ed0d9e371703d22229aed92432aa6 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix garbled resize with QOpenGLWidget when using multi-sampling.Dyami Caliri2014-09-101-0/+1
| | | | | | | | If you configure QOpenGLWidget to use sampling, the 'resolvedFbo' isn't updated during resizing. This leads to garbled views. Change-Id: I9f9265520134bcf12436778773507df936c5fbb6 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Improve QOpenGLWidget docs regarding fb preservationLaszlo Agocs2014-09-081-1/+17
| | | | | | | | QOpenGLWindow already has some notes regarding this. It must be mentioned in QOpenGLWidget too. Change-Id: I0af90c9410a1c44cb9dd9ce58aa0371a58c57f65 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Fix composition for windows with alphaLaszlo Agocs2014-08-131-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | While we will cover the entire surface with our textured quads, the clear is still necessary in order to make top-levels with TranslucentBackground render correctly: We don't want to blend transparent areas with undefined content that is in the surface's framebuffer. Blending is problematic for alpha values. We now prevent the blended alpha from being written out. This ensures that in examples like qquickviewcomparison, where the backingstore image contains an alpha of 0.5 while the QQuickWidget texture 1.0, the result is still an alpha value of 1.0 in the final image. Writing out an alpha of 0.5 would break on systems where windows get an alpha buffer by default. hellogl2 can now take a --transparent parameter which makes the QOpenGLWidget being cleared to transparent in order to verify it works in combination with Qt::WA_TranslucentBackground. The swapped red and blue problem is also corrected. RGBA8888 does not need swizzling. The only format that needs this is RGB32. Task-number: QTBUG-40716 Change-Id: I54a9fd3a91a1b59575b38cdb908835315514e40f Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix msaa in QOpenGLWidgetLaszlo Agocs2014-08-111-6/+27
| | | | | | | | | | | | | | Take the correct number of samples from the widget's context, not the tlw's context. The original implementation did the blit only after paintGL(). This is not sufficient for applications that override paintEvent() and do QPainter calls in there (e.g. the 2dpainting example). Therefore the approach is changed to perform the resolving of the samples in a function that is invoked by QWidgetPrivate every time a paint event is sent. Change-Id: Iae0b2c30f6070ec75201339a848854e4582a9c0c Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Fix crash in QOpenGLWidget when changing the TLWLaszlo Agocs2014-08-081-1/+19
| | | | | | | | The documentation was also somewhat incomplete when it comes to widgets that change their tlw multiple times. Change-Id: I09dd70167804c50a5283ab3709162c93a3827e9b Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>