#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(); glNewList((ListBase + 'R'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.009, 0.01); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'O'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.009, 0.0); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.009, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'C'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.009, 0.0); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'K'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.021); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'E'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.01); glVertex2f(0.0, 0.0); glVertex2f(0.009, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'T'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.0045, 0.021); glVertex2f(0.0045, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'S'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.009, 0.0); glVertex2f(0.009, 0.01); glVertex2f(0.0, 0.01); glVertex2f(0.0, 0.02); glVertex2f(0.009, 0.02); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'H'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.01); glVertex2f(0.009, 0.0); glVertex2f(0.009, 0.021); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'I'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0045, 0.0); glVertex2f(0.0045, 0.021); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'L'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.0); glVertex2f(0.009, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'D'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.015); glVertex2f(0.009, 0.005); glVertex2f(0.0, 0.0); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + ':'), GL_COMPILE); glBegin(GL_POINTS); glVertex2f(0.0, 0.015); glVertex2f(0.0, 0.006); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'V'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.021); glVertex2f(0.0045, 0.0); glVertex2f(0.009, 0.021); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'Z'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.0, 0.00); glVertex2f(0.0, 0.0); glVertex2f(0.009, 0.0); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'U'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.0); glVertex2f(0.009, 0.0); glVertex2f(0.009, 0.021); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'F'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.0, 0.01); glVertex2f(0.009, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'Q'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.009, 0.0); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.009, 0.0); glVertex2f(0.013, -0.005); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'P'), GL_COMPILE); glBegin(GL_LINE_STRIP); glVertex2f(0.0, 0.0); glVertex2f(0.0, 0.021); glVertex2f(0.009, 0.021); glVertex2f(0.009, 0.01); glVertex2f(0.0, 0.01); glEnd(); glTranslatef(0.013, 0.0, 0.0); glEndList(); glNewList((ListBase + 'Y'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.021); glVertex2f(0.0, 0.015); glVertex2f(0.0, 0.015); glVertex2f(0.009, 0.015); glVertex2f(0.009, 0.015); glVertex2f(0.009, 0.021); glVertex2f(0.0045, 0.015); glVertex2f(0.0045, 0.0); glEnd(); glEndList(); glNewList((ListBase + '-'), GL_COMPILE); glBegin(GL_LINES); glVertex2f(0.0, 0.01); glVertex2f(0.009, 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); }