Sign in to follow this  

glGenLists failing to allocate

This topic is 4303 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to use glGentLists to creat display lists for a font I'm building (obviously) using openGL. This code is based closely on NEHE's tutorial. The display lists are not getting allocated and therefore my font doesn't happen. if anybody could clue me in on why my display lists aren't working that would be great. This function is normally a method in a class but I pulled it out for testing. Same results either way.
GLuint base;
GLvoid buildFont() {						// Build Our Bitmap Font
	base = glGenLists(96);	// base is set to 0 by glGenLists
    bool isList=true;
	isList=glIsList(base);	// isList becomes false.
	font = CreateFont(	-24,		        	        	// Height of font
						0,	        		// 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
						"Courier New");			// Font name

	oldfont = (HFONT)SelectObject(hDC, font);       // Selects the font we want
	wglUseFontBitmaps(hDC, 32, 96, base);           // Builds 96 characters starting at character 32
	SelectObject(hDC, oldfont);			// Selects the font we want
	DeleteObject(font);				// Delete the font


Share this post

Link to post
Share on other sites
Is it possible that you are calling this function before your OpenGL rendering context has been created?

Share this post

Link to post
Share on other sites
Sign in to follow this