#include "stdafx.h"
#include "glfont.h"
#include <glut.h>
#include <GL/gl.h>
#include <GL/glu.h>
GLFONT arial_r_12; // global font object
void init(void)
{
glClearColor (0.0, 0.0, 0.0, 1.0);
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
glFontBegin(&arial_r_12);
glTranslatef(30, 30, 0);
glScalef(8.0,8.0,0.0);
glFontTextOut("HELLO WORLD!!!", 5, 5, 0);
glFontEnd();
glutSwapBuffers();
}
void reshape (int w, int h)
{
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho(0, 640, 0, 480, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int _tmain(int argc, char** argv)
{
if (!glFontCreate(&arial_r_12, "C:\\Program Files\\glFont\\Arial_r_20.glf", 0))
{
return 0;
}
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize (640, 480);
glutInitWindowPosition (100, 100);
glutCreateWindow (argv[0]);
init ();
glutDisplayFunc(display);
glutReshapeFunc(reshape);
glutMainLoop();
glFontDestroy(&arial_r_12);
return 0;
}