]> git.tdb.fi Git - libs/gl.git/blobdiff - source/clip.cpp
Add blending and clipping support
[libs/gl.git] / source / clip.cpp
diff --git a/source/clip.cpp b/source/clip.cpp
new file mode 100644 (file)
index 0000000..ca1b742
--- /dev/null
@@ -0,0 +1,34 @@
+/* $Id$
+
+This file is part of libmspgl
+Copyright © 2008  Mikko Rasa, Mikkosoft Productions
+Distributed under the LGPL
+*/
+
+#include "clip.h"
+#include "gl.h"
+
+namespace Msp {
+namespace GL {
+
+ClipPlane::ClipPlane(double a, double b, double c, double d)
+{
+       eq[0]=a;
+       eq[1]=b;
+       eq[2]=c;
+       eq[3]=d;
+}
+
+void ClipPlane::apply_to(unsigned n)
+{
+       glClipPlane(GL_CLIP_PLANE0+n, eq);
+       glEnable(GL_CLIP_PLANE0+n);
+}
+
+void ClipPlane::disable(unsigned n)
+{
+       glDisable(GL_CLIP_PLANE0+n);
+}
+
+} // namespace GL
+} // namespace Msp