Archived

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

What Bombs wglUseFontBitmaps?

This topic is 5814 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

What sorts of things can cause this function to fail? I'm pulling my hair out wondering why it comes up with invalid parameter error (87 on GetLastError()) and can't figure out what the problem is. I've made sure the GDI object is selected properly by doing a debug TextOut() call, and it shows up properly with the right attributes. My display lists are created appropriately. I don't know what the problem is. Here's the code in question:
          
void CreateFonts()
{
	HFONT TempFont;
	char Temp[40];

	FontDisplayLists=new uint[NUM_FONTS];
			
	TempFont=CreateFont(64, 16, 0, 0, FW_BOLD, 0, 0, 0, \ 

          ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "tahoma");
	SelectObject(MainHDC, TempFont);


	for(ushort n=0; n<NUM_FONTS; n++)
		FontDisplayLists[n]=glGenLists(256);


	if(FALSE==wglUseFontBitmaps(MainHDC, 0, 255, FontDisplayLists[FONT_DEFAULT]))
	{
		sprintf(Temp, "How very odd...  (Error %u)", GetLastError());
		MessageBox(MainHWnd, Temp, "Font Failure", 0);
	}


	DeleteObject(TempFont);
}
          
Simply put, the if statement in there evaluates to true and the error code 87 is spat out, which according to MSDN is an invalid parameter error. Zwah...? None of the supposedly created display lists work, either, not surprisingly. NUM_FONTS, FONT_DEFAULT are both #defined in the header file associated with this source file, and are the proper values of 1 and 0, respectively. MainHDC is the handle to the DC of the main window (which also houses the main HGLRC) and is initialized properly. FontDisplayLists is an unsigned integer pointer set to NULL initially, then initialized by this function, and later deleted by a cooresponding DeleteFonts() function. If nothing here looks entirely out of order... I've read of other people having similar problems, but haven't gleaned any form of a solution suggestion. Talk about disappointing... Oh well, any input would be appreciated. Edited by - Omaha on January 12, 2002 2:52:57 AM

Share this post


Link to post
Share on other sites
I adapted your code to a GL project of mine and it worked fine, are you sure everything is set up and is being created properly?

Sorry I couldn''t be of more help...

---
No game will ever rule more than CBT!

Share this post


Link to post
Share on other sites
Drat! Well, I guess I'll have to look elsewhere. I appreciate the response. No "How very odd..." message box popped up for you?

You made a call, later, to (or something functionally equivelent) glCallList(FontDisplayLists[FONT_DEFAULT]+insert_character_index_here) I'll assume?

I will look through other parts of my code related to initialization and whatnot. I have no idea what the problem could be though.

Thanks again!

Edited by - Omaha on January 12, 2002 9:59:33 AM

Share this post


Link to post
Share on other sites
For some reason the first call I make to wglUseFontBitmaps always fails. Weird. I worked around it by having one dummy call before any important ones.

Share this post


Link to post
Share on other sites