summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qsurfaceformat.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-08-22 10:49:28 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-08-29 10:25:24 +0200
commit6e28e8441b698c3397c2c78125c877f2e9867cb1 (patch)
tree1e3ad0e43cb775854835817cd04bdc8b5e047e15 /src/gui/kernel/qsurfaceformat.cpp
parentaaa4a26f82f99fa8724841eba91bad029306e0ce (diff)
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 <gunnar.sletta@nokia.com>
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