summaryrefslogtreecommitdiffstats
path: root/src/opengl/gl2paintengineex
diff options
context:
space:
mode:
authorJani Hautakangas <jani.hautakangas@nokia.com>2010-10-19 15:48:01 (GMT)
committerJani Hautakangas <jani.hautakangas@nokia.com>2010-10-20 08:41:29 (GMT)
commit26b5a9c67f8c4f8bf4cace5c189f506d3f89f3ce (patch)
tree8c930b985c5779e13ad4b319f94b7423ae748b21 /src/opengl/gl2paintengineex
parent4d93a4eccb462ce3bee75f0c3961901d60bcae02 (diff)
downloadQt-26b5a9c67f8c4f8bf4cace5c189f506d3f89f3ce.zip
Qt-26b5a9c67f8c4f8bf4cace5c189f506d3f89f3ce.tar.gz
Qt-26b5a9c67f8c4f8bf4cace5c189f506d3f89f3ce.tar.bz2
Fix GL_OES_element_index_uint and add GL_OES_depth24 detection.
GL_OES_element_index_uint detection was not working because EGL config wasn't yet resolved. In addition QFrameBufferObject should use 24bit depth render buffer if extension is available. Task-number: QTBUG-14542 Reviewed-by: Gunnar
Diffstat (limited to 'src/opengl/gl2paintengineex')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp8
-rw-r--r--src/opengl/gl2paintengineex/qtriangulator.cpp21
2 files changed, 9 insertions, 20 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index a98d7cc..5c7ebfa 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -825,7 +825,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
- if (glSupportsElementIndexUint)
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint32) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
else
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(quint16) * polys.indices.size(), polys.indices.data(), GL_STATIC_DRAW);
@@ -836,7 +836,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
#else
cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size());
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
} else {
@@ -853,7 +853,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBindBuffer(GL_ARRAY_BUFFER, cache->vbo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, cache->ibo);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, 0);
- if (glSupportsElementIndexUint)
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, 0);
else
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, 0);
@@ -861,7 +861,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBindBuffer(GL_ARRAY_BUFFER, 0);
#else
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, cache->vertices);
- if (glSupportsElementIndexUint)
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint)
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_INT, (qint32 *)cache->indices);
else
glDrawElements(cache->primitiveType, cache->indexCount, GL_UNSIGNED_SHORT, (qint16 *)cache->indices);
diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp
index b839b00..85f604a 100644
--- a/src/opengl/gl2paintengineex/qtriangulator.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulator.cpp
@@ -58,7 +58,6 @@
#include <math.h>
#include <private/qgl_p.h>
-#include <private/qglextensions_p.h>
QT_BEGIN_NAMESPACE
@@ -3014,10 +3013,8 @@ void QTriangulator<T>::MonotoneToTriangles::decompose()
QTriangleSet qTriangulate(const qreal *polygon,
int count, uint hint, const QTransform &matrix)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QTriangleSet triangleSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(polygon, count, hint, matrix);
QVertexSet<quint32> vertexSet = triangulator.triangulate();
@@ -3037,10 +3034,8 @@ QTriangleSet qTriangulate(const qreal *polygon,
QTriangleSet qTriangulate(const QVectorPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QTriangleSet triangleSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.triangulate();
@@ -3059,10 +3054,8 @@ QTriangleSet qTriangulate(const QVectorPath &path,
QTriangleSet qTriangulate(const QPainterPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QTriangleSet triangleSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.triangulate();
@@ -3081,10 +3074,8 @@ QTriangleSet qTriangulate(const QPainterPath &path,
QPolylineSet qPolyline(const QVectorPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QPolylineSet polyLineSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.polyline();
@@ -3103,10 +3094,8 @@ QPolylineSet qPolyline(const QVectorPath &path,
QPolylineSet qPolyline(const QPainterPath &path,
const QTransform &matrix, qreal lod)
{
- QGLContext *ctx = 0; // Not really used but needs to be introduced for glSupportsElementIndexUint
-
QPolylineSet polyLineSet;
- if (glSupportsElementIndexUint) {
+ if (QGLExtensions::glExtensions() & QGLExtensions::ElementIndexUint) {
QTriangulator<quint32> triangulator;
triangulator.initialize(path, matrix, lod);
QVertexSet<quint32> vertexSet = triangulator.polyline();