+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2011 Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef WINDINGTEST_H_
+#define WINDINGTEST_H_
+
+#include <msp/strings/lexicalcast.h>
+#include "bindable.h"
+#include "gl.h"
+
+namespace Msp {
+namespace GL {
+
+enum FaceWinding
+{
+ CLOCKWISE = GL_CW,
+ COUNTERCLOCKWISE = GL_CCW
+};
+
+void operator>>(const LexicalConverter &, FaceWinding &);
+
+/**
+Tests the winding of polygons. If the order of vertices on screen does not
+match the winding, the polygon is not rendered.
+*/
+class WindingTest: public Bindable<WindingTest>
+{
+private:
+ bool test;
+ FaceWinding winding;
+
+public:
+ WindingTest();
+ WindingTest(FaceWinding);
+
+ void bind() const;
+
+ static void unbind();
+
+ static WindingTest &clockwise();
+ static WindingTest &counterclockwise();
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif