From 4535c7911d47b94ecb2067793f2f6d906794e1fe Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 18 May 2015 11:10:47 +0200 Subject: Expose GLES 3.0 and 3.1 functions 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 --- examples/opengl/hellogles3/hellogles3.pro | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 examples/opengl/hellogles3/hellogles3.pro (limited to 'examples/opengl/hellogles3/hellogles3.pro') diff --git a/examples/opengl/hellogles3/hellogles3.pro b/examples/opengl/hellogles3/hellogles3.pro new file mode 100644 index 0000000000..299d439fd2 --- /dev/null +++ b/examples/opengl/hellogles3/hellogles3.pro @@ -0,0 +1,15 @@ +HEADERS = $$PWD/glwidget.h \ + $$PWD/mainwindow.h \ + $$PWD/../hellogl2/logo.h + +SOURCES = $$PWD/glwidget.cpp \ + $$PWD/main.cpp \ + $$PWD/mainwindow.cpp \ + $$PWD/../hellogl2/logo.cpp + +QT += widgets + +RESOURCES += hellogles3.qrc + +target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogles3 +INSTALLS += target -- cgit v1.2.3