diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2016-02-12 12:50:12 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-03-02 12:16:15 +0000 |
commit | 69f29b90322338bb7cd884a0cecdb8dd5dd2573e (patch) | |
tree | e0f9d7dd3d71b802fa25ca487bc232081179e1d0 /src/gui/opengl/qopengltexturehelper.cpp | |
parent | 6b0a577bf85845780e9a7b101260cdf72fa1d33c (diff) |
Clean up resolving of OpenGL functions on Windows
Always try both e/wglGetProcAddress and ::GetProcAddress to
resolve the methods. Like this QOpengGLContext::getProcAddress is
able to return any OpenGL entry point, and we can both simplify
the code we have in the QPA backend as well as get rid of windows
specific code paths in Qt Gui.
Task-number: QTBUG-39531
Change-Id: I1ddf1b0974f69b56b219a619655b723eb0134b14
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/gui/opengl/qopengltexturehelper.cpp')
-rw-r--r-- | src/gui/opengl/qopengltexturehelper.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 23e5ef6579..be88946e90 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -143,17 +143,6 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) TextureImage2DMultisample = &QOpenGLTextureHelper::qt_TextureImage2DMultisample; } -#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) - // wglGetProcAddress should not be used to (and indeed will not) load OpenGL <= 1.1 functions. - // Hence, we resolve them "the hard way" - HMODULE handle = static_cast<HMODULE>(QOpenGLContext::openGLModuleHandle()); - if (!handle) - handle = GetModuleHandleA("opengl32.dll"); - - TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexImage1D"))); - TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(GetProcAddress(handle, QByteArrayLiteral("glTexSubImage1D"))); -#endif - #if defined(QT_OPENGL_ES_2) // Here we are targeting OpenGL ES 2.0+ only. This is likely using EGL, where, // similarly to WGL, non-extension functions (i.e. any function that is part of the @@ -227,6 +216,10 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) } #ifndef QT_OPENGL_ES_2 + // OpenGL 1.0 and 1.1 + TexImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexImage1D")); + TexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress("glTexSubImage1D"));\ + // OpenGL 1.3 GetCompressedTexImage = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLvoid *)>(context->getProcAddress("glGetCompressedTexImage")); CompressedTexSubImage1D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress("glCompressedTexSubImage1D")); |