From 6e28e8441b698c3397c2c78125c877f2e9867cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 22 Aug 2011 10:49:28 +0200 Subject: Copy core GL functionality to QtGui with QGL -> QOpenGL naming. Change-Id: Ibc989afa4a30dd184d41d1a1cd89f97196e48855 Reviewed-on: http://codereview.qt.nokia.com/3710 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qsurfaceformat.cpp | 54 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'src/gui/kernel/qsurfaceformat.cpp') diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 063e68d29f..c53c510d8c 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -44,6 +44,14 @@ #include #include +#ifdef major +#undef major +#endif + +#ifdef minor +#undef minor +#endif + class QSurfaceFormatPrivate { public: @@ -59,6 +67,8 @@ public: , swapBehavior(QSurfaceFormat::DefaultSwapBehavior) , numSamples(-1) , profile(QSurfaceFormat::NoProfile) + , major(1) + , minor(1) { } @@ -73,7 +83,9 @@ public: stencilSize(other->stencilSize), swapBehavior(other->swapBehavior), numSamples(other->numSamples), - profile(other->profile) + profile(other->profile), + major(other->major), + minor(other->minor) { } @@ -88,6 +100,8 @@ public: QSurfaceFormat::SwapBehavior swapBehavior; int numSamples; QSurfaceFormat::OpenGLContextProfile profile; + int major; + int minor; }; QSurfaceFormat::QSurfaceFormat() : d(new QSurfaceFormatPrivate) @@ -351,6 +365,12 @@ void QSurfaceFormat::setAlphaBufferSize(int size) } } +/*! + Sets the desired OpenGL context profile. + + This setting is ignored if the requested OpenGL version is + less than 3.2. +*/ void QSurfaceFormat::setProfile(OpenGLContextProfile profile) { if (d->profile != profile) { @@ -364,6 +384,38 @@ QSurfaceFormat::OpenGLContextProfile QSurfaceFormat::profile() const return d->profile; } +/*! + Sets the desired major OpenGL version. +*/ +void QSurfaceFormat::setMajorVersion(int major) +{ + d->major = major; +} + +/*! + Returns the major OpenGL version. +*/ +int QSurfaceFormat::majorVersion() const +{ + return d->major; +} + +/*! + Sets the desired minor OpenGL version. +*/ +void QSurfaceFormat::setMinorVersion(int minor) +{ + d->minor = minor; +} + +/*! + Returns the minor OpenGL version. +*/ +int QSurfaceFormat::minorVersion() const +{ + return d->minor; +} + bool operator==(const QSurfaceFormat& a, const QSurfaceFormat& b) { return (a.d == b.d) || ((int) a.d->opts == (int) b.d->opts -- cgit v1.2.3