summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglframebufferobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Cache results of multiple render target supportSean Harmer2016-02-141-2/+3
| | | | | Change-Id: I9e706690d4d2ddaae6c84b0e24de7698704e862d Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Provide optimised version of QOpenGLFramebufferObject::blitFramebufferSean Harmer2016-02-141-3/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiling shows that the call to glGetIntegerv() in this function that queries for the currently bound framebuffer is very expensive. It's the top hit on the CPU when profiling a Qt3D application using a Scene3D Qt Quick 2 item. The reason it is so expensive is that this call forces the OpenGL driver to propagate the OpenGL state through all of the queued commands in order to answer the query. It may also induce a pipeline stall depending upon the driver implementation. As this function gets called on the hot path every frame whenever using a Scene3D item and may also be called in plain Qt Quick when using ShaderEffect items; the layer property of QQuickItem; or when updating the Qt Quick glyph cache texture on Core profile contexts, it is very much worthy of optimization. This commit adds an overload of the blitFramebuffer() call that allows the caller to provide a policy that can either: * keep the existing behavior of restoring the previous framebuffer binding, * restore the default framebuffer, or * don't restore anything and let the caller be responsible for it. This will allow consumers such as Qt Quick and Qt 3D to use the optimised code path. The existing overloads of blitFramebuffer() retain the current behavior by calling with the policy to restore the previous framebuffer binding. Upon making this change, the cost of blitFramebuffer() is massively reduced. A follow up commit will optimize this further. Change-Id: I417abb7da916ae5088f6817e4eff8ea02c8c5803 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* QtGui: eradicate Q_FOREACH loops [needing qAsConst()]Marc Mutz2016-02-111-1/+1
| | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(). Change-Id: I90fd517ad542ef92034403c15ebb8300a56ac693 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* QtGui: eradicate Q_FOREACH loops [already const]Marc Mutz2016-02-111-2/+2
| | | | | | | | | (or trivially marked const) ... by replacing them with C++11 range-for loops. Change-Id: I3cce92b9d77a3ff96fad877d1d989145e530646f Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-211-2/+0
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
| * Avoid checking the fb status in every bindLaszlo Agocs2016-01-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some drivers (e.g. NVIDIA, tested on Windows) the status check is apparently expensive. A simple FBO test app rendering into the FBO on every frame (and thus calling bind()) shows a 19-21% CPU usage. With the patch this gets reduced to 0.8-1%. The check is fairly useless too - whenever creating attachments, the status is checked, so d->valid is up-to-date. Task-number: QTBUG-50496 Change-Id: Ie9f0db34e5c2bc1a1141c734ca0b318419013c0d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.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.5' into 5.6Liang Qi2015-10-021-3/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/tools/qstring.h src/gui/image/qimagereader.cpp src/network/access/qnetworkaccessmanager.cpp src/tools/qdoc/doc/examples/examples.qdoc src/widgets/accessible/qaccessiblewidgetfactory_p.h src/widgets/doc/qtwidgets.qdocconf Change-Id: I8fae62283aebefe24e5ca4b4abd97386560c0fcb
| * Blacklist PowerVR Rogue G6200 (v1.3) from supporting BGRA.Christian Strømme2015-09-181-3/+14
| | | | | | | | | | | | | | | | | | | | The drivers for PowerVR Rogue G6200 reports BGRA support, but reading from the FBO does not produce the correct result. Initially reported here: http://launchpad.net/bugs/1436074 Change-Id: Ia173817d557446818d08609d943eb3573b900cc3 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Fix some qdoc warnings.Friedemann Kleint2015-09-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/io/qdebug.cpp:698: warning: Class QDebugStateSaver has no \inmodule command; using project name by default: QtCore qtbase/src/gui/opengl/qopenglframebufferobject.cpp:1138: warning: Can't link to 'takeTextures()' qtbase/src/gui/opengl/qopenglframebufferobject.cpp:1159: warning: Can't link to 'takeTextures()' qtbase/src/gui/opengl/qopenglframebufferobject.cpp:953: warning: No such parameter 'height' in QOpenGLFramebufferObject::addColorAttachment() qtbase/src/gui/opengl/qopenglframebufferobject.cpp:953: warning: No such parameter 'width' in QOpenGLFramebufferObject::addColorAttachment() qtbase/src/gui/opengl/qopenglframebufferobject.cpp:953: warning: Undocumented parameter 'size' in QOpenGLFramebufferObject::addColorAttachment() qtbase/src/gui/painting/qpaintdevice.qdoc:80: warning: Undocumented enum item 'PdmDevicePixelRatioScaled' in QPaintDevice::PaintDeviceMetric qtbase/src/testlib/qbenchmarkmetric.cpp:154: warning: Invalid use of '\relates' (already a member of 'QTest') qtbase/src/testlib/qbenchmarkmetric.cpp:81: warning: Invalid use of '\relates' (already a member of 'QTest') qtbase/src/widgets/dialogs/qdialog.cpp:152: warning: Can't link to 'QCloseEvent::ignore()' qtbase/src/widgets/dialogs/qdialog.cpp:557: warning: Can't link to 'QApplication::quit()' qtbase/src/widgets/kernel/qwidget.cpp:8326: warning: Can't link to 'QCloseEvent::accept()' qtbase/src/widgets/kernel/qwidget.cpp:8326: warning: Can't link to 'QCloseEvent::ignore()' qtbase/src/widgets/kernel/qwidget.cpp:9300: warning: Can't link to 'QWheelEvent::accept()' qtbase/src/widgets/kernel/qwidget.cpp:9300: warning: Can't link to 'QWheelEvent::ignore()' qtbase/src/widgets/kernel/qwidget.cpp:9321: warning: Can't link to 'QTabletEvent::accept()' qtbase/src/widgets/kernel/qwidget.cpp:9321: warning: Can't link to 'QTabletEvent::ignore()' qtbase/src/widgets/kernel/qwidget.cpp:9373: warning: Can't link to 'QKeyEvent::ignore()' Change-Id: I97ae85398181645c1054c303e5c8a87deb619409 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Support MRT in QOpenGLFramebufferObjectLaszlo Agocs2015-07-291-146/+349
|/ | | | | | | | | | | | Introduce overloads in the API to allow specifying multiple color attachment sizes and formats. When these are in use and MRT is supported, a texture or renderbuffer is created for each of GL_COLOR_ATTACHMENT0, 1, 2, ... [ChangeLog] Added support for multiple render targets in QOpenGLFramebufferObject Task-number: QTBUG-39235 Change-Id: Ie7cfd81d1b796a9166b80dff7513aafe0120d53d Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Use the default fbo in Qt sense in blitFramebufferLaszlo Agocs2015-04-081-2/+4
| | | | | | | | | | | QOpenGLFramebufferObject::blitFramebuffer() passes 0 when no FBO is specified. This goes against the rest of the framework where the default fbo is what QOpenGLContext::defaultFramebufferObject() returns. This becomes significant with QOpenGLWidget and on iOS. Task-number: QTBUG-45328 Change-Id: Iaeb82cd3786ad395116679c9626bdcb10e93b4e3 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* 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.0' into 5.4Simon Hausmann2014-12-051-3/+1
|\ | | | | | | Change-Id: I0cd11cbe95693b78450ea81a0187760f4a6a8b5f
| * QOpenGLFramebufferObject: pass sized format also with dynamic GLAndrew Knight2014-12-011-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The GL_RGBA8_OES define is not in scope for dynamic OpenGL builds, so pass in GL_RGBA8 instead (it is defined as the same value, 0x8058) when in ES mode. The functionality check already ensures the extension is available, so the ifdef guards can be removed. This fixes default multisampled FBO creation under ANGLE when using -opengl dynamic. Task-number: QTBUG-40921 Change-Id: Iac4b7e230a463c27b61af75c3307421f9deac856 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Update fbo toImage() docs regarding premultiplied alphaLaszlo Agocs2014-11-171-3/+17
| | | | | | | | | | | | | | Task-number: QTBUG-42510 Task-number: QTBUG-37261 Change-Id: Ic11bec0a25e66df9d022f640621686be867e84d2 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | Fix for current_fbo getting out of sync in QtOpenGLSamuel Rødal2014-11-111-2/+14
|/ | | | | | | | | | | | | | | When using QGLWidget in combination with QOpenGLFramebufferObject from QtGui, instead of QGLFramebufferObject from QtOpenGL, the current_fbo variable doesn't get updated when framebuffer object bindings change. To ensure that the QGLWidget correctly releases the currently bound framebuffer object when using a QPainter, we keep track of whether QOpenGLFramebufferObject has modified the current FBO binding, and if that's the case we need to read the OpenGL state directly instead of relying on a cached value. Change-Id: If7e0bd936e202cad07365b5ce641ee01d2251930 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Pass a sized format when creating multisampled renderbuffers on ESLaszlo Agocs2014-10-031-10/+8
| | | | | | | Task-number: QTBUG-40921 Change-Id: I96b05442dd5928992dab06553b3d41feca89084d Reviewed-by: BogDan Vatra <bogdan@kde.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Support RGB30 formats in OpenGL framebuffers and paint engineAllan Sandfeld Jensen2014-07-301-3/+32
| | | | | | | | | | | | | | This patch adds support for binding RGB30 images as textures, and as internal format of framebuffer objects. Together with the QOpenGLPaintDevice this provides support for rendering to and from RGB30 in full precision. [ChangeLog][QtGui][QOpenGLFramebufferObject] Support 10-bit per color channels formats as the internal framebuffer format, making it possible to render in that precision. Change-Id: I06de2d12dfe1c1adc466d574fdffbc77f88f4f16 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Improve QOpenGLFramebufferObject::toImage()Allan Sandfeld Jensen2014-07-041-24/+87
| | | | | | | | | | | | | | | This patch makes it possible to use QOpenGLFramebufferObject::toImage() together with QOpenGLPaintDevice::setPaintFlipped where the FBO is already mirrored. The patch also makes checks for proper BGRA support before trying to use it, and fixes the rare case of OpenGLES on big endian. [ChangeLog][QtGui][QOpenGLFramebufferObject] Introduce an argument to QOpenGLFramebufferObject::toImage() to save mirroring the result. Change-Id: I163d802736b7059411f7dda96a31385d772823cc Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-07-011-2/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/qnx-x86-qcc/qplatformdefs.h src/corelib/global/qglobal.h src/network/socket/qnativesocketengine_winrt.cpp src/plugins/platforms/android/androidjniaccessibility.cpp src/plugins/platforms/windows/qwindowswindow.cpp Manually adjusted: mkspecs/qnx-armle-v7-qcc/qplatformdefs.h to include 9ce697f2d54be6d94381c72af28dda79cbc027d4 Thanks goes to Sergio for the qnx mkspecs adjustments. Change-Id: I53b1fd6bc5bc884e5ee2c2b84975f58171a1cb8e
| * Handle invalid sample counts gracefully in FBOsLaszlo Agocs2014-06-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Passing in a sample count of -1 should be treated as 0. This is common when setting up framebuffer formats from a QSurfaceFormat where the default, unset value is indicated by a value of -1. This broke QQuickWidget which was unaware of this limitation of QOpenGLFramebufferObject and was passing format.samples() as the sample count without making sure it is 0 or higher. Task-number: QTBUG-39699 Change-Id: I324b8b006eaa992c15ae932f9df305500fefeb65 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
| * Make multisampling more robust in QOpenGLFramebufferObjectLaszlo Agocs2014-06-061-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Some drivers are reported to get confused when passing different sample counts (requested vs. actual) to the color and depth/stencil attachments. To overcome this, pass the requested sample count to all the attachments. Task-number: QTBUG-33406 Change-Id: I17b0e3dbbd78de2ab0f45e95164b4f326d47aeff Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com> Reviewed-by: Kimmo Leppälä <kimmo.leppala@digia.com>
* | Enhance msaa and blitframebuffer on ES with vendor extensionsLaszlo Agocs2014-06-251-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | The support already in place for ANGLE is now extended for NV. On ES 2.0 the only way to get multisampled renderbuffers and blitframebuffer is through vendor-specific extensions. QOpenGLFunctions is updated to resolve the related functions for both ANGLE and NV, in addition to EXT. Task-number: QTBUG-39187 Change-Id: I1aab805ced3d06dde3dc547221bbf833ff8e06c2 Reviewed-by: Andrew Knight <andrew.knight@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* | Include the ES3 headers on iOSLaszlo Agocs2014-06-251-0/+4
| | | | | | | | | | | | | | | | | | | | The config test correctly recognizes if GLES 3.0 is available, however qopengl.h still includes the ES2 headers. This causes issues for the new GLES3 support patches. Change-Id: Ia97f556cc207f7d828918f493fe1adab93cf31ec Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵J-P Nurmi2014-06-071-1/+10
|\ \ | | | | | | | | | refs/staging/dev
| * | Merge remote-tracking branch 'origin/stable' into devJ-P Nurmi2014-06-051-1/+10
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/qt.prf src/plugins/platforms/xcb/qxcbwindow.h src/tools/qdoc/qdocindexfiles.cpp src/widgets/kernel/qwidget_qpa.cpp Change-Id: I214f57b03bc2ff86cf3b7dfe2966168af93a5a67
| | * QOpenGLFramebufferObject: correct the internal format when using ANGLEAndrew Knight2014-05-261-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As ANGLE doesn't support GL_RGBA as the internal format for its multisampled framebuffer extension, use GL_RGB8_OES to ensure a working out-of-the-box experience. Task-number: QTBUG-39283 Change-Id: Icb364225e74e5d3480a8617131a56e9f65f04ba5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* | | Fix multisampled fbo readbackLaszlo Agocs2014-06-051-11/+37
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that the current fbo is not tracked anymore, toImage() and blitFramebuffer() will not restore the previously bound (or whichever Qt thinks was current before) fbo. toImage() needs to accommodate this since the isBound() check was going wrong now that the blit always makes the fbo non-current. The current fbo is now queried via glGet both in toImage() and blitFramebuffer(). This will fix the recently introduced Lancelot failures with -glbuffer. Change-Id: I43a780beaeac4697d92cb0ebda7d14ca28a3924f Reviewed-by: aavit <eirik.aavitsland@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* / Remove tracking of the current fboLaszlo Agocs2014-06-021-23/+14
|/ | | | | | | | | | | | | | | | | When binding an FBO directly via glBindFramebuffer, the QOpenGLContext's internal current_fbo, that is maintained by QOpenGLFramebufferObject, becomes out of sync. This will lead to QOpenGLFramebufferObjects thinking they are still bound. Such state tracking should be avoided since it is becoming increasingly difficult to keep it consistent between the various OpenGL API wrappers and will never be robust enough when the application changes the state by directly calling OpenGL functions. current_fbo is now removed in QtGui. QtOpenGL is not touched. Change-Id: Id809aab1306c9486d1e2ba3bb5aa93593659e920 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Document returned format of QOpenGLFramebufferObject::toImage()Allan Sandfeld Jensen2014-05-061-0/+3
| | | | | | | | The image format returned by QOpenGLFramebufferObject::toImage() on OpenGL ES/2 builds changed in 5.2.0 but was not documented. Change-Id: I2379c62c7f715803192ffa9bb8ae1171ef4b2314 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Rename new QOpenGLContext APIsLaszlo Agocs2014-04-251-7/+7
| | | | | | | | | | | | | | isES() becomes isOpenGLES(). The library type enums are changed DesktopGL -> LibGL and GLES2 -> LibGLES. This removes the now unnecessary version number, the confusing "desktop" term and provides better readability. The old function/values are kept until the related qtdeclarative changes are integrated. Task-number: QTBUG-38564 Change-Id: Ibb0a1209985f1ce4bb9451f9b7b093c2b68a6505 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Avoid an "OpenGL Error: 1282" output when resizing a QOpenGLWidgetJocelyn Turcotte2014-04-021-0/+2
| | | | | | | | | | | | | When we delete the previous FBO in QOpenGLWidget::resizeEvent while it is the currently bound FBO, the QOpenGLContextPrivate::current_fbo will not be updated and will try to be bound during the initialization of the new FBO. Fix the issue by explicitly releasing the FBO on destruction if it is current. Change-Id: Id049889c4857526750bbecf3dd27343e44449c12 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Avoid using direct OpenGL calls in gui and widgetsLaszlo Agocs2014-03-101-21/+22
| | | | | Change-Id: I5d88a2e204ca23e178a4e3044b9cb13392c3e763 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Dynamic GL: remove exporting symbolsLaszlo Agocs2014-03-041-7/+7
| | | | | | | | | | | | | | | | | | | | | Remove the opengl proxy for now. Later it will either be moved into a separate library or replaced by a QOpenGLFunctions-based approach. This means that the -opengl dynamic configuration is not usable for the time being. The rest of the enablers remain in place. The convenience function QOpenGLFunctions::isES() is now moved to QOpenGLContext and is changed to check the renderable type. This is extremely useful since besides supporting dynamic GL it solves also the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES path when creating an ES-compatible context with a desktop OpenGL implementation). Task-number: QTBUG-36483 Task-number: QTBUG-37172 Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Dynamic GL switch on WindowsLaszlo Agocs2014-02-141-36/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch introduces a new build configuration on Windows which can be requested by passing -opengl dynamic to configure. Platforms other than Windows (including WinRT) are not affected. The existing Angle and desktop configurations are not affected. These continue to function as before and Angle remains the default. In the future, when all modules have added support for the dynamic path, as described below, the default configuration could be changed to be the dynamic one. This would allow providing a single set of binaries in the official builds instead of the current two. When requesting dynamic GL, Angle is built but QT_OPENGL_ES[_2] are never defined. Instead, the code path that has traditionally been desktop GL only becomes the dynamic path that has to do runtime checks. Qt modules and applications are not linked to opengl32.dll or libegl/glesv2.dll in this case. Instead, QtGui exports all necessary egl/egl/gl functions which will, under the hood, forward all requests to a dynamically loaded EGL/WGL/GL implementation. Porting guide (better said, changes needed to prepare your code to work with dynamic GL builds when the fallback to Angle is utilized): 1. In !QT_OPENGL_ES[_2] code branches use QOpenGLFunctions::isES() to differentiate between desktop and ES where needed. Keep in mind that it is the desktop GL header (plus qopenglext.h) that is included, not the GLES one. QtGui's proxy will handle some differences, for example calling glClearDepth will route to glClearDepthf when needed. The built-in eglGetProcAddress is able to retrieve pointers for standard GLES2 functions too so code resolving OpenGL 2 functions will function in any case. 2. QT_CONFIG will contain "opengl" and "dynamicgl" in dynamic builds, but never "angle" or "opengles2". 3. The preprocessor define QT_OPENGL_DYNAMIC is also available in dynamic builds. The usage of this is strongly discouraged and should not be needed anywhere except for QtGui and the platform plugin. 4. Code in need of the library handle can use QOpenGLFunctions::platformGLHandle(). The decision on which library to load is currently based on a simple test that creates a dummy window/context and tries to resolve an OpenGL 2 function. If this fails, it goes for Angle. This seems to work well on Win7 PCs for example that do not have proper graphics drivers providing OpenGL installed but are D3D9 capable using the default drivers. Setting QT_OPENGL to desktop or angle skips the test and forces usage of the given GL. There are also two new application attributes that could be used for the same purpose. If Angle is requested but the libraries are not present, desktop is tried. If desktop is requested, or if angle is requested but nothing works, the EGL/WGL functions will still be callable but will return 0. This conveniently means that eglInitialize() and such will report a failure. Debug messages can be enabled by setting QT_OPENGLPROXY_DEBUG. This will tell which implementation is chosen. The textures example application is ported to OpenGL 2, the GL 1 code path is removed. [ChangeLog][QtGui] Qt builds on Windows can now be configured for dynamic loading of the OpenGL implementation. This can be requested by passing -opengl dynamic to configure. In this mode no modules will link to opengl32.dll or Angle's libegl/libglesv2. Instead, QtGui will dynamically choose between desktop and Angle during the first GL/EGL/WGL call. This allows deploying applications with a single set of Qt libraries with the ability of transparently falling back to Angle in case the opengl32.dll is not suitable, due to missing graphics drivers for example. Task-number: QTBUG-36483 Change-Id: I716fdebbf60b355b7d9ef57d1e069eef366b4ab9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-071-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/plugins/platforms/android/androidjnimain.cpp src/plugins/platforms/android/qandroidplatformintegration.cpp src/plugins/platforms/android/qandroidplatformintegration.h src/plugins/platforms/android/qandroidplatformopenglcontext.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/sql/doc/src/sql-driver.qdoc src/widgets/widgets/qtoolbararealayout.cpp Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
| * Do not query max samples on glesLaszlo Agocs2014-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Querying GL_MAX_SAMPLES is not supported in GLES2. Avoiding the call also makes us play nice with Mesa in debug mode since it gets rid of the warnings about the failing glGetIntegerv call. Change-Id: I05e501cc11af41a54fefc34ab919c5191e4f3f0a Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* | expand tabs and related whitespace fixes in *.{cpp,h,qdoc}Oswald Buddenhagen2014-01-131-2/+2
| | | | | | | | | | | | | | | | the diff -w for this commit is empty. Started-by: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add takeTexture() to QOpenGLFramebufferObjectLaszlo Agocs2014-01-071-41/+95
|/ | | | | | | | | | | | | Add an API that allows to retrieve and detach the texture from the framebuffer object. The next bind() call will then create and attach a new texture. [ChangeLog][QtGui][QOpenGLFramebufferObject] Added takeTexture() for retrieving and detaching the texture from the framebuffer object. Task-number: QTBUG-35881 Change-Id: I2cca37f5872c1685b1238047f8b912e6534ab781 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-14/+14
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Don't try to allocate a msaa FBO when it is not supported.Gunnar Sletta2013-09-201-15/+12
| | | | | | Change-Id: Ib4bdabcfa4e9b76156d7188da82fe2173b4b997e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Support RGBA image formatAllan Sandfeld Jensen2013-07-231-8/+13
| | | | | | | | | Support the byte-ordered RGBA format which is used by OpenGL, and many endian neutral byte formats. Task-number: QTBUG-32201 Change-Id: I77cffb4c30c69545fa96ded2f537b2ebd9351acb Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
* doc: QOpenGLFramebufferObject::bindDefault() was marked internalMartin Smith2013-06-111-1/+0
| | | | | | | | The \internal was removed. Task-number: QTBUG-31645 Change-Id: I98b57ec3816b6d9c49e3488accb65f147aeb15f1 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Fixed error in QGLFramebufferObject and QOpenGLFramebufferObject docs.Samuel Rødal2013-02-151-2/+2
| | | | | | | It's the format class that lets you control the number of samples. Change-Id: Id01f107a15787f33b65429d3c882854f2dc8784e Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Fixed QOpenGLFramebufferObject docs to mention QOpenGLPaintDevice.Samuel Rødal2013-02-141-19/+15
| | | | | | Task-number: QTBUG-29496 Change-Id: Id9ec5e2a070992f53bba58468e2472513d52cb8b Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Simplify and speed up OpenGL framebuffer grabbing.aavit2012-11-091-54/+13
| | | | | | | | If possible, let glReadPixels() itself provide the pixel format that QImage requires, so we can drop the pixel manipulation afterwards. Change-Id: I6c9226003c15d49548fa00696f31d0b2e26c0783 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Remove some dead code in switch statementsSergio Ahumada2012-10-291-1/+0
| | | | | | | | | | Following the Code Style described in http://qt-project.org/wiki/Qt_Coding_Style#e289ee44592e9c32d4212069f0806daf There is no need for a 'break' after a 'return'. Change-Id: I1eca350391a7e4e14e504d60b24b69982cc5ac47 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>