summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qopenglcontext.h
Commit message (Collapse)AuthorAgeFilesLines
* Add qtguiglobal.h and qtguiglobal_p.hLars Knoll2016-07-031-1/+1
| | | | | | | | | | | | | | | | | | | | The new modular configuration system requires one global header per module, that is included by all other files in this module. A similar scheme and naming convention is already being used for many other modules (e.g. printsupport, qml, quick). That header will later on #include the configuration file for Qt Gui. For now it defines the Q_GUI_EXPORT macro for this library. In addition, add a private global header, qtguiglobal_p.h, that can later on include the private config header for Qt Gui for things we don't want to export to the world. Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Refactor initialization/caching code for versioned opengl functionsLars Knoll2016-03-021-3/+1
| | | | | | | Saves around 80k in Qt Gui. Change-Id: I3f7068ae699136d0edf46a49694ade7e1df3c91d Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Use an enum for versioning the opengl function backendsLars Knoll2016-03-021-4/+3
| | | | | | | | Saves some code, is easier to maintain and will allow for some more nice refactoring. Change-Id: Ica7ae8e9d36acbe6586e488bc6aff114336c65bb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Avoid repeated QByteArray creation when resolving opengl functionsLars Knoll2016-03-011-0/+1
| | | | | | | | | | Add an getProcAddress(const char *) overload to QOpenGLContext, and refactor the QPA interface to take a const char *. Like this we can avoid lots of mallocs when resoving GL methods. Change-Id: Ic45b985fbaa0da8d32ba3e3b485351173352ca6f Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-02-181-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also reverts commit 018e670a26ff5a61b949100ae080f5e654e7bee8. The change was introduced in 5.6. After the refactoring, 14960f52, in 5.7 branch and a merge, it is not needed any more. Conflicts: .qmake.conf src/corelib/io/qstandardpaths_mac.mm src/corelib/tools/qsharedpointer_impl.h tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
| * Fix QT_DEPRECATED_SINCE usageJędrzej Nowacki2016-02-021-1/+1
| | | | | | | | | | | | | | | | The deprecation was introduced in 5.6 Change-Id: Ief6b749b40ec75c3c9f904caed8447bfb5ef5439 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> 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>
* Null out QOpenGLContext::screen upon screen disconnectLaszlo Agocs2015-09-221-0/+2
| | | | | | | | | Returning a dangling pointer is no good. Do what QOffscreenSurface does: just null it out. Task-number: QTBUG-42803 Change-Id: I01a6db9ae8974a1c78157ebc67097c8dac3a6b6e Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Expose GLES 3.0 and 3.1 functionsLaszlo Agocs2015-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the approach we already do for some GLES 3.0 functions we can provide a cross-platform, cross-GL-GLES wrapper for ES 3.0 and 3.1 functions too. Applications only have to take extra care about the version requests (context version and version directives in shader code), the rest of their code can stay the same across desktop/mobile/embedded, even when ES 3 functions are used. The new functions are placed to a new subclass which is placed between QOpenGLFunctions and the internal QOpenGLExtensions. This is necessary because, unlike with QOpenGLFunctions, there is no guarantee that these functions are always available in all configurations. When running on desktop OpenGL, we resolve as usual. If the OpenGL version contains the function in question, either in core or as an extension, it will all just work. This is handy because it does not rely on 4.x extensions like GL_ARB_ESx_compatibility, and so ES 3.0 functions will be functional on OpenGL 3.x systems too by just setting a 3.x version number in the QSurfaceFormat. We will no longer qFatal on broken systems where the driver returns a 3.0 or 3.1 context without the corresponding functions present. Instead, we show a warning and gracefully fall back to resolving as usual, via eglGetProcAddress or similar. For functions that are available in ES2 as an extension this may just work fine. Added also an example that runs identically both with OpenGL and OpenGL ES 3 and utilizes some ES 3.0 features like instanced drawing. [ChangeLog] Added QOpenGLExtraFunctions providing OpenGL ES 3.0 and 3.1 function wrappers in a cross-platform manner. Task-number: QTBUG-46161 Change-Id: I9f929eb61946c35c415b178c4d6ab2c1c958684e Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* QtGui: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-191-1/+1
| | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Task-number: QTBUG-45291 Change-Id: I72ab40b21a9499b53a639564fa45884de17b6c98 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace <qhash.h> with <qhashfunctions.h> where applicableMarc Mutz2015-04-201-0/+3
| | | | | | | | To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5) in public headers. Change-Id: Ic3398f4f330e15a3b55065858add26b90fd70e6c Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Make versioned OpenGL functions working with the subclass patternLaszlo Agocs2015-03-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QOpenGLFunctions allows both deriving from it and getting an instance via QOpenGLContext::functions(). Unsurprisingly a large number of users attempt to use the versioned function wrappers in the same way. Unfortunately this approach was not that well supported. Besides some potential base class exporting issues the real blocker for QOpenGLWidget - or any versionfunction subclass whose associated context changes during its lifetime - is that the functions instances could only be initialized once. Unlike instances retrieved via QOpenGLContext::versionFunctions(), instances created "manually" were not deinitialized upon the destruction of the associated context because context did not know about them. A pattern like initializeOpenGLFunctions(); delete context; create new context and make it current initializeOpenGLFunctions(); is working fine in QOpenGLFunctions-derived classes but not with the versioned ones. To overcome this, start registering such instances to the context too. QOpenGLContext::destroy() can then reset the internal state so a subsequent initializeOpenGLFunctions() will reinitialize properly instead of bailing out mistakenly thinking that everything is ready to use. Task-number: QTBUG-45199 Change-Id: Ia1420bcccb33c51508698b7a1b036c7544a66e74 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QOpenGLContext: expose the shared global contextGiuseppe D'Angelo2015-02-121-0/+1
| | | | | | | | | | | | We're documenting that this context exists, therefore applications are allowed to assume that it exists. For the same reason, we should expose it as public API -- an application should be allowed to upload GL objects before creating or showing QOpenGLWidgets that use them. Change-Id: Iedbba7cd393018d93833fd2a6b02cce0639a89b4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@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>
* Expose the ThreadedOpenGL cap to appsLaszlo Agocs2015-02-021-0/+2
| | | | | | | | | | | Applications have no public API to check for the ThreadedOpenGL flag reported by the platform plugins. Add a static function to QOpenGLContext to give interested applications a way to decide if they should do rendering on separate threads. Task-number: QTBUG-44208 Change-Id: I629332512ab31fe49f842065a911270cd6cea7aa Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* 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>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-131-7/+1
|\ | | | | | | | | | | | | Manually changed enum to LibGL in src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: If34ee6cce3d1d51fb4bb1fdfa59c30389ea0d207
| * Remove old symbols from QOpenGLContextLaszlo Agocs2014-04-261-7/+1
| | | | | | | | | | | | Task-number: QTBUG-38564 Change-Id: I39a0482e4411cdc644ed34813626c39dacb5b6af Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-061-3/+9
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/qnx-x86-qcc/qplatformdefs.h src/corelib/global/qglobal.h src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl.cpp src/opengl/qglpixelbuffer.cpp src/opengl/qglshaderprogram.cpp tests/auto/opengl/qglthreads/tst_qglthreads.cpp Change-Id: Iaba137884d3526a139000ca26fee02bb27b5cdb5
| * Rename new QOpenGLContext APIsLaszlo Agocs2014-04-251-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add public and QPA APIs for adapting existing OpenGL contextsLaszlo Agocs2014-04-241-1/+4
|/ | | | | | | | | | | | | For now only xcb on GLX is supported. Other platforms will follow later. Add also some missing documentation for the platform OpenGL context factory functions. [ChangeLog] QOpenGLContext is now able to adopt existing native contexts. Task-number: QTBUG-37552 Change-Id: I5dd959f102df178f646b2df5989203b5dc6de376 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* purge vestiges of opengl es 1 supportOswald Buddenhagen2014-04-041-2/+1
| | | | | | | | amends 0d5170256c1. Change-Id: Ifa178d38f602bb7c66ef13334673ff47e332af5b Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Dynamic GL: remove exporting symbolsLaszlo Agocs2014-03-041-0/+12
| | | | | | | | | | | | | | | | | | | | | 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>
* Enable QOpenGLTexture for OpenGL ES 2Jorgen Lind2013-11-141-2/+0
| | | | | Change-Id: I3ec2b7af303070c92e86c0f5ca729eb1a1731682 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Long live QOpenGLTexture!Sean Harmer2013-09-221-0/+9
| | | | | | | Task-number: QTBUG-33274 Change-Id: I9259d947d11f8ba330a2cd7f5620d8f1af0a804b Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Add default value for qHash's 'seed' argument for QOpenGLVersionProfile/StatusTor Arne Vestbø2013-04-151-1/+1
| | | | | | | | | | | | | | | | Although template<typename T> inline uint qHash(const T &t, uint seed) from qhash.h is never instantiated because we have the two-argument version of qHash() for both QOpenGLVersionProfile and QOpenGLVersionStatus, we need the default argument, as the template in qhash.h uses noexcept, which is evaluated regardless of instantiation, and uses qHash(t) without a seed. This behavior seems to not be the case with Apple clang 4.2, but has been observed with Apple clang 4.1, Clang 3.2, and GCC 4.8. Change-Id: If70e93f64eb9675a7c3ef7897ced2c6aebbec2d6 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Make sure that we #include qconfig.h before testing for features.Thiago Macieira2013-03-191-0/+2
| | | | | | | | | | | This is mandatory in public headers (qiodevice.h, qopengl*, etc.), but it's a good idea even in private headers, in case someone includes that header first somewhere. In particular, all platformsupport API is private. Change-Id: If287baa5d9ed14e93c1666efa0e6332c4c1cd9a4 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* OpenGL: Add a set of version and context specific OpenGL classesSean Harmer2013-02-261-0/+63
| | | | | | | | | | | | | | | | | | This commit adds part of the output of utils/glgen and some simple modifications to QOpenGLContext to allow easy access to classes containing functions specific to a given OpenGL context and version. This allows compile-time detection of mis-use of OpenGL features. For example, trying to use glBegin(GL_TRIANGLES) with an OpenGL 3.2 Core Profile context will be detected by the compiler rather than at runtime. These capabilities make it much easier to add functionality to Qt and applications that relies upon core features of OpenGL from specific versions e.g. geometry shaders. Change-Id: Ieb584a489792595f831bc77dee84935c03bb5a64 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.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>
* Added QGLPixelBuffer implementation using framebuffer objects.Samuel Rødal2012-09-271-0/+1
| | | | | | | | | | | Instead of having QGLPixelBuffer be a unusable stub implementation we deprecate it and implement it in terms of QOpenGLFramebufferObject. Framebuffer objects are anyway the recommended replacement for pixelbuffers in modern OpenGL, as the context switching overhead is avoided. Change-Id: Ia220c358ee92813e87981d297c51d84525010322 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* OpenGL: Allow querying OpenGL extensions via the QOpenGLContextSean Harmer2012-08-091-0/+3
| | | | | Change-Id: Ia88470554bbfd2a56738dadfcafafe42a990382d Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| * Fixed build issue when using GLEW with MSVCAndy Nichols2012-04-101-0/+2
| | | | | | | | | | | | | | | | | | MSVC does not support the #warning precompiler command and is considered an error when used. This change checks for GCC before issuing the warning. Change-Id: Iee1e27841fe77b0289e88b7b4ccaa176ab56a39d Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* | api: fix constness of QOpenGLContext::getProcAddressGirish Ramakrishnan2012-04-161-1/+1
| | | | | | | | | | | | | | Should be const just like Qt4's QGLContext::getProcAddress. Change-Id: I273467d5cf852cd49f48cec3f335c4ddac795363 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* | QtGui: make some constructors explicitMarc Mutz2012-03-141-1/+1
|/ | | | | | | | | This is a semi-automatic search, so I'm reasonably sure that all the exported ones have been caught. Change-Id: I5b122db2498dbb2aee50c7ad95c67e708aade45b Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Introduced QOpenGLContext::defaultFramebufferObject().Samuel Rødal2012-01-271-1/+9
| | | | | | | | Also add some debugging helpers to make sure applications are correctly written even on less restrictive platforms. Change-Id: Ie92e497c32e07b2b83662f7ab5540d8f37777fd0 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make it possible to compile with -no-opengl.Andreas Holzammer2012-01-241-0/+4
| | | | | | | | | | | | | This takes out the dependency to the header files of OpenGl. The ifdef QT_NO_OPENGL in the opengl headers are needed, as qmake adds depends in the makefiles for all GUI headers. Task-number: QTBUG-23207 Change-Id: If31448ee35fd8c39194c7cb7d62273fbc6def883 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Use QFunctionPointer in QOpenGLContext as well.Samuel Rødal2012-01-161-1/+1
| | | | | Change-Id: I7192e6aea721c75257bfbd1d205d5ce7764d915f Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Introduced QOpenGLContext::aboutToBeDestroyed() signal.Samuel Rødal2012-01-051-0/+3
| | | | | | | | | This signal can be used to clean up OpenGL resources in a safe way before the context is destroyed. Task-number: QTBUG-20083 Change-Id: I45a4be01b06af4ee7196fa502116f099d50afeab Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Build on Windows/clean build on Linux.Friedemann Kleint2011-08-291-1/+1
| | | | | | | Change-Id: I26552e85a8e8c63002db93b7d9b645981620f0af Reviewed-on: http://codereview.qt.nokia.com/3738 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Added qopengl auto-test.Samuel Rødal2011-08-291-0/+1
| | | | | | | | | For testing the gui/opengl functionality. Change-Id: Ied0e977ad537c0be301bb08091adaf9cf779306b Reviewed-on: http://codereview.qt.nokia.com/3729 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Copy core GL functionality to QtGui with QGL -> QOpenGL naming.Samuel Rødal2011-08-291-0/+145
Change-Id: Ibc989afa4a30dd184d41d1a1cd89f97196e48855 Reviewed-on: http://codereview.qt.nokia.com/3710 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>