add font rendering
authorDerek Foreman <manmower@gmail.com>
Fri, 30 May 2003 04:41:59 +0000 (04:41 +0000)
committerDerek Foreman <manmower@gmail.com>
Fri, 30 May 2003 04:41:59 +0000 (04:41 +0000)
render2/planar.c

index 62684e47da1105dbff3b42c76692b30f95613f7a..d1c8b9108ba52c3a350d9f7a90759b0513cd5dfb 100644 (file)
@@ -1,7 +1,11 @@
 #include "planar.h"
 #include "surface.h"
+#include "texture.h"
+#include "glft/glft.h"
 #include "color.h"
 #include "debug.h"
+#include "font.h"
+#include <string.h>
 #include <GL/glx.h>
 
 void RrPlanarSet(struct RrSurface *sur,
@@ -67,6 +71,7 @@ void RrPlanarPaint(struct RrSurface *sur, int absx, int absy)
 {   
     struct RrColor *pri, *sec, avg;
     int x, y, w, h;
+    int i;
 
     copy_parent(sur);
 
@@ -284,6 +289,25 @@ void RrPlanarPaint(struct RrSurface *sur, int absx, int absy)
         glEnd();
         break;
     }
+    for (i = 0; i < sur->ntextures; i++) {
+        struct RrTextureText *t;
+        glEnable(GL_TEXTURE_2D);
+        switch (sur->texture[i].type) {
+        case RR_TEXTURE_TEXT:
+            t = &sur->texture[i].data.text;
+            printf("text %s\n", t->string);
+            glColor3f(1.0, 1.0, 1.0);
+            if (t->font == NULL) {
+                glDisable(GL_TEXTURE_2D);
+                return;
+            }
+            GlftRenderString(t->font->font, t->string, 
+                             strlen(t->string), 0, 0);
+
+        break;
+        }
+    }
+    glDisable(GL_TEXTURE_2D);
 }
 
 void RrPlanarMinSize(struct RrSurface *sur, int *w, int *h)