View Full Version : Problem with Bitmap fonts in OpenGL!

01-13-2004, 12:02 AM
I am using wglFontBitmaps() to display text on an opengl screen. I am working on a multi-window application. If I use this function in the first window it works fine. But when I open new windows and use wglFontBitmaps() in them for the first time, the function returns with an error. But after the first call to wglFontBitmaps(), the function works fine.

Can anyone help me regarding this?

01-13-2004, 12:22 AM
Do you change listBase value?

01-13-2004, 12:33 AM
Originally posted by wolfman:
Do you change listBase value?

I do change that, but the thing is that since both the windows have seperate opengl rendering contexts so both have seperate display lists. So, for window 1 I can start creating fonts at base index 1 and for window 2 I can start creating fonts at base index 1 as well. The problem is that when I create the first font in the new window, wglUseFontBitmaps() returns error, but after that it works just fine. Here is the code I am using:

// Get the font base index
int font_list_base = glGenLists(256);

// Create the bitmap fonts for OpenGL
wglUseFontBitmaps(m_curr_pDC->m_hDC, 0, 255, font_list_base)

I have already selected a font in the device context before calling wglUseFontBitmaps().