Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

glf.h File Reference

Go to the source code of this file.

Defines

#define GLF_ERROR   -1
#define GLF_OK   0
#define GLF_YES   1
#define GLF_NO   2
#define GLF_CONSOLE_MESSAGES   10
#define GLF_TEXTURING   11
#define GLF_CONTOURING   12
#define GLF_LEFT_UP   20
#define GLF_LEFT_CENTER   21
#define GLF_LEFT_DOWN   22
#define GLF_CENTER_UP   23
#define GLF_CENTER_CENTER   24
#define GLF_CENTER_DOWN   25
#define GLF_RIGHT_UP   26
#define GLF_RIGHT_CENTER   27
#define GLF_RIGHT_DOWN   28
#define GLF_CENTER   24
#define GLF_LEFT   1
#define GLF_RIGHT   2
#define GLF_UP   3
#define GLF_DOWN   4
#define GLF_CONSOLE_CURSOR   30

Functions

void glfInit ()
void glfClose ()
int glfLoadFont (char *font_name)
int glfLoadBMFFont (char *FName)
int glfUnloadFont ()
int glfUnloadBMFFont ()
int glfUnloadFontD (int font_descriptor)
int glfUnloadBMFFontD (int bmf_descriptor)
void glfDrawWiredSymbol (char s)
void glfDrawWiredString (char *s)
void glfDrawSolidSymbol (char s)
void glfDrawSolidString (char *s)
void glfDraw3DWiredSymbol (char s)
void glfDraw3DWiredString (char *s)
void glfDraw3DSolidSymbol (char s)
void glfDraw3DSolidString (char *s)
void glfStartBitmapDrawing ()
void glfStopBitmapDrawing ()
void glfDrawBSymbol (char s)
void glfDrawBString (char *s)
void glfDrawBMaskSymbol (char s)
void glfDrawBMaskString (char *s)
void glfDrawWiredSymbolF (int font_descriptor, char s)
void glfDrawWiredStringF (int font_descriptor, char *s)
void glfDrawSolidSymbolF (int font_descriptor, char s)
void glfDrawSolidStringF (int font_descriptor, char *s)
void glfDraw3DWiredSymbolF (int font_descriptor, char s)
void glfDraw3DWiredStringF (int font_descriptor, char *s)
void glfDraw3DSolidSymbolF (int font_descriptor, char s)
void glfDraw3DSolidStringF (int font_descriptor, char *s)
void glfGetStringBoundsF (int fd, char *s, float *minx, float *miny, float *maxx, float *maxy)
void glfGetStringBounds (char *s, float *minx, float *miny, float *maxx, float *maxy)
void glfSetSymbolSpace (float sp)
float glfGetSymbolSpace ()
void glfSetSpaceSize (float sp)
float glfGetSpaceSize ()
void glfSetSymbolDepth (float dpth)
float glfGetSymbolDepth ()
int glfSetCurrentFont (int Font_Descriptor)
int glfSetCurrentBMFFont (int Font_Descriptor)
int glfGetCurrentFont ()
int glfGetCurrentBMFFont ()
void glfSetAnchorPoint (int anchp)
void glfSetContourColor (float r, float g, float b, float a)
void glfEnable (int what)
void glfDisable (int what)
void glfSetConsoleParam (int width, int height)
int glfSetConsoleFont (int Font_Descriptor)
void glfConsoleClear ()
void glfPrint (char *s, int lenght)
void glfPrintString (char *s)
void glfPrintChar (char s)
void glfConsoleDraw ()
void glfSetCursorBlinkRate (int Rate)
void glfStringCentering (GLboolean center)
GLboolean glfGetStringCentering ()
void glfBitmapStringCentering (GLboolean center)
GLboolean glfBitmapGetStringCentering ()
void glfStringDirection (GLuint direction)
GLuint glfGetStringDirection ()
void glfSetRotateAngle (float angle)
void glfSetBRotateAngle (float angle)


Define Documentation

#define GLF_CENTER   24
 

Definition at line 47 of file glf.h.

Referenced by glfInit().

#define GLF_CENTER_CENTER   24
 

Definition at line 42 of file glf.h.

#define GLF_CENTER_DOWN   25
 

Definition at line 43 of file glf.h.

#define GLF_CENTER_UP   23
 

Definition at line 41 of file glf.h.

#define GLF_CONSOLE_CURSOR   30
 

Definition at line 55 of file glf.h.

Referenced by glfDisable(), glfEnable(), and glfInit().

#define GLF_CONSOLE_MESSAGES   10
 

Definition at line 34 of file glf.h.

Referenced by glfDisable(), and glfEnable().

#define GLF_CONTOURING   12
 

Definition at line 36 of file glf.h.

Referenced by glfDisable(), and glfEnable().

#define GLF_DOWN   4
 

Definition at line 52 of file glf.h.

Referenced by DrawString(), and glfStringDirection().

#define GLF_ERROR   -1
 

Definition at line 29 of file glf.h.

Referenced by glfLoadBMFFont(), glfLoadFont(), glfSetConsoleFont(), glfSetCurrentBMFFont(), glfSetCurrentFont(), glfUnloadBMFFontD(), glfUnloadFont(), glfUnloadFontD(), and ReadFont().

#define GLF_LEFT   1
 

Definition at line 49 of file glf.h.

Referenced by DrawString(), glfInit(), and glfStringDirection().

#define GLF_LEFT_CENTER   21
 

Definition at line 39 of file glf.h.

#define GLF_LEFT_DOWN   22
 

Definition at line 40 of file glf.h.

#define GLF_LEFT_UP   20
 

Definition at line 38 of file glf.h.

Referenced by glfSetAnchorPoint().

#define GLF_NO   2
 

Definition at line 32 of file glf.h.

Referenced by glfConsoleDraw(), glfDisable(), and glfInit().

#define GLF_OK   0
 

Definition at line 30 of file glf.h.

Referenced by glfLoadFont(), glfSetConsoleFont(), glfSetCurrentBMFFont(), glfSetCurrentFont(), glfUnloadBMFFontD(), glfUnloadFont(), glfUnloadFontD(), and ReadFont().

#define GLF_RIGHT   2
 

Definition at line 50 of file glf.h.

Referenced by DrawString(), and glfStringDirection().

#define GLF_RIGHT_CENTER   27
 

Definition at line 45 of file glf.h.

#define GLF_RIGHT_DOWN   28
 

Definition at line 46 of file glf.h.

Referenced by glfSetAnchorPoint().

#define GLF_RIGHT_UP   26
 

Definition at line 44 of file glf.h.

#define GLF_TEXTURING   11
 

Definition at line 35 of file glf.h.

