From: erg Date: Wed, 24 Jun 2009 22:19:05 +0000 (+0000) Subject: Add text functions that use the z coordinate. We need something like X-Git-Tag: LAST_LIBGRAPH~32^2~1879 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26bf53ef9afe65e2b4c7f170a39c372851371735;p=graphviz Add text functions that use the z coordinate. We need something like this to prevent text from being occluded in 2D views of 3D graphs. --- diff --git a/lib/glcomp/glcomptext.c b/lib/glcomp/glcomptext.c index fc467654e..18da0a243 100644 --- a/lib/glcomp/glcomptext.c +++ b/lib/glcomp/glcomptext.c @@ -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); +} diff --git a/lib/glcomp/glcomptext.h b/lib/glcomp/glcomptext.h index 2de9ff824..1243563e0 100644 --- a/lib/glcomp/glcomptext.h +++ b/lib/glcomp/glcomptext.h @@ -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);