]> granicus.if.org Git - graphviz/commitdiff
Add text functions that use the z coordinate. We need something like
authorerg <devnull@localhost>
Wed, 24 Jun 2009 22:19:05 +0000 (22:19 +0000)
committererg <devnull@localhost>
Wed, 24 Jun 2009 22:19:05 +0000 (22:19 +0000)
this to prevent text from being occluded in 2D views of 3D graphs.

lib/glcomp/glcomptext.c
lib/glcomp/glcomptext.h

index fc467654e5ba7c06d59dbaf8f550a07b9bcba31a..18da0a243be8b84f9f78a5bf09f91046d60b484a 100644 (file)
@@ -83,11 +83,17 @@ void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, char *bf)
          print_bitmap_string(font,bf); 
 }
 
+void glprintfglutz (void* font, GLfloat xpos, GLfloat ypos, GLfloat zpos, char *bf)
+{
+       glRasterPos3f(xpos,ypos,zpos+0.01);
+         print_bitmap_string(font,bf); 
+}
 
 
-void 
-glprintf (glCompText* font, GLfloat xpos, GLfloat ypos, 
-    GLfloat width, char *bf)
+
+static void 
+glPrintf (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
+    GLfloat width, char *bf, int usez)
 {
 
        int vPort[4];
@@ -106,7 +112,10 @@ glprintf (glCompText* font, GLfloat xpos, GLfloat ypos,
                return;
        if (font->isglut)
        {
-               glprintfglut (font->glutfont, xpos,ypos,bf);
+               if (usez)
+                       glprintfglutz (font->glutfont, xpos,ypos,zpos,bf);
+               else
+                       glprintfglut (font->glutfont, xpos,ypos,bf);
                return;
        }
 
@@ -161,7 +170,18 @@ glprintf (glCompText* font, GLfloat xpos, GLfloat ypos,
        restore_gl_vars(font);
 }
 
+void 
+glprintf (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat width, char *bf)
+{
+       glPrintf (font, xpos, ypos, 0, width, bf, 0);
+}
 
+void 
+glprintfz (glCompText* font, GLfloat xpos, GLfloat ypos, GLfloat zpos,
+    GLfloat width, char *bf)
+{
+       glPrintf (font, xpos, ypos, zpos, width, bf, 0);
+}
 
 
 
index 2de9ff824292ad168652827c1b76133075f2852a..1243563e0dc1380a974e748f7415e961add50d1f 100644 (file)
@@ -35,6 +35,8 @@ extern glCompText* add_font(fontset_t* fontset,char* fontdesc);
 extern glCompText* add_glut_font(fontset_t* fontset,void* glutfont);
 extern void glprintf (glCompText*, GLfloat , GLfloat , GLfloat, char*);
 extern void glprintfglut (void* font, GLfloat xpos, GLfloat ypos, char *bf);
+extern void glprintfz (glCompText*, GLfloat , GLfloat , GLfloat, GLfloat, char*);
+extern void glprintfglutz (void* font, GLfloat xpos, GLfloat ypos, GLfloat, char *bf);
 
 extern glCompText* font_init(void);
 extern void fontColor (glCompText* font,float r, float g, float b,float a);