diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2014-02-22 14:48:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-25 21:51:07 +0100 |
commit | 97ed8f3c0ff300cd8d4b3c75b91f89e6ee355e10 (patch) | |
tree | 514b5d1714d103519416ca2abc1c955bdf872d5c | |
parent | e1fd82981c0b35d7aef3ceab66af1a712d1bc226 (diff) |
Fix a getProcAddress in QOpenGLDebugLogger under Win32 + Desktop GL + ATI
We can't resolve a "basic entry point" such as glGetPointerv on Windows'
Desktop GL. Apparently NVIDIA drivers let us do that, but ATI ones don't.
Change-Id: I8e8a54b5dcd3fe87f2bd677d1d0cf08b3e8c11c4
Reviewed-by: Thomas Steen
Reviewed-by: James Turner <james.turner@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r-- | src/gui/opengl/qopengldebug.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index 90d062f4dd..2355d0a8a7 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -43,6 +43,7 @@ #include <QtCore/qglobal.h> #include <QtCore/qvarlengtharray.h> #include <QtGui/qopengl.h> +#include <QtGui/qopenglfunctions.h> #include "qopengldebug.h" @@ -1364,7 +1365,20 @@ bool QOpenGLDebugLogger::initialize() GET_DEBUG_PROC_ADDRESS(glGetDebugMessageLog); GET_DEBUG_PROC_ADDRESS(glPushDebugGroup); GET_DEBUG_PROC_ADDRESS(glPopDebugGroup); + + // Windows' Desktop GL doesn't allow resolution of "basic GL entry points" + // through wglGetProcAddress +#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) + { + HMODULE handle = static_cast<HMODULE>(QOpenGLFunctions::platformGLHandle()); + if (!handle) + handle = GetModuleHandleA("opengl32.dll"); + d->glGetPointerv = reinterpret_cast<qt_glGetPointerv_t>(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv"))); + } +#else GET_DEBUG_PROC_ADDRESS(glGetPointerv) +#endif + #undef GET_DEBUG_PROC_ADDRESS glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength); |