Display List Error

Hey -

I seem to be getting an error when I try to create an instance of my font class as a global variable.

For example, when I call the line:
lh_text text_ArialNarrow(“Arial Narrow”,hDC);
to generate an instance of my bitmap font class, the value returned by glGenList is 0.

My font class is a slight variation of the nehe code. It is:

lh_text::lh_text(char *font_name, HDC hDC){ // Create the font in the constructor

device_context		= hDC;											// Set device context
HFONT				font;											// Windows Font ID
font_display_list	= glGenLists(96);								// Storage For 96 Characters

// ERROR CHECKING LIST BASE -- 0 indicates an error
char		 str[255];
sprintf		(str, "%u", font_display_list);
MessageBox	(NULL, str, "ALERT", MB_OK);

font = CreateFont(	-16,											// Height Of Font
					8,												// Width Of Font
					0,												// Angle Of Escapement
					0,												// Orientation Angle
					FW_BOLD,										// Font Weight
					FALSE,											// Italic
					FALSE,											// Underline
					FALSE,											// Strikeout
					ANSI_CHARSET,									// Character Set Identifier
					OUT_TT_PRECIS,									// Output Precision
					CLIP_DEFAULT_PRECIS,							// Clipping Precision
					ANTIALIASED_QUALITY,							// Output Quality
					FF_DONTCARE|DEFAULT_PITCH,						// Family And Pitch
					font_name);										// Font Name

SelectObject		(device_context, font);							// Selects The Font We Want
wglUseFontBitmaps	(device_context, 32, 96, font_display_list);	// Builds 96 Characters Starting At Character 32

} // end constructor

However, when I create a static instance of this class from within my draw function, the glGenList call generates a valid number, and everything works fine. I am not sure why this is happening – does anyone happen to have any ideas??

Thanks

Ah, I think I got it – the rendering context must not be set up when I try to call glGenLists. That would explain the behavior I am getting.