summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Mark the remaining QGL classes as obsoleteLaszlo Agocs2014-09-101-0/+3
| | | | | | | Many of them are already marked. Do it for the rest (QGLWidget et al). Change-Id: I506d72ad20f8ef39981dbeee0df49229bcf748a7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-08-121-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | Manually included changes from 3a347a4e70e5a10ee92dd2578316c926a399e894 in src/opengl/qgl.cpp. Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/android/androidjnimain.cpp Change-Id: Ic26b58ee587d4884c9d0fba45c5a94b5a45ee929
* | Modernize the OpenGL examplesLaszlo Agocs2014-08-121-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change them to use QOpenGLWidget and QOpenGLTexture. Advocate also the usage of VBOs. Hopeless examples, that rely on the fixed pipeline and will not compile or work in ES and dynamic builds, are moved to a "legacy" directory. The documentation pages for these are removed. This long due change avoids the confusion newcomers experience when trying to get started with Qt 5 and OpenGL. hellowindow's behavior is changed to open a single window only by default. The old default behavior, that opened three windows on platforms that supported both MultipleWindows & ThreadedOpenGL, can be requested by passing --multiple. --single is removed since it is the default now. This plays much nicer with drivers that have issues with threading. In addition, say hello to hellogl2. This is the old hellogl example updated to use QOpenGLWidget and OpenGL 2. It also has a mainwindow with multiple (un)dockable widgets containing the OpenGL widgets. This helps testing the behavior when the top-level of the QOpenGLWidget changes and provides a very important example of how to do proper resource management in this case. (must use aboutToBeDestroyed() of the context, since the context goes away and is replaced by a new one on every dock/undock) As a bonus, the logo is now real 3D, no more orthographic nonsense. Launch with --multisample to request 4x MSAA. Launch with --coreprofile to request 3.2 Core. In this particular example the shaders are present in both versions and there is a VAO so the application is functional with core profile contexts. Change-Id: Id780a80cb0708ef164cc172450ed74050f065596 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* | Merge remote-tracking branch 'origin/5.3' into devFrederik Gladhorn2014-08-041-0/+2
|\| | | | | | | | | | | | | | | | | Conflicts: config.tests/arch/arch.cpp src/opengl/qgl_qpa.cpp src/widgets/kernel/qapplication.cpp Change-Id: I80b442a4c2c9632743a5b5c7319ff201ec5bc4fd
* | Make QOpenGLWidget publicLaszlo Agocs2014-08-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QOpenGLWidget is now public. In addition Qt::WA_AlwaysStackOnTop is introduced to support the special case of semi-transparent QOpenGLWidget or QQuickWidget on top of regular widgets. hellogl_es2 becomes the qopenglwidget example. This example performs painting both via QPainter and native GL commands and has the OpenGL widget combined with other, normal widgets. The widget stack receives some changes when it comes to renderToTexture widgets like QQuickWidget and QOpenGLWidget. Calling update() will now result in a paint event, which is essential for QOpenGLWidget since we want it to behave like a regular widget. The dirty region handling is extended specially for such widgets due to performance reasons. (an OpenGL content update must not result in any backingstore painting, and is thus handled as a different kind of dirtiness) [ChangeLog] Added QOpenGLWidget. This widget serves as a replacement for QGLWidget. Task-number: QTBUG-36899 Task-number: QTBUG-40086 Change-Id: Ibf7f82fea99b39edfffd2fc088e7e0eadbca25cf Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Unduplicate the implementations of next power of twoAllan Sandfeld Jensen2014-06-261-16/+2
| | | | | | | | | | | | | | | | | | | | | | Qtbase contains four identical implementations of next power of two, these should be shared and the implementation made available to other qt modules, as it is also used many places outside of qtbase. [ChangeLog][QtCore][QtMath] Introduced qNextPowerOfTwo methods. Change-Id: Id23fbe5ad6bae647b30d5a4212c0330e48a50278 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | qpa: Merge qgl_qpa.cpp into qgl.cppTor Arne Vestbø2014-05-151-11/+388
| | | | | | | | | | Change-Id: I91cfd7daf7f1dd88659019ccc671ec0d9245067f Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-05-061-14/+26
|\| | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2014-05-011-13/+13
| |\ | | | | | | | | | | | | | | | This merge adds the opengl rename. Change-Id: I84ea0b6abee9780ebb2cf3f64ab9e3fdf2acab3e
| | * Rename new QOpenGLContext APIsLaszlo Agocs2014-04-251-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 a double memory copy during bindTextureAllan Sandfeld Jensen2014-04-251-1/+13
| |/ | | | | | | | | | | | | | | | | | | | | If a painter is active on a QPixmap being uploaded, it will be copied twice, first to create a QImage and then from QImage into a texture. The first copy is unnecessary since the QImage is only temporary, so we can force it to be created as a reference instead of a copy. Change-Id: Iabcfb514a634446a01f1c4031349c185ec09290b Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* / Remove direct OpenGL calls from QtOpenGLLaszlo Agocs2014-04-281-123/+161
|/ | | | | | Task-number: QTBUG-36483 Change-Id: I96dea5649c0a49a11cd2ff31da659cd2067e769d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Avoid recreating the underlying context in QGLContext wrappersLaszlo Agocs2014-04-031-2/+3
| | | | | | | | | | | QGLContexts created from a QOpenGLContext get their valid flag reset, resulting in creating a totally new underlying context. This is wrong and becomes visible when sharing is expected between contexts (since the QGLContext's underlying QOpenGLContext will not have sharing). Task-number: QTBUG-37893 Change-Id: I8cb37c11dfb400a77e510bf4c8219bedc742309e Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* QNX: Fix OpenGL autotestFabian Bumberger2014-04-011-0/+5
| | | | | | | | | | | | On QNX grabbing the frame buffer returns the content of the back buffer. In order to execute the OpenGL tests properly a swapBuffers is executed before in order to be able to retrieve the content of the front buffer. The patch also documents this platform behavior. Change-Id: I7a501818ec6eea061f2f54f95854f68cb72e0534 Reviewed-by: James McDonnell <jmcdonnell@qnx.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix some documentation errors.Friedemann Kleint2014-03-241-46/+1
| | | | | | | | Correct links and fix typos, remove obsolete documentation, fix some snippets, mark some classes as internal. Change-Id: I9a3266605f060783413d32740057a57a820c8929 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Fix crash: make sure functions pointer is initialized.BogDan Vatra2014-03-221-1/+1
| | | | | Change-Id: I42fd3933f33370612290e8ba252349acfae72381 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Resurrect QGLWidget::renderText()Laszlo Agocs2014-03-151-12/+8
| | | | | | | | | | The variant taking x, y, z has been broken in all Qt 5.x releases. This is now corrected by making the GL2 paint engine capable of applying a Z translation. Task-number: QTBUG-31156 Change-Id: I119566e9e9577f6cdf7e8bae56cac1e34995e622 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix compileBogDan Vatra2014-03-061-2/+1
| | | | | | | | Move Q_Q(QGLContext); inside #ifndef block, otherwise q varialble remains unused and it breaks the compilation. Change-Id: Iebef9a45930fd4f7783eb983b55bf6b5e0b94cf4 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Dynamic GL: remove exporting symbolsLaszlo Agocs2014-03-041-39/+40
| | | | | | | | | | | | | | | | | | | | | 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-222/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Resurrect QGLWidget::renderPixmap()Laszlo Agocs2014-01-061-46/+57
| | | | | | | | | | | | | | | | This function has been completely broken since Qt 5.0. Unfortunately the autotest's verification steps were somewhat faulty so returning a null pixmap from renderPixmap() did not trigger a failure. The implementation is now done with framebuffer objects and pixel readback. This is not ideal performance-wise, but is the only option. In Qt 4 pixmaps were often backed by platform dependent native pixmaps that could be used as rendering targets for OpenGL content. This is not an option anymore since pixmaps are raster backed on all the major platforms. Task-number: QTBUG-33186 Change-Id: I8f558e33bf7967ac3be439fd5a3eac07b6444be5 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Doc: Fix broken linksSze Howe Koh2013-11-051-1/+1
| | | | | | | | Task-number: QTBUG-33360 Change-Id: Ic944cb2f575c35ebad64852ef5fc44a50ac03571 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Do not byteswap RGBA8888 formatsAllan Sandfeld Jensen2013-10-251-4/+32
| | | | | | | | | | | | | The three RGBA8888 formats was introduced to make it possible to have QImages and QPixmaps in native OpenGL formats, but uploaded textures of these types are still converted to ARGB first and then swapped back. This patch detects the formats and ensures the unneeded back-and-forth conversion does not take place. It also replaces a seemingly unused private API meant for the same goal. Change-Id: Id69d6973bb9c13d1052f2a1b0c516183f63421c2 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Avoid calling convertFromGLImage on a null image.Gunnar Sletta2013-10-141-0/+5
| | | | | | | Task-number: QTBUG-34017 Change-Id: If51ef4b1f906677e26d14b5a92799097d18ac437 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-42/+42
| | | | | | | | | | | | | | | | | 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>
* Fix QtOpenGL module build with -WerrorKonstantin Ritt2013-09-091-4/+4
| | | | | | | | | | Build failed with error "array subscript is above array bounds [-Werror=array-bounds]" because GCC optimizes three inline calls and sees A[4][4] != A[16]. According to Thiago this may lead to an undefined behavior after all. Change-Id: I31ec01377d856890f6072369b3acd1f37e4118ab Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixed crashes in QGLTextureDestroyer.Samuel Rødal2013-05-291-4/+1
| | | | | | | | | | | QGLTextureDestroyer will try to make the context current on the GUI thread, regardless of whether it is owned by another thread. Use QOpenGLSharedResourceGuard instead which does the right thing and takes shared contexts into account. Task-number: QTBUG-31403 Change-Id: I1377f9284995a7ba5af32c85296eef152fc035c8 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* QGLWidget: Support retina framebuffer grabbingGabriel de Dietrich2013-05-231-3/+4
| | | | | | | | | And update the opengl/grabber example. Task-number: QTBUG-31173 Change-Id: If09f1f3634b353d034f51240fc68be6ee7aabb48 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Merge branch 'dev' into stableOswald Buddenhagen2013-03-201-240/+61
|\ | | | | | | | | | | | | | | | | | | | | | | This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
| * Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Giuseppe D'Angelo2013-02-171-2/+2
| |\ | | | | | | | | | refs/staging/dev
| | * Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-141-2/+2
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/concurrent/doc/qtconcurrent.qdocconf src/corelib/doc/qtcore.qdocconf src/corelib/global/qglobal.h src/dbus/doc/qtdbus.qdocconf src/dbus/qdbusmessage.h src/gui/doc/qtgui.qdocconf src/gui/image/qimagereader.cpp src/network/doc/qtnetwork.qdocconf src/opengl/doc/qtopengl.qdocconf src/opengl/qgl.h src/plugins/platforms/windows/qwindowswindow.cpp src/printsupport/doc/qtprintsupport.qdocconf src/sql/doc/qtsql.qdocconf src/testlib/doc/qttestlib.qdocconf src/tools/qdoc/doc/config/qt-cpp-ignore.qdocconf src/widgets/doc/qtwidgets.qdocconf src/xml/doc/qtxml.qdocconf Change-Id: Ie9a1fa2cc44bec22a0b942e817a1095ca3414629
| * | | Remove duplicated code for handling OpenGL extensions in QtOpenGLTor Arne Vestbø2013-02-171-223/+61
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | We now re-use QOpenGLExtensions/Functions from QtGui in the same way as QtGui uses these classes. There is still some duplicated logic in qglfunctions.cpp, but this code now at least uses the shared QOpenGLExtensionMatcher class. Change-Id: Ie04008c43d430ae805e6ec1c45e7e363deeb3b8f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
| * | Drop the unused qt_gl_convertToGLFormat functionGiuseppe D'Angelo2013-01-291-5/+0
| | | | | | | | | | | | | | | | | | Change-Id: Ie621f562401b703077a2b304ad6d8445efc76642 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
| * | Drop the unused QGLContextPrivate::convertToGLFormat functionGiuseppe D'Angelo2013-01-291-12/+0
| | | | | | | | | | | | | | | | | | Change-Id: Iaa176fc6152162c91a3e3bd373a235883001975c Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* | | Make sure QGLWidget::setContext() is correctly documented as obsolete.Samuel Rødal2013-03-151-1/+7
| |/ |/| | | | | | | | | | | Task-number: QTBUG-30017 Change-Id: Idf3c943d7aaad294cbf6858cca1c01e841e94b7d Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Rename function to fix symbol clash in static buildKai Koehne2013-02-111-2/+2
|/ | | | | | | | | | | | | | | | | | Rename qt_gl_read_framebuffer function to qt_gl_read_frame_buffer in Qt5OpenGL. This fixes an error when linking statically against both Qt5Gui and Qt5OpenGL: Qt5Guid.lib(qopenglframebufferobject.obj) : error LNK2005: "class QImage __cdecl qt_gl_read_framebuffer(class QSize const &,bool,bool)" (?qt_gl_read_framebuffer@@YA?AVQImage@@ABVQSize@@_N1@Z) already defined in Qt5OpenGLd.lib(qgl.obj) Creating library debug\composition.lib and object debug\composition.exp The function was duplicated in 6e28e844 . Change-Id: I9e3b78e0ec5b25264575d563538587b45cd93e86 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@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>
* Fixed deadlock situation in QtOpenGL's texture management.Samuel Rødal2012-12-141-0/+5
| | | | | | | | | | | | | | | | | | QGLTextureCache::remove(qint64 key) locks the QGLContextGroupList mutex before removing a texture. Removing the texture might cause the QGLShareContextScope construct to be invoked, which calls QGLContext::currentContext(), which will wrap a current QOpenGLContext in a newly created QGLContext. That also triggers the creation of a QGLContextGroup object, which will register itself with the QGLContextGroupList, an operation that again will lock the QGLContextGroupList mutex. To prevent this from deadlocking we make the mutex recursive. The whole QGLShareContextScope approach is really broken and should be replaced, but for now it's what we have in QtOpenGL (QtGui has the replacement QOpenGLSharedResource). Change-Id: Id1ff69035af3f31b690892c03f74748d052a278b Reviewed-by: Zeno Albisser <zeno.albisser@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Basic high-dpi "retina" support for Qt 5.Morten Johan Sørvig2012-12-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Bring Qt 5 on par with Qt 4, prepare for more comprehensive support later on. Introduce device independent pixels (dips), device pixels, and devicePixelRatio. Add high-dpi support to QPainter, QGLWidget, the cocoa platform plugin, mac and fusion styles. Dips are similar to CSS pixels, Apple points and Android density-independent pixels. Device pixels are pixels in the backing store/physical pixels on screen. devicePixelRatio is the ratio between them, which is 1.0 on standard displays and 2.0 on "retina" displays. New API: QImage::devicePixelRatio() and setDevicePixelRatio() QPixmap::devicePixelRatio() and setDevicePixelRatio() QWindow::devicePixelRatio() QScreen::devicePixelRatio() QGuiApplicaiton::devicePixelRatio() Change-Id: If98c3ca9bfdf0e1bdbcf7574cd5b912c9ff63856 Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* OpenGL: Remove bogus error in textures example on ES 2 platformsSean Harmer2012-12-011-0/+2
| | | | | | | | | | | | The call to glGetBooleanv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT) in QGLExtensions::currentContextExtensions() was resulting in an invalid enum on ES 2 systems. This was not being cleared and subsequentally being interpreted as a failed texture upload in the textures example. This enum doesn't exist on ES 2 so don't query it. Change-Id: I84f9c4b0aa8b11b6036eeed1f9378d110d9ea69d Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Added explicit threading API to QtOpenGL.Samuel Rødal2012-11-301-11/+34
| | | | | | | | | | | | | | | | | | | | | | | | Since QtOpenGL/QGLContext is implemented in terms of QtGui/QOpenGLContext which has stricter requirements about how it's supposed to be used, we need to apply these requirements to QGLContext as well. This change adds QGLContext::moveToThread(QThread *) and documents it as a necessity for making a context current on another thread. Also introduces QGLPixelbuffer::context() to access the QGLContext of a pixelbuffer, and made QGLWidget::context() return a non-const QGLContext, since there's no good reason why it shouldn't, and it leads to less const_cast clutter. We could have introduced a backdoor in QOpenGLContext instead, making it loosen its requirements, but that would have made it harder / impossible to fully support threaded OpenGL in all the platforms. Task-number: QTBUG-22560 Change-Id: Ibb6f65f342e7c963e80cc42ab5664c5f1cab30b0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* Remove legacy classes from "Painting in 3D" list.Gunnar Sletta2012-11-281-8/+0
| | | | | Change-Id: I099dd940145629a67266d02bde7217ea9fbc9372 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Improve OpenGL docsJan Arve Saether2012-11-271-1/+6
| | | | | | | | | * Mark all Open GL classes with \inmodule QtOpenGL. Otherwise, they weren't listed in the list of classes. * Remove a reference to Motif Change-Id: I75680712b212cf46b869014d3678b56d022c6323 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Get rid of deprecated functionality in QtOpenGL.Samuel Rødal2012-11-221-77/+2
| | | | | | | | | We will in any case not be able to support this in Qt 5, so best to just remove it to not give any false impressions. Change-Id: Ib52e86007b9e6483bd973f13502b078792a9fa40 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Made renderText() work in samplebuffers example.Samuel Rødal2012-11-221-23/+17
| | | | | | | | | | | Since the OpenGL paint engine is now OpenGL 2.0 based, we need to save and restore all GL state to prevent it from being clobbered. Task-number: QTBUG-27020 Change-Id: I39831e074aa818583df34c4a88b13be559d0231b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Make QGLWidget::paintGL() call glClear().Morten Johan Sorvig2012-11-031-0/+1
| | | | | | | | | | | | Creating and displaying a plain QGLWidget on Mac would display "garbage" or previous frame buffer content on screen. This looks broken and raises interesting privacy concerns. Fix by adding a call to glClear(). Change-Id: I507c24275e41fac0be5f518c5a70d151099ae6b8 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* OpenGL: Don't request a context version higher than is supportedSean Harmer2012-10-031-0/+8
| | | | | | | | | | | | | | | The function wglCreateContextAttribsARB will fail if we request a context version higher than is supported. We therefore upper-bound the requested version by the version of the static context. This results in context creation succeeding and having the closest possible match to the requested format. The xcb qpa plugin is modified to operate similarly to the windows plugin in that it now creates a "static" context which is used to limit the versions of contexts requested by the user. Change-Id: I277ad7cc82edfdf7b9d8502ad921c8175feb1a4a Reviewed-by: Samuel Rødal <samuel.rodal@digia.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>
* Fixed potential use of uninitialized variable in qgl.cppSamuel Rødal2012-09-191-1/+1
| | | | | | | | If glGetBooleanv fails this variable is left uninitialized. Task-number: QTBUG-26952 Change-Id: Idb42833f2907bb66fd87c5cdb39753fca04e7438 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* OpenGL: Add flags and logic for newer versions of OpenGL in QGLFormatSean Harmer2012-09-191-1/+25
| | | | | Change-Id: Iad57286c36c7fd205f06abc40cca5f568d572e81 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>