diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-10-26 16:09:37 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-26 18:06:39 +0200 |
commit | 82d6518696cdfeec88b7bdbffccc5b1521c18785 (patch) | |
tree | 403e4ade6903e84bca35a666315c04e198f516aa /src/plugins/platforms/windows/qwindowsglcontext.h | |
parent | a144e0bfdc9d5e98e718e8d60bcb016ca666a454 (diff) |
Windows: Fix Open GL formats.
- Add swapInterval as additional format
- Query context format correctly and store in separate struct
(default vs requested/obtained)
- Cosmetics, rename enumerations, structs.
Change-Id: I381cf8e1bde33e6624feb549437c7b95dd85e93c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsglcontext.h')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index aa839d1fcd..f2784f3d9b 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -64,10 +64,11 @@ enum QWindowsGLFormatFlags // Additional format information for Windows. struct QWindowsOpenGLAdditionalFormat { - QWindowsOpenGLAdditionalFormat(unsigned formatFlagsIn = 0, unsigned pixmapDepthIn = 0) : - formatFlags(formatFlagsIn), pixmapDepth(pixmapDepthIn) {} + QWindowsOpenGLAdditionalFormat(unsigned formatFlagsIn = 0, unsigned pixmapDepthIn = 0, unsigned swapIntervalIn = -1) : + formatFlags(formatFlagsIn), pixmapDepth(pixmapDepthIn), swapInterval(swapIntervalIn) {} unsigned formatFlags; // QWindowsGLFormatFlags. unsigned pixmapDepth; // for QWindowsGLRenderToPixmap + int swapInterval; }; // Per-window data for active OpenGL contexts. @@ -81,6 +82,19 @@ struct QOpenGLContextData HDC hdc; }; +struct QWindowsOpenGLContextFormat +{ + QWindowsOpenGLContextFormat(); + static QWindowsOpenGLContextFormat current(); + void apply(QSurfaceFormat *format) const; + + QSurfaceFormat::OpenGLContextProfile profile; + int version; //! majorVersion<<8 + minorVersion + QSurfaceFormat::FormatOptions options; +}; + +QDebug operator<<(QDebug d, const QWindowsOpenGLContextFormat &); + class QOpenGLStaticContext { Q_DISABLE_COPY(QOpenGLStaticContext) @@ -104,6 +118,11 @@ public: typedef HGLRC (APIENTRY *WglCreateContextAttribsARB)(HDC, HGLRC, const int *); + typedef BOOL + (APIENTRY *WglSwapInternalExt)(int interval); + typedef int + (APIENTRY *WglGetSwapInternalExt)(void); + bool hasExtensions() const { return wglGetPixelFormatAttribIVARB && wglChoosePixelFormatARB && wglCreateContextAttribsARB; } @@ -113,13 +132,14 @@ public: const QByteArray vendor; const QByteArray renderer; const QByteArray extensionNames; - int majorVersion; - int minorVersion; unsigned extensions; + const QWindowsOpenGLContextFormat defaultFormat; WglGetPixelFormatAttribIVARB wglGetPixelFormatAttribIVARB; WglChoosePixelFormatARB wglChoosePixelFormatARB; WglCreateContextAttribsARB wglCreateContextAttribsARB; + WglSwapInternalExt wglSwapInternalExt; + WglGetSwapInternalExt wglGetSwapInternalExt; }; QDebug operator<<(QDebug d, const QOpenGLStaticContext &); |