Referenced by glfDisable(), and glfEnable().

#define GLF_UP   3
 

Definition at line 51 of file glf.h.

Referenced by DrawString(), and glfStringDirection().

#define GLF_YES   1
 

Definition at line 31 of file glf.h.

Referenced by glfConsoleDraw(), glfDraw3DSolidSymbol(), glfDrawSolidSymbol(), glfEnable(), and glfSetCursorBlinkRate().


Function Documentation

GLboolean glfBitmapGetStringCentering  ) 
 

Definition at line 1723 of file glf.cxx.

References m_bitmap_string_center.

01724 {
01725         return m_bitmap_string_center;
01726 }

void glfBitmapStringCentering GLboolean  center  ) 
 

Definition at line 1717 of file glf.cxx.

References m_bitmap_string_center.

Referenced by glfInit().

01718 {
01719         m_bitmap_string_center = center;
01720 }

void glfClose  ) 
 

Definition at line 159 of file glf.cxx.

References conData, glfUnloadBMFFontD(), glfUnloadFontD(), and MAX_FONTS.

00160 {
00161         int i;
00162         
00163         free(conData);
00164 
00165         for (i=0; i<MAX_FONTS; i++) glfUnloadFontD(i);
00166         for (i=0; i<MAX_FONTS; i++) glfUnloadBMFFontD(i);
00167 }

void glfConsoleClear  ) 
 

Definition at line 1012 of file glf.cxx.

References conData, conHeight, conWidth, and conx.

Referenced by glfInit(), and glfSetConsoleParam().

01013 {
01014         memset(conData, 0, conWidth*conHeight);
01015         conx = 0;
01016         cony = 0;
01017 }

void glfConsoleDraw  ) 
 

Definition at line 1057 of file glf.cxx.

References conCursor, conCursorBlink, conCursorCount, conCursorMode, conData, conFont, conHeight, conWidth, GLF_NO, GLF_YES, glfDrawSolidStringF(), and s().

01058 {
01059         int i, j;
01060         char s[512];
01061 
01062         for (i=0; i<conHeight; i++)
01063         {
01064                 memcpy(s, &conData[i*conWidth], conWidth);
01065                 s[conWidth] = 0;
01066                 if ((conCursor == GLF_YES) && (i == cony))
01067                 {
01068                         conCursorCount--;
01069                         if (conCursorCount < 0)
01070                         {
01071                                 conCursorCount = conCursorBlink;
01072                                 if (conCursorMode == GLF_YES) conCursorMode = GLF_NO;
01073                                 else conCursorMode = GLF_YES;
01074                         }
01075 
01076                         if (conCursorMode == GLF_YES)
01077                         for (j=0; j<conWidth; j++)
01078                         {
01079                                 if (!s[j])
01080                                 {
01081                                         s[j] = '_'; /* Draw cursor */
01082                                         s[j+1] = 0;
01083                                         break;
01084                                 }
01085                         }
01086                 }
01087                 glfDrawSolidStringF(conFont, s);
01088                 glTranslatef(0, -2, 0);
01089         }
01090 }

void glfDisable int  what  ) 
 

Definition at line 981 of file glf.cxx.

References conCursor, console_msg, contouring, GLF_CONSOLE_CURSOR, GLF_CONSOLE_MESSAGES, GLF_CONTOURING, GLF_NO, GLF_TEXTURING, and texturing.

00982 {
00983         switch (what) 
00984         {
00985                 case GLF_CONSOLE_MESSAGES: console_msg = GLF_NO; break;
00986                 case GLF_TEXTURING: texturing = GLF_NO; break;
00987                 case GLF_CONSOLE_CURSOR: conCursor = GLF_NO; break;
00988                 case GLF_CONTOURING: contouring = GLF_NO; break;
00989         }
00990 }

void glfDraw3DSolidString char *  s  ) 
 

Definition at line 839 of file glf.cxx.

References DrawString(), glfDraw3DSolidSymbol(), and s().

Referenced by TridSketchText::DrawSelf().

00840 {
00841         DrawString(s, &glfDraw3DSolidSymbol);
00842 }

void glfDraw3DSolidStringF int  font_descriptor,
char *  s
 

Definition at line 845 of file glf.cxx.

References curfont, DrawString(), glfDraw3DSolidSymbol(), and s().

00846 {
00847         int temp;
00848 
00849         temp = curfont;
00850         curfont = font_descriptor;
00851         DrawString(s, &glfDraw3DSolidSymbol);
00852         curfont = temp;
00853 }

void glfDraw3DSolidSymbol char  s  ) 
 

Definition at line 735 of file glf.cxx.

References color::a, color::b, contouring, contouring_color, curfont, fonts, color::g, GLF_YES, glfDraw3DWiredSymbol(), color::r, s(), and SymbolDepth.

Referenced by glfDraw3DSolidString(), glfDraw3DSolidStringF(), and glfDraw3DSolidSymbolF().

