void CFont::DrawBoldText(int x,int y,char *str)
{
SelectObject(g_hDC,m_Bold);
wglUseFontBitmaps(g_hDC,32,96,m_BoldBase);
glRasterPos2i(x,y);
glPushAttrib(GL_LIST_BIT);
glListBase(m_BoldBase - 32);
glCallLists((int)strlen(str),GL_UNSIGNED_BYTE,str);
glPopAttrib();
}
void CFont::DrawText(int x,int y,char *str)
{
SelectObject(g_hDC,m_Normal);
wglUseFontBitmaps(g_hDC,32,96,m_NormalBase);
glRasterPos2i(x,y);
glPushAttrib(GL_LIST_BIT);
glListBase(m_NormalBase - 32);
glCallLists((int)strlen(str),GL_UNSIGNED_BYTE,str);
glPopAttrib();
}
Switching Bitmap Fonts
When my program initializes it creates two fonts using CreateFont from the win32 API. It uses opengl to create the display lists for each different font.
ii have this function for drawing text:
Calling SelectObject and wglUseFontBitmaps is very costly but if i dont do it the fonts dont change.
I want to know what the proper way of switching between bitmap fonts is. And any ways that i can speed up my bitmap font drawing
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement