wglUseFontBitmaps and SDL

Is it possible to use wglUseFontBitmaps with SDL? If so, what do you send as the first (HDC) parameter?

I noticed that SDL provides SDL_SysWMinfo with an HWND member, giving you a handle to the window. So i tried doing:

SDL_SysWMinfo wminfo;
SDL_GetWMInfo(&wminfo);
mhwnd = wminfo.window;
mhdc = GetDC(mhwnd);

Then I send mhdc as the first parameter to wglUseFontBitmaps and SelectObject(). That didnt work - no text was displayed.

I also tried using mhdc = wglGetCurrentDC() for the first parameter.
That crashed the program as soon as I tried to call the font lists.

Here are my font functions:

void MyFont::LoadFont(HDC hdc, char * name, int height, int weight, DWORD italic)
{

mbase = glGenLists(256);

HFONT fontid = CreateFont(height,0,0,0,weight,italic,
							FALSE, FALSE, ANSI_CHARSET,
							OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
							DRAFT_QUALITY, FF_DONTCARE|DEFAULT_PITCH, name);

SelectObject(hdc, fontid);

wglUseFontBitmapsW(hdc, 0, 256, mbase);
GetCharWidth(hdc,0,255,mwidths);

mloaded = 1;

}

void MyFont::PutString(char * string)
{
glPushAttrib(GL_LIST_BIT);
glListBase(mbase);
glCallLists(strlen(string),GL_UNSIGNED_BYTE, string);
glPopAttrib();

}

I’m pretty sure the problem is the HDC parameter I’m passing in. Does anyone know how to get the proper HDC when using SDL? Or is it even possible to use wglUseFontBitmaps with SDL? Please help.

[This message has been edited by ioquan (edited 06-13-2002).]