00736 {
00737         int i, j, cur_line, flag;
00738         float x, y, bx=0, by=0;
00739         unsigned char *b; /* Face pointer   */
00740         float *vp;        /* Vertex pointer */
00741         float *tvp;       /* temp vertex pointer */
00742         float temp_color[4];
00743         GLboolean light_temp;
00744   
00745         if ((curfont<0) || (fonts[curfont] == NULL)) return;
00746         if (fonts[curfont]->symbols[(int)s] == NULL) return;
00747 
00748         b = fonts[curfont]->symbols[(int)s]->fdata;
00749         vp = fonts[curfont]->symbols[(int)s]->vdata;
00750 
00751         glBegin(GL_TRIANGLES);   
00752         glNormal3f(0, 0, 1);
00753         for (i=0; i<fonts[curfont]->symbols[(int)s]->facets; i++)
00754         {
00755                 b += 2;
00756                 for (j=0; j<3; j++)
00757                 {
00758                         x = vp[*b*2];
00759                         y = vp[*b*2+1];
00760                         glVertex3f(x, y, 1+SymbolDepth);
00761                         b--;
00762                 }
00763                 b += 4;
00764         }
00765         glEnd();
00766 
00767         b = fonts[curfont]->symbols[(int)s]->fdata;
00768         vp = fonts[curfont]->symbols[(int)s]->vdata;
00769   
00770         glBegin(GL_TRIANGLES);   
00771         glNormal3f(0, 0, -1);
00772         for (i=0; i<fonts[curfont]->symbols[(int)s]->facets; i++)
00773         {
00774                 for (j=0; j<3; j++)
00775                 {
00776                         x = vp[*b*2];
00777                         y = vp[*b*2+1];
00778                         glVertex3f(x, y, 1);
00779                         b++;
00780                 }
00781         }
00782         glEnd();
00783 
00784         flag = 0;
00785         glBegin(GL_QUAD_STRIP);
00786         tvp = fonts[curfont]->symbols[(int)s]->vdata;
00787         cur_line = 0;
00788         for (i=0; i<fonts[curfont]->symbols[(int)s]->vertexs; i++)
00789         {
00790                 x = *tvp;
00791                 tvp++;
00792                 y = *tvp;
00793                 tvp++;
00794                 if (!flag) 
00795                 {
00796                         bx = x;
00797                         by = y;
00798                         flag = 1;
00799                 }
00800                 glNormal3f(x, y, 0);
00801                 glVertex3f(x, y, 1);
00802                 glVertex3f(x, y, 1+SymbolDepth);
00803                 if (fonts[curfont]->symbols[(int)s]->ldata[cur_line] == i)
00804                 {
00805                         glVertex3f(bx, by, 1);
00806                         glVertex3f(bx, by, 1+SymbolDepth);
00807                         flag = 0;
00808                         glEnd();
00809                         cur_line++;
00810                         if (cur_line < fonts[curfont]->symbols[(int)s]->lines) glBegin(GL_QUAD_STRIP);
00811                         else break; /* No more lines */
00812                 }
00813         }
00814 
00815         /* Draw contour, if enabled */
00816         if (contouring == GLF_YES) 
00817         {
00818                 glGetBooleanv(GL_LIGHTING, &light_temp);
00819                 glDisable(GL_LIGHTING);
00820                 glGetFloatv(GL_CURRENT_COLOR, temp_color);
00821                 glColor4f(contouring_color.r, contouring_color.g, contouring_color.b, contouring_color.a);
00822                 glfDraw3DWiredSymbol(s);
00823                 glColor4fv(temp_color);
00824                 if (light_temp) glEnable(GL_LIGHTING);
00825         }
00826 }

void glfDraw3DSolidSymbolF int  font_descriptor,
char  s
 

Definition at line 829 of file glf.cxx.

References curfont, glfDraw3DSolidSymbol(), and s().

00830 {
00831         int temp;
00832 
00833         temp = curfont;
00834         curfont = font_descriptor;
00835         glfDraw3DSolidSymbol(s);
00836         curfont = temp;
00837 }

void glfDraw3DWiredString char *  s  ) 
 

Definition at line 717 of file glf.cxx.

References DrawString(), glfDraw3DWiredSymbol(), and s().

00718 {
00719         DrawString(s, &glfDraw3DWiredSymbol);
00720 }

void glfDraw3DWiredStringF int  font_descriptor,
char *  s
 

Definition at line 723 of file glf.cxx.

References curfont, DrawString(), glfDraw3DWiredSymbol(), and s().

00724 {
00725         int temp;
00726 
00727         temp = curfont;
00728         curfont = font_descriptor;
00729         DrawString(s, &glfDraw3DWiredSymbol);
00730         curfont = temp;
00731 }

void glfDraw3DWiredSymbol char  s  ) 
 

Definition at line 642 of file glf.cxx.

References curfont, fonts, s(), and SymbolDepth.

Referenced by glfDraw3DSolidSymbol(), glfDraw3DWiredString(), glfDraw3DWiredStringF(), and glfDraw3DWiredSymbolF().

00643 {
00644         int i, cur_line;
00645         float *tvp; /* temp vertex pointer */
00646         float x, y;
00647   
00648         if ((curfont<0) || (fonts[curfont] == NULL)) return;
00649         if (fonts[curfont]->symbols[(int)s] == NULL) return;
00650 
00651         /* Draw front symbol */
00652         glBegin(GL_LINE_LOOP);
00653         tvp = fonts[curfont]->symbols[(int)s]->vdata;
00654         cur_line = 0;
00655         for (i=0; i<fonts[curfont]->symbols[(int)s]->vertexs; i++)
00656         {
00657                 x = *tvp;
00658                 tvp++;
00659                 y = *tvp;
00660                 tvp++;
00661                 glVertex3f(x, y, 1);
00662                 if (fonts[curfont]->symbols[(int)s]->ldata[cur_line] == i)
00663                 {
00664                         glEnd();
00665                         cur_line++;
00666                         if (cur_line < fonts[curfont]->symbols[(int)s]->lines) glBegin(GL_LINE_LOOP);
00667                         else break; /* No more lines */
00668                 }
00669         }
00670 
00671         /* Draw back symbol */
00672         glBegin(GL_LINE_LOOP);
00673         tvp = fonts[curfont]->symbols[(int)s]->vdata;
00674         cur_line = 0;
00675         for (i=0; i<fonts[curfont]->symbols[(int)s]->vertexs; i++)
00676         {
00677                 x = *tvp;
00678             tvp++;
00679                 y = *tvp;
00680                 tvp++;
00681                 glVertex3f(x, y, 1+SymbolDepth);
00682                 if (fonts[curfont]->symbols[(int)s]->ldata[cur_line] == i)
00683                 {
00684                         glEnd();
00685                         cur_line++;
00686                         if (cur_line < fonts[curfont]->symbols[(int)s]->lines) glBegin(GL_LINE_LOOP);
00687                         else break; /* No more lines */
00688                 }
00689         }
00690 
00691         /* Draw lines between back and front symbols */
00692         glBegin(GL_LINES);
00693         tvp = fonts[curfont]->symbols[(int)s]->vdata;
00694         for (i=0; i<fonts[curfont]->symbols[(int)s]->vertexs; i++)
00695         {
00696                 x = *tvp;
00697                 tvp++;
00698                 y = *tvp;
00699                 tvp++;
00700                 glVertex3f(x, y, 1);
00701                 glVertex3f(x, y, 1+SymbolDepth);
00702         }
00703         glEnd();
00704 }

void glfDraw3DWiredSymbolF int  font_descriptor,
char  s
 

Definition at line 707 of file glf.cxx.

References curfont, glfDraw3DWiredSymbol(), and s().

00708 {
00709         int temp;
00710 
00711         temp = curfont;
00712         curfont = font_descriptor;
00713         glfDraw3DWiredSymbol(s);
00714         curfont = temp;
00715 }

void glfDrawBMaskString char *  s  ) 
 

Definition at line 1669 of file glf.cxx.

References bmf_curfont, bmf_in_use, bmf_mask, bmf_texture, list_base, m_bitmap_string_center, m_widths, s(), and sym_space.

