From fd1ae3f775a9fb0d72715b03f594f9bdde056756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 7 Sep 2012 02:25:09 +0200 Subject: [PATCH] Mesh: added support for provoking vertex selection. --- src/Mesh.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/Mesh.h b/src/Mesh.h index 79862c109..532902454 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -39,7 +39,6 @@ VAOs are used for desktop OpenGL (not in OpenGL ES). @todo Support for normalized values (e.g. for color as char[4] passed to shader as floating-point vec4) -@todo Support for provoking vertex (OpenGL 3.2, @extension{ARB,provoking_vertex}) @todo Support for packed unsigned integer types for attributes (OpenGL 3.3, @extension{ARB,vertex_type_2_10_10_10_rev}) @todo Support for fixed precision type for attributes (OpenGL 4.1, @extension{ARB,ES2_compatibility}) @todo Support for double type for attributes (OpenGL 4.1, @extension{ARB,vertex_attrib_64bit}) @@ -53,6 +52,36 @@ class MAGNUM_EXPORT Mesh { public: /** @name Polygon drawing settings */ + /** + * @brief Provoking vertex + * + * @see setProvokingVertex() + * @requires_gl OpenGL ES behaves always like + * ProvokingMode::%LastVertexConvention. + * @requires_gl32 Extension @extension{ARB,provoking_vertex}. Older + * versions behave always like + * ProvokingMode::%LastVertexConvention. + */ + enum class ProvokingVertex: GLenum { + /** @brief Use first vertex of each polygon. */ + FirstVertexConvention = GL_FIRST_VERTEX_CONVENTION, + + /** @brief Use last vertex of each polygon (default). */ + LastVertexConvention = GL_LAST_VERTEX_CONVENTION + }; + + /** + * @brief Set provoking vertex + * + * Initial value is ProvokingMode::%LastVertexConvention. + * @requires_gl OpenGL ES behaves always like the default. + * @requires_gl32 Extension @extension{ARB,provoking_vertex}. Older + * versions behave always like the default. + */ + inline static void setProvokingVertex(ProvokingVertex mode) { + glProvokingVertex(static_cast(mode)); + } + #ifndef MAGNUM_TARGET_GLES /** * @brief Polygon mode