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.
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().