01670 {
01671         GLfloat temp_trans;
01672         int i;
01673 
01674         temp_trans = 0;
01675 
01676         if ((bmf_curfont < 0) || (bmf_in_use[bmf_curfont] == 0)) return;
01677 
01678         /* Calculate length of all string */
01679         for (i=0; i<(int)strlen(s); i++)
01680                 temp_trans += m_widths[bmf_curfont].width[s[i]] + sym_space;
01681 
01682         glPushMatrix();
01683         glPushAttrib(GL_CURRENT_BIT);
01684         
01685         /* Draw the text as a mask in black */
01686         glColor3ub(0xff, 0xff, 0xff);
01687         glBlendFunc(GL_DST_COLOR, GL_ZERO);
01688         glBindTexture(GL_TEXTURE_2D, bmf_mask[bmf_curfont]);
01689 
01690         glListBase(list_base[bmf_curfont]);
01691         if (m_bitmap_string_center == GL_TRUE)
01692         {
01693                 glPushMatrix();
01694                 glTranslatef(-temp_trans/2, 0, 0);
01695         }
01696         glCallLists(strlen(s), GL_UNSIGNED_BYTE, (unsigned char *)s);
01697         if (m_bitmap_string_center == GL_TRUE)  glPopMatrix();
01698 
01699         glPopAttrib();
01700         glPopMatrix();
01701 
01702         glBindTexture(GL_TEXTURE_2D, bmf_texture[bmf_curfont]);
01703         
01704         /* Now draw the text over only the black bits in the requested color */
01705         glBlendFunc(GL_ONE, GL_ONE);
01706         glListBase(list_base[bmf_curfont]);
01707         if (m_bitmap_string_center == GL_TRUE)
01708         {
01709                 glPushMatrix();
01710                 glTranslatef(-temp_trans/2, 0, 0);
01711         }
01712         glCallLists(strlen(s), GL_UNSIGNED_BYTE, (unsigned char *)s);
01713         if (m_bitmap_string_center == GL_TRUE)  glPopMatrix();
01714 }

void glfDrawBMaskSymbol char  s  ) 
 

Definition at line 1644 of file glf.cxx.

References bmf_curfont, bmf_in_use, bmf_mask, bmf_texture, list_base, and s().

01645 {
01646         if ((bmf_curfont < 0) || (bmf_in_use[bmf_curfont] == 0)) return;
01647         
01648         glPushMatrix();
01649         glPushAttrib(GL_CURRENT_BIT);
01650         
01651         /* Draw the text as a mask in black */
01652         glColor3ub(0xff, 0xff, 0xff);
01653         glBlendFunc(GL_DST_COLOR, GL_ZERO);
01654         glBindTexture(GL_TEXTURE_2D, bmf_mask[bmf_curfont]);
01655 
01656         glCallList(list_base[bmf_curfont]+(unsigned char)s);
01657 
01658         glPopAttrib();
01659         glPopMatrix();
01660         
01661         glBindTexture(GL_TEXTURE_2D, bmf_texture[bmf_curfont]);
01662         
01663         /* Now draw the text over only the black bits in the requested color */
01664         glBlendFunc(GL_ONE, GL_ONE);
01665 
01666         glCallList(list_base[bmf_curfont]+(unsigned char)s);
01667 }

void glfDrawBString char *  s  ) 
 

Definition at line 1621 of file glf.cxx.

References bmf_curfont, bmf_in_use, list_base, m_bitmap_string_center, m_widths, s(), and sym_space.

01622 {
01623         GLfloat temp_trans;
01624         int i;
01625 
01626         temp_trans = 0;
01627 
01628         if ((bmf_curfont < 0) || (bmf_in_use[bmf_curfont] == 0)) return;
01629 
01630         /* Calculate length of all string */
01631         for (i=0; i<(int)strlen(s); i++)
01632                 temp_trans += m_widths[bmf_curfont].width[s[i]] + sym_space;
01633         
01634         glListBase(list_base[bmf_curfont]);
01635         if (m_bitmap_string_center == GL_TRUE)
01636         {
01637                 glPushMatrix();
01638                 glTranslatef(-temp_trans/2, 0, 0);
01639         }
01640         glCallLists(strlen(s), GL_UNSIGNED_BYTE, (unsigned char *)s);
01641         if (m_bitmap_string_center == GL_TRUE)  glPopMatrix();
01642 }

void glfDrawBSymbol char  s  ) 
 

Definition at line 1613 of file glf.cxx.

References bmf_curfont, bmf_in_use, list_base, and s().

01614 {
01615         if ((bmf_curfont < 0) || (bmf_in_use[bmf_curfont] == 0)) return;
01616         
01617         glCallList(list_base[bmf_curfont]+(unsigned char)s);
01618 }

void glfDrawSolidString char *  s  ) 
 

Definition at line 623 of file glf.cxx.

References DrawString(), glfDrawSolidSymbol(), and s().

Referenced by TridGLFrame::DrawHUD().

00624 {
00625         DrawString(s, &glfDrawSolidSymbol);
00626 }

void glfDrawSolidStringF int  font_descriptor,
char *  s
 

Definition at line 629 of file glf.cxx.

References curfont, DrawString(), glfDrawSolidSymbol(), and s().

Referenced by glfConsoleDraw().

00630 {
00631         int temp;
00632 
00633         temp = curfont;
00634         curfont = font_descriptor;
00635         DrawString(s, &glfDrawSolidSymbol);
00636         curfont = temp;
00637 }

void glfDrawSolidSymbol char  s  ) 
 

Definition at line 573 of file glf.cxx.

References color::a, color::b, contouring, contouring_color, curfont, fonts, color::g, GLF_YES, glfDrawWiredSymbol(), color::r, s(), and texturing.

Referenced by glfDrawSolidString(), glfDrawSolidStringF(), and glfDrawSolidSymbolF().

00574 {
00575         unsigned char *b; /* Face pointer   */
00576         float *vp;        /* Vertex pointer */
00577         int i, j;
00578         float x, y;
00579         float temp_color[4];
00580 
00581         if ((curfont<0) || (fonts[curfont] == NULL)) return;
00582   
00583         if (fonts[curfont]->symbols[(int)s] == NULL) return;
00584 
00585         b = fonts[curfont]->symbols[(int)s]->fdata;
00586         vp = fonts[curfont]->symbols[(int)s]->vdata;
00587 
00588         glBegin(GL_TRIANGLES);   
00589         for (i=0; i<fonts[curfont]->symbols[(int)s]->facets; i++)
00590         {
00591                 for (j=0; j<3; j++)
00592                 {
00593                         x = vp[*b*2];
00594                         y = vp[*b*2+1];
00595                         if (texturing == GLF_YES) glTexCoord2f((x+1)/2, (y+1)/2);
00596                         glVertex2f(x, y);
00597                         b++;
00598                 }
00599         }
00600         glEnd();
00601 
00602         /* Draw contour, if enabled */
00603         if (contouring == GLF_YES) 
00604         {
00605                 glGetFloatv(GL_CURRENT_COLOR, temp_color);
00606                 glColor4f(contouring_color.r, contouring_color.g, contouring_color.b, contouring_color.a);
00607                 glfDrawWiredSymbol(s);
00608                 glColor4fv(temp_color);
00609         }
00610 }

