summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglvertexarrayobject.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use an offscreen surface in VAO cleanupLaszlo Agocs2014-04-011-1/+10
| | | | | | | | | Avoid failing the makeCurrent() on iOS that does not currently support using a window with different contexts. Change-Id: I2e10ad7e382161625a78518d02ad94edaff591ca Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
* Keep track of destroyed QOpenGLContexts in QOpenGLVertexArrayObjectTor Arne Vestbø2014-03-271-2/+6
| | | | | | | | | | | | | | | | | | | | | QOpenGLVertexArrayObject saved the QOpenGLContext it was created in at the point of QOpenGLVertexArrayObjectPrivate::create(), but didn't set the saved context back to 0 in QOpenGLVertexArrayObjectPrivate::destroy(). The result was that the zero-pointer checks in the VAO destructor never hit, and we ended up trying to make a destroyed QOpenGLContext current. This bug was triggered by the QFontEngine having a limit of 4 concurrent glyph caches, so when we created the fifth glyph cache we would remove an earlier one, which destroyed its VOA, that referenced a QOpenGLContext for a window that had been destroyed already. We now reset the context back to 0, and disconnect aboutToBeDestroyed() at the point of QOpenGLVertexArrayObjectPrivate::destroy(). Change-Id: Ib16f3877b310144886cf863b16697c137e7c7941 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Dynamic GL: remove exporting symbolsLaszlo Agocs2014-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* Properly migrate vao helper to dynamic GLLaszlo Agocs2014-02-251-82/+67
| | | | | | | | | | Remove the forced bail out when isES() returns true. This is not necessary. Change-Id: I5ee21fe1e66163e2391bd11b647827b3c0a020c1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Dynamic GL switch on WindowsLaszlo Agocs2014-02-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use QByteArrayLiteral throughout in QOpenGLVertexArrayObjectSean Harmer2013-10-201-8/+8
| | | | | Change-Id: Ia362ead0ffdc077bd0db5d980c80464838c934ea Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Support APPLE VAO extension on Mac.James Turner2013-10-161-13/+27
| | | | | | | | | | Since Mac lacks a compatibility profile, we often use the highest supported compatible version, 2.1; this lacks vertex-array-object (VAO) support in the API, but Apple provide a compatible extension. Extend the helper object to detect this case and make VAO support work. Change-Id: I75a74e048a0d188cec76bc5a4a9eafa4c9143740 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-3/+3
| | | | | | | | | | | | | | | | | 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>
* Avoid crash when QOpenGLContext is destroyed before the VAOSean Harmer2013-06-281-2/+25
| | | | | | | Change-Id: I19df59453156a95c5075a065268333a74cec2476 Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Avoid crash in QVertexArrayObject destructorSean Harmer2013-03-121-1/+2
| | | | | | Change-Id: If43c7b1cfdee504171a26b07db2ade9c20528299 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* OpenGL: Add QOpenGLVertexArrayObject classSean Harmer2013-02-281-0/+472
This class makes it much simpler to manage OpenGL state relating to vertex data (i.e. vertex buffer objects, vertex attribute divisors, index buffer objects, vertex buffer formats). Change-Id: I9fb932cc3f0691ec9ba065bf871e43cd2e369bad Reviewed-by: James Turner <james.turner@kdab.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>