questionable patch: merge of a lot of stuff from the svg branch
[org.ibex.core.git] / src / org / ibex / plat / OpenGL.cc
index 1f79649..9e53586 100644 (file)
@@ -4,6 +4,8 @@
 // IMPROVMENT: use alpha testing? might be faster
 
 #include <org/ibex/plat/OpenGL.h>
+#include <org/ibex/graphics/PixelBuffer.h>
+#include <org/ibex/graphics/Polygon.h>
 #include <org/ibex/plat/OpenGL$GLPixelBuffer.h>
 #include <org/ibex/plat/OpenGL$GLPicture.h>
 #include <org/ibex/plat/OpenGL$RectGLPicture.h>
@@ -99,6 +101,18 @@ void OpenGL$GLPixelBuffer::fillTrapezoid(jint x1, jint x2, jint y1, jint x3, jin
     } glEnd();
 }
 
+void OpenGL$GLPixelBuffer::natFill(org::ibex::graphics::Polygon* p, jint argb) {
+    activateContext();
+    setColor(argb);
+    for(jint contour=0; contour < p->numcontours; contour++) {
+        glBegin(GL_POLYGON); {
+        for(jint i = elements(p->contours)[contour]; i < elements(p->contours)[contour+1]; i++) {
+            glVertex3f(elements(p->x)[i], elements(p->y)[i], 0.0f );   
+        } glEnd();
+        }
+    }
+}
+
 void OpenGL$GLPixelBuffer::setClip(jint x1, jint y1, jint x2, jint y2) {
     //fprintf(stderr,"setClip: %d %d %d %d\n",x1,y1,x2,y2);
     if(x1==0 && y1==0 && x2==width && y2==height) {