void glfDrawSolidSymbolF int  font_descriptor,
char  s
 

Definition at line 613 of file glf.cxx.

References curfont, glfDrawSolidSymbol(), and s().

00614 {
00615         int temp;
00616 
00617         temp = curfont;
00618         curfont = font_descriptor;
00619         glfDrawSolidSymbol(s);
00620         curfont = temp;
00621 }

void glfDrawWiredString char *  s  ) 
 

Definition at line 557 of file glf.cxx.

References DrawString(), glfDrawWiredSymbol(), and s().

00558 {
00559         DrawString(s, &glfDrawWiredSymbol);
00560 }

void glfDrawWiredStringF int  font_descriptor,
char *  s
 

Definition at line 563 of file glf.cxx.

References curfont, DrawString(), glfDrawWiredSymbol(), and s().

00564 {
00565         int temp;
00566 
00567         temp = curfont;
00568         curfont = font_descriptor;
00569         DrawString(s, &glfDrawWiredSymbol);
00570         curfont = temp;
00571 }

void glfDrawWiredSymbol char  s  ) 
 

Definition at line 374 of file glf.cxx.

References curfont, fonts, and s().

Referenced by glfDrawSolidSymbol(), glfDrawWiredString(), glfDrawWiredStringF(), and glfDrawWiredSymbolF().

00375 {
00376         int i, cur_line;
00377         float *tvp; /* temporary vertex pointer */
00378         float x, y;
00379   
00380         if ((curfont < 0) || (fonts[curfont] == NULL)) return;
00381         if (fonts[curfont]->symbols[(int)s] == NULL) return;
00382 
00383         glBegin(GL_LINE_LOOP);
00384         tvp = fonts[curfont]->symbols[(int)s]->vdata;
00385         cur_line = 0;
00386         for (i=0; i<fonts[curfont]->symbols[(int)s]->vertexs; i++)
00387         {
00388                 x = *tvp++;
00389                 y = *tvp++;
00390                 glVertex2f(x, y);
00391                 if (fonts[curfont]->symbols[(int)s]->ldata[cur_line] == i)
00392                 {
00393                         glEnd();
00394                         cur_line++;
00395                         if (cur_line < fonts[curfont]->symbols[(int)s]->lines) glBegin(GL_LINE_LOOP);
00396                         else break; /* No more lines */
00397                 }
00398         }
00399 }

void glfDrawWiredSymbolF int  font_descriptor,
char  s
 

Definition at line 402 of file glf.cxx.

References curfont, glfDrawWiredSymbol(), and s().

00403 {
00404         int temp;
00405 
00406         temp = curfont;
00407         curfont = font_descriptor;
00408         glfDrawWiredSymbol(s);
00409         curfont = temp;
00410 }

void glfEnable int  what  ) 
 

Definition at line 970 of file glf.cxx.

References conCursor, console_msg, contouring, GLF_CONSOLE_CURSOR, GLF_CONSOLE_MESSAGES, GLF_CONTOURING, GLF_TEXTURING, GLF_YES, and texturing.

Referenced by glfInit().

00971 {
00972         switch (what) 
00973         {
00974                 case GLF_CONSOLE_MESSAGES: console_msg = GLF_YES; break;
00975                 case GLF_TEXTURING: texturing = GLF_YES; break;
00976                 case GLF_CONSOLE_CURSOR: conCursor = GLF_YES; break;
00977                 case GLF_CONTOURING: contouring = GLF_YES; break;
00978         }
00979 }

int glfGetCurrentBMFFont  ) 
 

Definition at line 1607 of file glf.cxx.

References bmf_curfont.

01608 {
01609         return bmf_curfont;
01610 }

int glfGetCurrentFont  ) 
 

Definition at line 951 of file glf.cxx.

References curfont.

Referenced by TridSketchText::DrawSelf().

00952 {
00953         return curfont;
00954 }

float glfGetSpaceSize  ) 
 

Definition at line 928 of file glf.cxx.

References SpaceSize.

00929 {
00930         return SpaceSize;
00931 }

void glfGetStringBounds char *  s,
float *  minx,
float *  miny,
float *  maxx,
float *  maxy
 

Definition at line 908 of file glf.cxx.

References curfont, glfGetStringBoundsF(), and s().

Referenced by TridSketchText::DrawSelf().

00909 {
00910         glfGetStringBoundsF(curfont, s, minx, miny, maxx, maxy);
00911 }

void glfGetStringBoundsF int  fd,
char *  s,
float *  minx,
float *  miny,
float *  maxx,
float *  maxy
 

Definition at line 856 of file glf.cxx.

References fonts, MAX_FONTS, s(), SpaceSize, and SymbolDist.

Referenced by glfGetStringBounds().

00857 {
00858         struct glf_font *font;
00859         int i;
00860         float sda, sdb, cw = 0, minxx = 10;
00861         float top = 10, bottom = -10;
00862 
00863         if (fd < 0 || fd > (MAX_FONTS-1)) return;
00864         font = fonts[fd];
00865 
00866         if (font == NULL) return;
00867 
00868         if (font->symbols[(int)s[0]])
00869                 minxx = -(float)(fabs(font->symbols[(int)s[0]]->leftx));
00870         else
00871                 minxx = 0.0;
00872 
00873         for (i=0; i<(int)strlen(s); i++)
00874         {
00875                 if ((font->symbols[(int)s[i]] == NULL) || (s[i] == ' '))
00876                         cw += SpaceSize;
00877                 else
00878                 {
00879                         sdb = (float)fabs(font->symbols[(int)s[i]]->leftx);
00880                         sda = (float)fabs(font->symbols[(int)s[i]]->rightx);
00881 
00882                         cw += sda+sdb+SymbolDist;
00883 
00884                         /* Update top/bottom bounds */
00885                         if (font->symbols[(int)s[i]]->bottomy > bottom)
00886                                 bottom = font->symbols[(int)s[i]]->bottomy;
00887 
00888                         if (font->symbols[(int)s[i]]->topy < top)
00889                                 top = font->symbols[(int)s[i]]->topy;
00890                 }
00891         }
00892 
00893         cw += minxx + SymbolDist;
00894 
00895         if ((maxx) && (maxy))
00896         {
00897                 *maxx = cw;
00898                 *maxy = bottom;
00899         }
00900 
00901         if ((minx) && (miny))
00902         {
00903                 *minx = minxx;
00904                 *miny = top;
00905         }
00906 }

