Archived

This topic is now archived and is closed to further replies.

Galileo430

OGL Font Problem.

Recommended Posts

Galileo430    122
Could you guys quickly check this code over for major errors. Cause I can''t get it to work. It''s driveing me nuts. All variables are defined. I included some in comments at the top.
  
// GLuint dwBaseFont;


void LoadFont(char *szFontName)
{
	//-----------------------//

	// Locals				

	//-----------------------//

	HFONT	hFont;

	//----------------------//

	// Generate List		//

	//----------------------//

	dwBaseFont = glGenLists(256);

	hFont = CreateFont(-24, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, 
						ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
						ANTIALIASED_QUALITY, FF_DONTCARE|DEFAULT_PITCH,
						szFontName);


	SelectObject(hdc,hFont);
	wglUseFontBitmaps(hdc, 0, 256, dwBaseFont);
}

void glPrint(char *szString)
{
	if (szString == NULL)						
		return;									

	glColor3f(1.0f,0.0f,0.0f);

	glPushAttrib(GL_LIST_BIT);				
		glListBase(dwBaseFont);
		glRasterPos2i(0,0);
		glCallLists(strlen(szString), GL_UNSIGNED_BYTE, szString);
	glPopAttrib();							
}
  
I don''t get anything on the screen when I call glPrint and swap the buffers.

Share this post


Link to post
Share on other sites
Geocyte    196
If you don''t have proper hardware support for OpenGL you may get problems using raster functions in fullscreen mode - try running the app in a window. There is a way around this, I hear, but I got a GeForce2 instead of bothering to find out what it was. I think the solution may be buried somewhere in one of the NeHe tutorials.

Geocyte Has Committed Suicide.

Share this post


Link to post
Share on other sites