From 6b5c20bc835c375e8745c6c154485f1a763a8ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 7 Sep 2012 01:21:38 +0200 Subject: [PATCH] Grouped global mesh settings together. --- src/Mesh.h | 96 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/src/Mesh.h b/src/Mesh.h index e02b026c1..690612fb3 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -51,6 +51,8 @@ class MAGNUM_EXPORT Mesh { Mesh& operator=(const Mesh& other) = delete; public: + /** @name Polygon drawing settings */ + #ifndef MAGNUM_TARGET_GLES /** * @brief Polygon mode @@ -77,6 +79,54 @@ class MAGNUM_EXPORT Mesh { }; #endif + #ifndef MAGNUM_TARGET_GLES + /** + * @brief Set polygon drawing mode + * + * Initial value is PolygonMode::Fill. + * @requires_gl + */ + inline static void setPolygonMode(PolygonMode mode) { + glPolygonMode(GL_FRONT_AND_BACK, static_cast(mode)); + } + #endif + + /** + * @brief Set line width + * + * Initial value is 1. + */ + inline static void setLineWidth(GLfloat width) { + glLineWidth(width); + } + + #ifndef MAGNUM_TARGET_GLES + /** + * @brief Set point size + * + * @see setProgramPointSize() + * @requires_gl Set directly in vertex shader using @c gl_PointSize + * builtin variable. + */ + inline static void setPointSize(GLfloat size) { + glPointSize(size); + } + + /** + * @brief Enable/disable programmable point size + * + * If enabled, the point size is taken from vertex/geometry shader + * builtin `gl_PointSize`. + * @see setPointSize() + * @requires_gl Always enabled. + */ + inline static void setProgramPointSize(bool enabled) { + enabled ? glEnable(GL_PROGRAM_POINT_SIZE) : glDisable(GL_PROGRAM_POINT_SIZE); + } + #endif + + /*@}*/ + /** * @brief Primitive type * @@ -136,52 +186,6 @@ class MAGNUM_EXPORT Mesh { NonInterleaved /**< Non-interleaved buffer */ }; - #ifndef MAGNUM_TARGET_GLES - /** - * @brief Set polygon drawing mode - * - * Initial value is PolygonMode::Fill. - * @requires_gl - */ - inline static void setPolygonMode(PolygonMode mode) { - glPolygonMode(GL_FRONT_AND_BACK, static_cast(mode)); - } - #endif - - /** - * @brief Set line width - * - * Initial value is 1. - */ - inline static void setLineWidth(GLfloat width) { - glLineWidth(width); - } - - #ifndef MAGNUM_TARGET_GLES - /** - * @brief Set point size - * - * @see setProgramPointSize() - * @requires_gl Set directly in vertex shader using @c gl_PointSize - * builtin variable. - */ - inline static void setPointSize(GLfloat size) { - glPointSize(size); - } - - /** - * @brief Enable/disable programmable point size - * - * If enabled, the point size is taken from vertex/geometry shader - * builtin `gl_PointSize`. - * @see setPointSize() - * @requires_gl Always enabled. - */ - inline static void setProgramPointSize(bool enabled) { - enabled ? glEnable(GL_PROGRAM_POINT_SIZE) : glDisable(GL_PROGRAM_POINT_SIZE); - } - #endif - /** * @brief Implicit constructor * @param primitive Primitive type