GLboolean glfGetStringCentering  ) 
 

Definition at line 1124 of file glf.cxx.

References m_string_center.

01125 {
01126         return m_string_center;
01127 }

GLuint glfGetStringDirection  ) 
 

Definition at line 1117 of file glf.cxx.

References m_direction.

01118 {
01119         return m_direction;
01120 }

float glfGetSymbolDepth  ) 
 

Definition at line 938 of file glf.cxx.

References SymbolDepth.

00939 {
00940         return SymbolDepth;
00941 }

float glfGetSymbolSpace  ) 
 

Definition at line 918 of file glf.cxx.

References SymbolDist.

00919 {
00920         return SymbolDist;
00921 }

void glfInit  ) 
 

Definition at line 130 of file glf.cxx.

References ap, bmf_curfont, bmf_in_use, conData, console_msg, contouring, contouring_color, curfont, fonts, GLF_CENTER, GLF_CONSOLE_CURSOR, GLF_LEFT, GLF_NO, glfBitmapStringCentering(), glfConsoleClear(), glfEnable(), glfSetConsoleParam(), glfSetCursorBlinkRate(), glfStringCentering(), glfStringDirection(), m_max_height, MAX_FONTS, and texturing.

Referenced by TridOpenGLGlobal::GlfLoadFont().

00131 {
00132         int i;
00133 
00134         for (i=0; i<MAX_FONTS; i++)
00135         {
00136                 fonts[i] = NULL;
00137                 bmf_in_use[i] = 0;
00138                 m_max_height[i] = 0;
00139         }
00140         
00141         curfont = -1;
00142         bmf_curfont = -1;
00143         console_msg = GLF_NO;
00144         ap = GLF_CENTER;                /* Set anchor point to center of each symbol */
00145         texturing = GLF_NO;             /* By default texturing is NOT Enabled */
00146         contouring = GLF_NO;    /* By default contouring is NOT Enabled */
00147         memset(&contouring_color, 0, sizeof(struct color));
00148         conData = NULL;
00149         glfSetConsoleParam(40, 20);
00150         glfConsoleClear();
00151         glfEnable(GLF_CONSOLE_CURSOR);
00152         glfSetCursorBlinkRate(10);
00153         glfStringCentering(GL_FALSE);
00154         glfBitmapStringCentering(GL_FALSE);
00155         glfStringDirection(GLF_LEFT);
00156 }

int glfLoadBMFFont char *  FName  ) 
 

Definition at line 1423 of file glf.cxx.

References bmf_curfont, bmf_in_use, bmf_mask, bmf_texture, GLF_ERROR, coord_rect::height, list_base, LittleEndian(), m_max_height, m_widths, MAX_FONTS, read_texture(), sym_space, Symbols, texture_to_mask(), coord_rect::width, coord_rect::x, and coord_rect::y.

01424 {
01425         FILE *f;
01426         char Header[4];
01427         char FontName[97];
01428         int i, flag;
01429         int LEndian;
01430         float tx, ty, tw, th;
01431         unsigned char temp, *tp;
01432         unsigned *texture;      /* Texture image */
01433         unsigned *mask; /* Mask texture */
01434         int twidth, theight, tcomp;     /* Image parameters */
01435         float *temp_width;
01436 
01437         LEndian = LittleEndian();
01438 
01439         f = fopen(FName, "rb");
01440         if (f == NULL) return GLF_ERROR; /* Error opening file */
01441 
01442         /* Get header */
01443         fread(Header, 1, 3, f);
01444         Header[3] = 0;
01445         if (strcmp(Header, "BMF")) return GLF_ERROR; /* Not BMF format */
01446 
01447         /* Get font name */
01448         fread(FontName, 1, 96, f);
01449         FontName[96] = 0;
01450 
01451         /* Allocate space for temp widths */
01452         
01453         temp_width = (float *)malloc(sizeof(float)*256);
01454 
01455         /* Read all 256 symbols information */
01456         for (i=0; i<256; i++)
01457         {
01458                 fread(&tx, 4, 1, f);
01459                 fread(&ty, 4, 1, f);
01460                 fread(&tw, 4, 1, f);
01461                 fread(&th, 4, 1, f);
01462 
01463                 if (!LEndian)
01464                 {
01465                         tp = (unsigned char *)&tx;
01466                         temp = tp[0]; tp[0] = tp[3]; tp[3] = temp;
01467                         temp = tp[1]; tp[1] = tp[2]; tp[2] = temp;
01468                         tp = (unsigned char *)&ty;
01469                         temp = tp[0]; tp[0] = tp[3]; tp[3] = temp;
01470                         temp = tp[1]; tp[1] = tp[2]; tp[2] = temp;
01471                         tp = (unsigned char *)&tw;
01472                         temp = tp[0]; tp[0] = tp[3]; tp[3] = temp;
01473                         temp = tp[1]; tp[1] = tp[2]; tp[2] = temp;
01474                         tp = (unsigned char *)&th;
01475                         temp = tp[0]; tp[0] = tp[3]; tp[3] = temp;
01476                         temp = tp[1]; tp[1] = tp[2]; tp[2] = temp;
01477                 }
01478                 
01479                 Symbols[(int)i].x = tx;
01480                 Symbols[(int)i].y = ty;
01481                 Symbols[(int)i].width  = tw;
01482                 Symbols[(int)i].height = th;
01483                 temp_width[i] = tw;
01484         }
01485 
01486         /* Read texture image from file and build texture */
01487         texture = read_texture(f, &twidth, &theight, &tcomp);
01488         /* Generate mask texture */
01489         mask = texture_to_mask(texture, twidth, theight);
01490 
01491         /* Find unused font descriptor */
01492         flag = 0;
01493         for (i=0; i<MAX_FONTS; i++)
01494                 if (bmf_in_use[i] == 0)
01495                 {
01496                         /* Initialize this font */
01497                         bmf_in_use[i] = 1;
01498                         bmf_curfont = i;
01499                         flag = 1;
01500                         break;
01501                 }
01502         if (!flag) /* Not enought space for new texture */
01503         {
01504                 fclose(f);
01505                 free(texture);
01506                 free(mask);
01507                 free(temp_width);
01508                 return -1;
01509         }
01510 
01511         m_widths[bmf_curfont].width = temp_width;
01512 
01513         /* Generating textures for font and mask */
01514         glGenTextures(1, &bmf_texture[bmf_curfont]);
01515         glGenTextures(1, &bmf_mask[bmf_curfont]);
01516 
01517 
01518         glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
01519 
01520         /* Build font texture */
01521         glBindTexture(GL_TEXTURE_2D, bmf_texture[bmf_curfont]);
01522         glTexImage2D(GL_TEXTURE_2D, 0, 3, twidth, theight, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
01523         
01524         /* Linear filtering for better quality */
01525         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
01526         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
01527         
01528         /* Build mask texture */
01529         glBindTexture(GL_TEXTURE_2D, bmf_mask[bmf_curfont]);
01530         glTexImage2D(GL_TEXTURE_2D, 0, 3, twidth, theight, 0, GL_RGBA, GL_UNSIGNED_BYTE, mask);
01531         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
01532         glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
01533 
01534         free(texture);
01535         free(mask);
01536         fclose(f);
01537 
01538         /* Now build list for each symbol */
01539         list_base[bmf_curfont] = glGenLists(256);
01540         for (i=0; i<256; i++)
01541         {
01542                 glNewList(list_base[bmf_curfont]+i, GL_COMPILE);
01543                 
01544                 glBegin(GL_QUADS);
01545                         glTexCoord2f(Symbols[(int)i].x, Symbols[(int)i].y); glVertex2f(0, 0);
01546                         glTexCoord2f(Symbols[(int)i].x+Symbols[(int)i].width, Symbols[(int)i].y); glVertex2f(Symbols[(int)i].width, 0);
01547                         glTexCoord2f(Symbols[(int)i].x+Symbols[(int)i].width, Symbols[(int)i].y+Symbols[(int)i].height); glVertex2f(Symbols[(int)i].width, Symbols[(int)i].height);
01548                         glTexCoord2f(Symbols[(int)i].x, Symbols[(int)i].y+Symbols[(int)i].height); glVertex2f(0, Symbols[(int)i].height);
01549                 glEnd();
01550                 glTranslatef(Symbols[(int)i].width+sym_space, 0, 0);
01551 
01552                 glEndList();
01553                 if (Symbols[(int)i].height > m_max_height[bmf_curfont]) m_max_height[bmf_curfont] = Symbols[(int)i].height;
01554         }
01555         return bmf_curfont;
01556 }

int glfLoadFont char *  font_name  ) 
 

