2024-04-24 03:31:34
我想你可能是没有设置字体,或者选择的字体系统不支持,我试了一下,好像没有这个问题.下面是我试验示的代码(初始化m_hRC略去,用的是双缓冲,单缓冲应该没什么问题吧,呵呵),但愿能对你有些帮助.
void CMyGlView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
wglMakeCurrent(pDC->m_hDC,m_hRC);
SelectObject(pDC->m_hDC,GetStockObject(SYSTEM_FONT));
glClearColor(0.0f,0.0f,0.4f,1.0f);
glClear(GL_COLOR_BUFFER_BIT);
wglUseFontBitmaps(pDC->m_hDC,0,256,1000);
glRasterPos2f(0.0f,0.0f);
glListBase(1000);
glCallLists(24,GL_UNSIGNED_BYTE,"Hello Win32 OpenGL World");
SwapBuffers(pDC->m_hDC);
glDeleteLists(1000,256);
wglMakeCurrent(NULL,NULL);
}