]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/predicate.cpp
Decouple the Predicate enum from OpenGL constants
[libs/gl.git] / source / core / predicate.cpp
index a1953733c676d3ccac0f449db4d9ce3c749dba4f..4afc6c0343ca89166283c6f3268c1bc9880c9d4f 100644 (file)
@@ -6,6 +6,22 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
+GLenum get_gl_predicate(Predicate pred)
+{
+       switch(pred)
+       {
+       case NEVER: return GL_NEVER;
+       case ALWAYS: return GL_ALWAYS;
+       case LESS: return GL_LESS;
+       case LEQUAL: return GL_LEQUAL;
+       case EQUAL: return GL_EQUAL;
+       case GREATER: return GL_GREATER;
+       case GEQUAL: return GL_GEQUAL;
+       case NOTEQUAL: return GL_NOTEQUAL;
+       default: throw invalid_argument("get_gl_predicate");
+       }
+}
+
 void operator>>(const LexicalConverter &conv, Predicate &pred)
 {
        const string &str = conv.get();