Definition at line 300 of file glf.cxx.

References curfont, fonts, GLF_ERROR, GLF_OK, MAX_FONTS, and ReadFont().

Referenced by TridOpenGLGlobal::GlfLoadFont().

00301 {
00302         int i;
00303         char flag; /* Temporary flag */
00304 
00305         /* First we find free font descriptor */
00306         flag = 0; /* Descriptor not found yet */
00307         for (i=0; i<MAX_FONTS; i++)
00308                 if (fonts[i] == NULL)
00309                 {
00310                         /* Initialize this font */
00311                         fonts[i] = (struct glf_font *)malloc(sizeof(struct glf_font));
00312                         flag = 1;
00313                         break;
00314                 }
00315 
00316         if (!flag) return GLF_ERROR; /* Free font not found */
00317         if (ReadFont(font_name, fonts[i]) == GLF_OK) 
00318         {
00319                 curfont = i; /* Set curfont to just loaded font */
00320                 return i;
00321         }
00322   
00323         if (fonts[i] != NULL)
00324         {
00325                 free(fonts[i]);
00326                 fonts[i] = NULL;
00327         }
00328         return GLF_ERROR;
00329 }

void glfPrint char *  s,
int  lenght
 

Definition at line 1019 of file glf.cxx.

References conData, conHeight, conWidth, conx, and s().

Referenced by glfPrintChar(), and glfPrintString().

01020 {
01021         int i;
01022 
01023         for (i=0; i<lenght; i++)
01024         {
01025                 if (s[i] > 31)
01026                 {
01027                         conData[cony*conWidth+conx] = s[i];
01028                         conx++;
01029                 } else
01030                 if (s[i] == '\n') conx = conWidth;
01031                 if (conx >= conWidth)
01032                 {
01033                         conx = 0;
01034                         cony++;
01035                         if (cony >= conHeight)
01036                         {
01037                                 /* Shift all console contents up */
01038                                 memcpy(conData, &conData[conWidth], conWidth*(conHeight-1));
01039                                 /* Fill bottom line by spaces */
01040                                 memset(&conData[conWidth*(conHeight-1)], 0, conWidth);
01041                                 cony = conHeight-1;
01042                         }
01043                 }
01044         }
01045 }

void glfPrintChar char  s  ) 
 

Definition at line 1052 of file glf.cxx.

References glfPrint(), and s().

01053 {
01054         glfPrint(&s, 1);
01055 }

void glfPrintString char *  s  ) 
 

Definition at line 1047 of file glf.cxx.

References glfPrint(), and s().

01048 {
01049         glfPrint(s, strlen(s));
01050 }

void glfSetAnchorPoint int  anchp  ) 
 

Definition at line 956 of file glf.cxx.

References ap, GLF_LEFT_UP, and GLF_RIGHT_DOWN.

00957 {
00958         if ((anchp >= GLF_LEFT_UP) && (anchp <= GLF_RIGHT_DOWN))
00959                 ap = anchp;
00960 }

void glfSetBRotateAngle float  angle  ) 
 

Definition at line 1729 of file glf.cxx.

References RotateAngleB.

01730 {
01731         RotateAngleB = angle;
01732 }

int glfSetConsoleFont int  Font_Descriptor  ) 
 

Definition at line 1004 of file glf.cxx.

References conFont, fonts, GLF_ERROR, and GLF_OK.

01005 {
01006         if ((Font_Descriptor < 0) || (fonts[Font_Descriptor] == NULL)) return GLF_ERROR;
01007   
01008         conFont = Font_Descriptor;
01009         return GLF_OK;
01010 }

void glfSetConsoleParam int  width,
int  height
 

Definition at line 994 of file glf.cxx.

References conData, conHeight, conWidth, and glfConsoleClear().

Referenced by glfInit().

00995 {
00996         if (conData) free(conData);
00997 
00998         conWidth = width;
00999         conHeight = height;
01000         conData = (char *)malloc(width*height);
01001         glfConsoleClear();
01002 }

void glfSetContourColor float  r,
float  g,
float  b,
float  a
 

Definition at line 962 of file glf.cxx.

References color::a, color::b, contouring_color, color::g, and color::r.

00963 {
00964         contouring_color.r = r;
00965         contouring_color.g = g;
00966         contouring_color.b = b;
00967         contouring_color.a = a;
00968 }

