From 2f595c910fbaeddef083332c3432fc5040a77b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 8 Apr 2012 23:12:24 +0200 Subject: [PATCH] Added functions to set polygon mode, line width and point size to Mesh. --- src/Mesh.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/Mesh.h b/src/Mesh.h index b762c5ebe..7b4a9400b 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -43,6 +43,25 @@ class MAGNUM_EXPORT Mesh { Mesh& operator=(Mesh&& other) = delete; public: + /** @brief Polygon mode */ + enum class PolygonMode: GLenum { + /** + * Interior of the polygon is filled. + */ + Fill = GL_FILL, + + /** + * Boundary edges are filled. See also setLineWidth(). + */ + Line = GL_LINE, + + /** + * Starts of boundary edges are drawn as points. See also + * setPointSize(). + */ + Point = GL_POINT + }; + /** @brief Primitive type */ enum class Primitive: GLenum { /** @@ -84,6 +103,29 @@ class MAGNUM_EXPORT Mesh { TriangleFan = GL_TRIANGLE_FAN }; + /** + * @brief Set polygon drawing mode + * + * Initial value is PolygonMode::Fill. + */ + inline static void setPolygonMode(PolygonMode mode) { + glPolygonMode(GL_FRONT_AND_BACK, static_cast(mode)); + } + + /** + * @brief Set line width + * + * Initial value is 1. + */ + inline static void setLineWidth(GLfloat width) { + glLineWidth(width); + } + + /** @brief Set point size */ + inline static void setPointSize(GLfloat size) { + glPointSize(size); + } + /** * @brief Implicit constructor * @param primitive Primitive type