]> git.tdb.fi Git - libs/gl.git/commitdiff
Add scissor, stencil, alpha and depth test functions and constants
authorMikko Rasa <tdb@tdb.fi>
Sat, 20 Oct 2007 10:50:51 +0000 (10:50 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 20 Oct 2007 10:50:51 +0000 (10:50 +0000)
source/predicate.h [new file with mode: 0644]
source/stencil.cpp [new file with mode: 0644]
source/stencil.h [new file with mode: 0644]
source/tests.cpp [new file with mode: 0644]
source/tests.h [new file with mode: 0644]

diff --git a/source/predicate.h b/source/predicate.h
new file mode 100644 (file)
index 0000000..f5ff3b3
--- /dev/null
@@ -0,0 +1,31 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_PREDICATE_H_
+#define MSP_GL_PREDICATE_H_
+
+#include <GL/gl.h>
+
+namespace Msp {
+namespace GL {
+
+enum Predicate
+{
+       NEVER    = GL_NEVER,
+       ALWAYS   = GL_ALWAYS,
+       LESS     = GL_LESS,
+       LEQUAL   = GL_LEQUAL,
+       EQUAL    = GL_EQUAL,
+       GREATER  = GL_GREATER,
+       GEQUAL   = GL_GEQUAL,
+       NOTEQUAL = GL_NOTEQUAL
+};
+
+} // namespace GL
+} // namespace Msp
+
+#endif
diff --git a/source/stencil.cpp b/source/stencil.cpp
new file mode 100644 (file)
index 0000000..a050631
--- /dev/null
@@ -0,0 +1,24 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "stencil.h"
+
+namespace Msp {
+namespace GL {
+
+void stencil_func(Predicate func, int ref, uint mask)
+{
+       glStencilFunc(func, ref, mask);
+}
+
+void stencil_op(StencilOp sfail, StencilOp dfail, StencilOp dpass)
+{
+       glStencilOp(sfail, dfail, dpass);
+}
+
+} // namespace GL
+} // namespace Msp
diff --git a/source/stencil.h b/source/stencil.h
new file mode 100644 (file)
index 0000000..6efb057
--- /dev/null
@@ -0,0 +1,41 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_STENCIL_H_
+#define MSP_GL_STENCIL_H_
+
+#include <GL/gl.h>
+#include "predicate.h"
+#include "types.h"
+
+namespace Msp {
+namespace GL {
+
+enum
+{
+       STENCIL_TEST = GL_STENCIL_TEST
+};
+
+enum StencilOp
+{
+       KEEP      = GL_KEEP,
+       SET_ZERO  = GL_ZERO,
+       REPLACE   = GL_REPLACE,
+       INCR      = GL_INCR,
+       DECR      = GL_DECR,
+       INVERT    = GL_INVERT,
+       INCR_WRAP = GL_INCR_WRAP,
+       DECR_WRAP = GL_DECR_WRAP
+};
+
+void stencil_func(Predicate func, int ref, uint mask);
+void stencil_op(StencilOp sfail, StencilOp dfail, StencilOp dpass);
+
+} // namespace GL
+} // namespace Msp
+
+#endif
diff --git a/source/tests.cpp b/source/tests.cpp
new file mode 100644 (file)
index 0000000..a744006
--- /dev/null
@@ -0,0 +1,29 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "tests.h"
+
+namespace Msp {
+namespace GL {
+
+void scissor(int left, int bottom, sizei width, sizei height)
+{
+       glScissor(left, bottom, width, height);
+}
+
+void alpha_func(Predicate func, float ref)
+{
+       glAlphaFunc(func, ref);
+}
+
+void depth_func(Predicate func)
+{
+       glDepthFunc(func);
+}
+
+} // namespace GL
+} // namespace Msp
diff --git a/source/tests.h b/source/tests.h
new file mode 100644 (file)
index 0000000..0fa05b4
--- /dev/null
@@ -0,0 +1,34 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2007  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#ifndef MSP_GL_TESTS_H_
+#define MSP_GL_TESTS_H_
+
+#include <GL/gl.h>
+#include "predicate.h"
+#include "types.h"
+
+namespace Msp {
+namespace GL {
+
+enum
+{
+       SCISSOR_TEST = GL_SCISSOR_TEST,
+       ALPHA_TEST   = GL_ALPHA_TEST,
+       DEPTH_TEST   = GL_DEPTH_TEST
+};
+
+void scissor(int left, int bottom, sizei width, sizei height);
+
+void alpha_func(Predicate func, float ref);
+
+void depth_func(Predicate func);
+
+} // namespace GL
+} // namespace Msp
+
+#endif