请问在OpenGL里如何显示中文?
照下面的代码,显示中文失败,是乱码。
void tl_Font::
DrawString(float x, float y, float z, const unsigned char *str)
{
HDC hDC = wglGetCurrentDC();
DWORD dwChar;
int ListNum;
for(size_t i=0; i<strlen((char *)str); i++)
{
if (IsDBCSLeadByte(str[i]))
{
dwChar = (DWORD)((str[i]<<8) | str[i+1]);
i++;
}
else
dwChar = str[i];
glDisable(GL_TEXTURE_2D);
glRasterPos3f(x, y-_nHeight, z);
ListNum = glGenLists(1);
wglUseFontBitmaps(hDC, dwChar, 1, ListNum);
glCallList(ListNum);
glDeleteLists(ListNum, 1);
glEnable(GL_TEXTURE_2D);
}
}
请问各位高手,我哪里错了:)
谢谢!
在OpenGL中显示中文通常是用什么办法呢?
请教!