#include "VectorText.h" #include static void BuildVectorFont(GLint ListBase) { glNewList((ListBase + ' '), GL_COMPILE); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '-'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.01); glVertex2f(0.01, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '.'), GL_COMPILE); glBegin(GL_POINTS); glVertex2f(0.005, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '0'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0025, 0.02); glVertex2f(0.0075, 0.02); glVertex2f(0.01, 0.015); glVertex2f(0.01, 0.005); glVertex2f(0.0075, 0.0); glVertex2f(0.0025, 0.0); glVertex2f(0.0, 0.005); glVertex2f(0.0, 0.015); glVertex2f(0.0025, 0.02); glVertex2f(0.0075, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '1'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.0); glVertex2f(0.01, 0.0); glVertex2f(0.005, 0.0); glVertex2f(0.005, 0.02); glVertex2f(0.005, 0.02); glVertex2f(0.002, 0.019); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '2'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0175); glVertex2f(0.0025, 0.02); glVertex2f(0.0075, 0.02); glVertex2f(0.01, 0.0175); glVertex2f(0.01, 0.015); glVertex2f(0.0, 0.0); glVertex2f(0.01, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '3'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0175); glVertex2f(0.0025, 0.02); glVertex2f(0.0075, 0.02); glVertex2f(0.01, 0.0175); glVertex2f(0.01, 0.0125); glVertex2f(0.005, 0.01); glVertex2f(0.01, 0.0075); glVertex2f(0.01, 0.0025); glVertex2f(0.0075, 0.0); glVertex2f(0.0025, 0.0); glVertex2f(0.0, 0.0025); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '4'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0075, 0.0); glVertex2f(0.0075, 0.02); glVertex2f(0.01, 0.01); glVertex2f(0.0, 0.01); glVertex2f(0.0, 0.01); glVertex2f(0.0, 0.02); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '5'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.01, 0.02); glVertex2f(0.0, 0.02); glVertex2f(0.0, 0.0075); glVertex2f(0.0025, 0.01); glVertex2f(0.0075, 0.01); glVertex2f(0.01, 0.0075); glVertex2f(0.01, 0.0025); glVertex2f(0.0075, 0.0); glVertex2f(0.0, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '6'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.01, 0.02); glVertex2f(0.0025, 0.02); glVertex2f(0.0, 0.0175); glVertex2f(0.0, 0.0025); glVertex2f(0.0025, 0.0); glVertex2f(0.0075, 0.0); glVertex2f(0.01, 0.0025); glVertex2f(0.01, 0.01); glVertex2f(0.0075, 0.0125); glVertex2f(0.0025, 0.0125); glVertex2f(0.0, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '7'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.005, 0.0); glVertex2f(0.005, 0.01); glVertex2f(0.01, 0.02); glVertex2f(0.0, 0.02); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '8'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0025, 0.01); glVertex2f(0.0, 0.0125); glVertex2f(0.0, 0.0175); glVertex2f(0.0025, 0.02); glVertex2f(0.0075, 0.02); glVertex2f(0.01, 0.0175); glVertex2f(0.01, 0.0125); glVertex2f(0.0075, 0.01); glVertex2f(0.0025, 0.01); glVertex2f(0.0, 0.0075); glVertex2f(0.0, 0.0025); glVertex2f(0.0025, 0.0); glVertex2f(0.0075, 0.0); glVertex2f(0.01, 0.0025); glVertex2f(0.01, 0.0075); glVertex2f(0.0075, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + '9'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.0075, 0.0); glVertex2f(0.01, 0.0025); glVertex2f(0.01, 0.0175); glVertex2f(0.0075, 0.02); glVertex2f(0.0025, 0.02); glVertex2f(0.0, 0.0175); glVertex2f(0.0, 0.01); glVertex2f(0.0025, 0.0075); glVertex2f(0.0075, 0.0075); glVertex2f(0.01, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'A'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.0); glVertex2f(0.005, 0.02); glVertex2f(0.005, 0.02); glVertex2f(0.01, 0.0); glVertex2f(0.0025, 0.01); glVertex2f(0.0075, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); } GLint FontDisplayListBase() { static GLint ListBase = -1; if (ListBase == -1) { ListBase = glGenLists(128); BuildVectorFont(ListBase); } return ListBase; } void DrawCStringWithVectorFont(char * string) { GLint ListBase; ListBase = FontDisplayListBase(); glListBase(ListBase); glCallLists(strlen(string), GL_BYTE, string); }