let's hear it for conics!
authorDerek Foreman <manmower@gmail.com>
Thu, 29 May 2003 01:52:53 +0000 (01:52 +0000)
committerDerek Foreman <manmower@gmail.com>
Thu, 29 May 2003 01:52:53 +0000 (01:52 +0000)
glft/render.c

index 22297e0ffc52cc286a4aa627359d80bda37101a4..24e2245afd2de071c9eea0b118d5ffd66d95b6a7 100644 (file)
@@ -4,7 +4,7 @@
 #include <glib.h>
 #include <GL/glx.h>
 
-#define TPOINTS 15.0
+#define TPOINTS 5.0
 
 #define TOFLOAT(x) (((x) >> 6) + ((x) & 63)/64.0)
 
@@ -24,23 +24,19 @@ int GlftMoveToFunc(FT_Vector *to, void *user)
     printf("move to %f:%f\n", state.x, state.y);
     if (state.drawing) {
         glEnd();
-        state.drawing = 0;
     }
+    glBegin(GL_LINE_STRIP);
+    glVertex2f(state.x, state.y);
+    state.drawing = 1;
     return 0;
 }
 
 int GlftLineToFunc(FT_Vector *to, void *user)
 {
-    if (!state.drawing) {
-        glBegin(GL_LINES);
-        glVertex2f(state.x, state.y);
-        state.drawing = 1;
-    } else
-        glVertex2f(state.x, state.y);
     state.x = TOFLOAT(to->x);
     state.y = TOFLOAT(to->y);
-    printf("line to %f:%f\n", state.x, state.y);
     glVertex2f(state.x, state.y);
+    printf("line to %f:%f\n", state.x, state.y);
     return 0;
 }
 
@@ -51,11 +47,11 @@ int GlftConicToFunc(FT_Vector *c, FT_Vector *to, void *user)
     for (t = 0, u = 1; t < 1.0; t += 1.0/TPOINTS, u = 1.0-t) {
         x = u*u*state.x + 2*t*u*TOFLOAT(c->x) + t*t*TOFLOAT(to->x);
         y = u*u*state.y + 2*t*u*TOFLOAT(c->y) + t*t*TOFLOAT(to->y);
-/*printf("cone to %f, %f (%f, %f)\n", x, y, t, u);*/
         glVertex2f(x, y);
     }
     state.x = TOFLOAT(to->x);
     state.y = TOFLOAT(to->y);
+    glVertex2f(state.x, state.y);
     printf("conic the hedgehog!\n");
     return 0;
 }