summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsglcontext.cpp
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-02-20 14:00:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-23 01:34:28 +0100
commit7e3ee5400ee13796d045879a5bc9d0be23b1b8ff (patch)
treefc1471531c6f735496bcc169205c32d81bfa2aeb /src/plugins/platforms/windows/qwindowsglcontext.cpp
parentf2b26af2b4db25aeb74279a40365b76f0406a018 (diff)
Enforce OpenGL context creation under Windows
We don't support other context types, so fail in those cases. Also, return OpenGL as the rendereable type of our surface. Change-Id: I22792a913b78b837da3d27cef69145076579b949 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsglcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 081b42ce65..6f59b33e62 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -232,6 +232,7 @@ static QSurfaceFormat
QWindowsOpenGLAdditionalFormat *additionalIn = 0)
{
QSurfaceFormat format;
+ format.setRenderableType(QSurfaceFormat::OpenGL);
if (pfd.dwFlags & PFD_DOUBLEBUFFER)
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
format.setDepthBufferSize(pfd.cDepthBits);
@@ -500,6 +501,7 @@ static QSurfaceFormat
enum { attribSize =40 };
QSurfaceFormat result;
+ result.setRenderableType(QSurfaceFormat::OpenGL);
if (!staticContext.hasExtensions())
return result;
int iAttributes[attribSize];
@@ -875,6 +877,12 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
m_renderingContext(0),
m_pixelFormat(0), m_extensionsUsed(false)
{
+ QSurfaceFormat format = context->format();
+ if (format.renderableType() == QSurfaceFormat::DefaultRenderableType)
+ format.setRenderableType(QSurfaceFormat::OpenGL);
+ if (format.renderableType() != QSurfaceFormat::OpenGL)
+ return;
+
// workaround for matrox driver:
// make a cheap call to opengl to force loading of DLL
static bool opengl32dll = false;
@@ -912,7 +920,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
QWindowsOpenGLAdditionalFormat obtainedAdditional;
if (tryExtensions) {
m_pixelFormat =
- ARB::choosePixelFormat(hdc, *m_staticContext, context->format(),
+ ARB::choosePixelFormat(hdc, *m_staticContext, format,
requestedAdditional, &m_obtainedPixelFormatDescriptor);
if (m_pixelFormat > 0) {
m_obtainedFormat =
@@ -922,7 +930,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
}
} // tryExtensions
if (!m_pixelFormat) { // Failed, try GDI
- m_pixelFormat = GDI::choosePixelFormat(hdc, context->format(), requestedAdditional,
+ m_pixelFormat = GDI::choosePixelFormat(hdc, format, requestedAdditional,
&m_obtainedPixelFormatDescriptor);
if (m_pixelFormat)
m_obtainedFormat =
@@ -945,7 +953,7 @@ QWindowsGLContext::QWindowsGLContext(const QOpenGLStaticContextPtr &staticContex
if (m_extensionsUsed)
m_renderingContext =
ARB::createContext(*m_staticContext, hdc,
- context->format(),
+ format,
requestedAdditional,
sharingRenderingContext);
if (!m_renderingContext)