summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qsurfaceformat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel/qsurfaceformat.cpp')
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp54
1 files changed, 53 insertions, 1 deletions
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 <QtCore/qatomic.h>
#include <QtCore/QDebug>
+#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