font please?

hi
i used glut but i’d like to use a better font than the 7 that glut supplies
i’m trying to use nehe’s font tutorial (#13) and i managed to add it to my console app and get it to compile
but nothing shows up! i hate to do this, but i don’t know of any other way to explain it so i’ve pasted the font code below (only three functions, it’s short, i promise!):

#ifndef FONTS_H
#define FONTS_H

#include <windows.h>
#include <math.h>
#include <stdio.h>
#include <stdarg.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include <GL\glut.h>
#include “Fonts.h”

HDC hDC=NULL; // Private GDI Device Context
HGLRC hRC=NULL; // Permanent Rendering Context
HWND hWnd=NULL; // Holds Our Window Handle
HINSTANCE hInstance; // Holds The Instance Of The Application

GLuint base; // Base Display List For The Font Set
GLfloat cnt1; // 1st Counter Used To Move Text & For Coloring
GLfloat cnt2; // 2nd Counter Used To Move Text & For Coloring

bool keys[256];
bool active=TRUE;
bool fullscreen=TRUE;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

GLvoid BuildFont(GLvoid)
{
HFONT font;
HFONT oldfont;
base = glGenLists(96);
font = CreateFont( -24, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH,
“Courier”);

oldfont = (HFONT)SelectObject(hDC, font);
wglUseFontBitmaps(hDC, 32, 96, base); SelectObject(hDC, oldfont); DeleteObject(font);
}

GLvoid KillFont(GLvoid)
{
glDeleteLists(base, 96);
}

GLvoid glPrint(const char *fmt, …)
{
char text[256]; va_list ap; // Pointer To List Of Arguments

if (fmt == NULL) return;
va_start(ap, fmt); // Parses The String For Variables

vsprintf(text, fmt, ap); // And Converts Symbols To Actual Numbers
va_end(ap);
// Results Are Stored In Text

glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
glListBase(base - 32); // Sets The Base Character to 32
glCallLists(strlen(text), GL_UNSIGNED_BYTE, text);
// Draws The Display List Text
glPopAttrib(); // Pops The Display List Bits
}

use glRasterPos() to set the x and y corridinates of the text

i recommend using GLFont instead (it’s free), search for it at google… .


PLUG: http://nomad.openglforums.com