summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2012-06-23 17:24:37 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-27 00:46:35 +0200
commit6874a33a75154400e8cd0424cec6d464b133c7cc (patch)
tree7bbc58b8a560522001a97180f03d191839d1d7b4 /src/gui/kernel
parentcd853c0ad7a74a81aa831968c7ded60874b161ae (diff)
Fixed missing way of choosing EGL renderable type with QSurfaceFormat.
This has been long overdue, since EGL now lets you choose between desktop and ES based OpenGL. We also add OpenVG for those who want to use raw OpenVG with a QOpenGLContext. The underlying EGL API for using OpenGL / OpenVG is the same, with eglMakeCurrent() and eglSwapBuffers(). Change-Id: Ib0146b3fde5fe632069ebf99e7712f496ee7ea4d Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp26
-rw-r--r--src/gui/kernel/qsurfaceformat.h10
2 files changed, 36 insertions, 0 deletions
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index cc6b621047..ecfeb80149 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -68,6 +68,7 @@ public:
, stencilSize(-1)
, swapBehavior(QSurfaceFormat::DefaultSwapBehavior)
, numSamples(-1)
+ , renderableType(QSurfaceFormat::DefaultRenderableType)
, profile(QSurfaceFormat::NoProfile)
, major(2)
, minor(0)
@@ -85,6 +86,7 @@ public:
stencilSize(other->stencilSize),
swapBehavior(other->swapBehavior),
numSamples(other->numSamples),
+ renderableType(other->renderableType),
profile(other->profile),
major(other->major),
minor(other->minor)
@@ -101,6 +103,7 @@ public:
int stencilSize;
QSurfaceFormat::SwapBehavior swapBehavior;
int numSamples;
+ QSurfaceFormat::RenderableType renderableType;
QSurfaceFormat::OpenGLContextProfile profile;
int major;
int minor;
@@ -479,6 +482,29 @@ void QSurfaceFormat::setAlphaBufferSize(int size)
}
/*!
+ Sets the desired renderable type.
+
+ Chooses between desktop OpenGL, OpenGL ES, and OpenVG.
+*/
+void QSurfaceFormat::setRenderableType(RenderableType type)
+{
+ if (d->renderableType != type) {
+ detach();
+ d->renderableType = type;
+ }
+}
+
+/*!
+ Gets the renderable type.
+
+ Chooses between desktop OpenGL, OpenGL ES, and OpenVG.
+*/
+QSurfaceFormat::RenderableType QSurfaceFormat::renderableType() const
+{
+ return d->renderableType;
+}
+
+/*!
Sets the desired OpenGL context profile.
This setting is ignored if the requested OpenGL version is
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index a4224bbedd..e8972aa8ca 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -68,6 +68,13 @@ public:
TripleBuffer
};
+ enum RenderableType {
+ DefaultRenderableType = 0x0,
+ OpenGL = 0x1,
+ OpenGLES = 0x2,
+ OpenVG = 0x4
+ };
+
enum OpenGLContextProfile {
NoProfile,
CoreProfile,
@@ -106,6 +113,9 @@ public:
void setProfile(OpenGLContextProfile profile);
OpenGLContextProfile profile() const;
+ void setRenderableType(RenderableType type);
+ RenderableType renderableType() const;
+
void setMajorVersion(int majorVersion);
int majorVersion() const;