From 97ed8f3c0ff300cd8d4b3c75b91f89e6ee355e10 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 22 Feb 2014 14:48:02 +0100 Subject: 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 Reviewed-by: Laszlo Agocs Reviewed-by: Sean Harmer --- src/gui/opengl/qopengldebug.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/gui/opengl') 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 #include #include +#include #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(QOpenGLFunctions::platformGLHandle()); + if (!handle) + handle = GetModuleHandleA("opengl32.dll"); + d->glGetPointerv = reinterpret_cast(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv"))); + } +#else GET_DEBUG_PROC_ADDRESS(glGetPointerv) +#endif + #undef GET_DEBUG_PROC_ADDRESS glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength); -- cgit v1.2.3