Another Font sheet program in OpenGL
The whole bunch of program here given below which deals with displaying the Font in OpenGL. Try this out and have problem post that in comment. Add something to it, that too post this here. Discuss, how to improve this program.
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glut.h>
typedef enum {
MODE_BITMAP,
MODE_STROKE
} mode_type;
static mode_type mode;
static int font_index;
void
print_bitmap_string(void* font, char* s)
{
if (s && strlen(s)) {
while (*s) {
glutBitmapCharacter(font, *s);
s++;
}
}
}
void
print_stroke_string(void* font, char* s)
{
if (s && strlen(s)) {
while (*s) {
glutStrokeCharacter(font, *s);
s++;
}
}
}
void
my_init()
{
mode = MODE_BITMAP;
font_index = 0;
}
void
my_reshape(int w, int h)
{
GLdouble size;
GLdouble aspect;
/* Use the whole wi…