int glfSetCurrentBMFFont int  Font_Descriptor  ) 
 

Definition at line 1598 of file glf.cxx.

References bmf_curfont, bmf_in_use, GLF_ERROR, and GLF_OK.

01599 {
01600         if ((Font_Descriptor < 0) || (bmf_in_use[Font_Descriptor] == 0)) return GLF_ERROR;
01601 
01602         bmf_curfont = Font_Descriptor;
01603         return GLF_OK;
01604 }

int glfSetCurrentFont int  Font_Descriptor  ) 
 

Definition at line 943 of file glf.cxx.

References curfont, fonts, GLF_ERROR, and GLF_OK.

Referenced by TridSketchText::DrawSelf().

00944 {
00945         if ((Font_Descriptor < 0) || (fonts[Font_Descriptor] == NULL)) return GLF_ERROR;
00946   
00947         curfont = Font_Descriptor;
00948         return GLF_OK;
00949 }

void glfSetCursorBlinkRate int  Rate  ) 
 

Definition at line 1092 of file glf.cxx.

References conCursorBlink, conCursorCount, conCursorMode, and GLF_YES.

Referenced by glfInit().

01093 {
01094         if (Rate > 0)
01095         {
01096                 conCursorBlink = Rate;
01097                 conCursorCount = Rate;
01098                 conCursorMode = GLF_YES;
01099         }
01100 }

void glfSetRotateAngle float  angle  ) 
 

Definition at line 1130 of file glf.cxx.

References RotateAngle.

Referenced by TridGLFrame::DrawHUD().

01131 {
01132         RotateAngle = angle;
01133 }

void glfSetSpaceSize float  sp  ) 
 

Definition at line 923 of file glf.cxx.

References SpaceSize.

00924 {
00925         SpaceSize = sp;
00926 }

void glfSetSymbolDepth float  dpth  ) 
 

Definition at line 933 of file glf.cxx.

References SymbolDepth.

Referenced by TridSketchText::DrawSelf().

00934 {
00935         SymbolDepth = dpth;
00936 }

void glfSetSymbolSpace float  sp  ) 
 

Definition at line 913 of file glf.cxx.

References SymbolDist.

00914 {
00915         SymbolDist = sp;
00916 }

void glfStartBitmapDrawing  ) 
 

Definition at line 1580 of file glf.cxx.

References bmf_curfont, bmf_texture, and bmf_texturing.

01581 {
01582         /* Enable 2D Texturing */
01583         glGetBooleanv(GL_TEXTURE_2D, &bmf_texturing);
01584         glEnable(GL_TEXTURE_2D);
01585 
01586         glBindTexture(GL_TEXTURE_2D, bmf_texture[bmf_curfont]);
01587 }

void glfStopBitmapDrawing  ) 
 

Definition at line 1590 of file glf.cxx.

References bmf_texturing.

01591 {
01592         /* Return previuos state of texturing */
01593         if (bmf_texturing) glEnable(GL_TEXTURE_2D);
01594         else glDisable(GL_TEXTURE_2D);
01595 }

void glfStringCentering GLboolean  center  ) 
 

Definition at line 1103 of file glf.cxx.

References m_string_center.

Referenced by TridGLFrame::DrawHUD(), TridSketchText::DrawSelf(), and glfInit().

01104 {
01105         m_string_center = center;
01106 }

void glfStringDirection GLuint  direction  ) 
 

Definition at line 1110 of file glf.cxx.

References GLF_DOWN, GLF_LEFT, GLF_RIGHT, GLF_UP, and m_direction.

Referenced by TridGLFrame::DrawHUD(), and glfInit().

01111 {
01112         if (direction == GLF_LEFT || direction == GLF_RIGHT || 
01113                 direction == GLF_UP || direction == GLF_DOWN) m_direction = direction;
01114 }

int glfUnloadBMFFont  ) 
 

Definition at line 1574 of file glf.cxx.

References bmf_curfont, and glfUnloadBMFFontD().

01575 {
01576         return glfUnloadBMFFontD(bmf_curfont);
01577 }

int glfUnloadBMFFontD int  bmf_descriptor  ) 
 

Definition at line 1559 of file glf.cxx.

References bmf_curfont, bmf_in_use, bmf_mask, bmf_texture, GLF_ERROR, and GLF_OK.

Referenced by glfClose(), and glfUnloadBMFFont().

01560 {
01561         if ((bmf_descriptor < 0) || (bmf_in_use[bmf_descriptor] == 0)) return GLF_ERROR;
01562 
01563         bmf_in_use[bmf_descriptor] = 0;
01564 
01565         glDeleteTextures(1, &bmf_texture[bmf_descriptor]);
01566         glDeleteTextures(1, &bmf_mask[bmf_descriptor]);
01567 
01568         if (bmf_descriptor == bmf_curfont) bmf_curfont = -1;
01569 
01570         return GLF_OK;
01571 }

int glfUnloadFont  ) 
 

Definition at line 336 of file glf.cxx.

References curfont, fonts, GLF_ERROR, and GLF_OK.

Referenced by TridOpenGLGlobal::GlfLoadFont(), glfUnloadFontD(), and TridOpenGLGlobal::~TridOpenGLGlobal().

00337 {
00338         int i;
00339   
00340         if ((curfont<0) || (fonts[curfont] == NULL)) return GLF_ERROR;
00341   
00342         for (i=0; i<256; i++)
00343         {
00344                 if (fonts[curfont]->symbols[(int)i] != NULL)
00345                 {
00346                         free(fonts[curfont]->symbols[(int)i]->vdata);
00347                         free(fonts[curfont]->symbols[(int)i]->fdata);
00348                         free(fonts[curfont]->symbols[(int)i]->ldata);
00349                         free(fonts[curfont]->symbols[(int)i]);
00350                 }
00351         }
00352 
00353         free(fonts[curfont]);
00354         fonts[curfont] = NULL;
00355         curfont = -1;
00356         return GLF_OK;
00357 }

int glfUnloadFontD int  font_descriptor  ) 
 

Definition at line 360 of file glf.cxx.

References curfont, fonts, GLF_ERROR, GLF_OK, and glfUnloadFont().

Referenced by glfClose().

00361 {
00362         int temp;
00363 
00364         if ((font_descriptor < 0) || (fonts[font_descriptor] == NULL)) return GLF_ERROR;
00365 
00366         temp = curfont;
00367         curfont = font_descriptor;
00368         glfUnloadFont();
00369         if (temp != font_descriptor) curfont = temp;
00370         else curfont = -1;
00371         return GLF_OK;
00372 }


Generated on Sat Mar 14 22:42:42 2009 for loon by doxygen 1.3.5