不管是DirectX9还是GDI,处理文本都是很方便的,但是在OpenGL中,我似乎没找到很方便的处理方式,在网上搜了一下,结果如下:
在http://www.opengl.org/resources/features/fontsurvey/ 里说,处理OpenGL处理文本有三种方式,我试用了一种。
这里要用到glut(把glut下载下来,把头文件glut.h放到...\PlatformSDK\Include\gl下,把两个lib放到...\PlatformSDK\Lib,把两个dll放到system32下)

void* bitmap_fonts[7] = {
GLUT_BITMAP_9_BY_15,
GLUT_BITMAP_8_BY_13,
GLUT_BITMAP_TIMES_ROMAN_10,
GLUT_BITMAP_TIMES_ROMAN_24,
GLUT_BITMAP_HELVETICA_10,
GLUT_BITMAP_HELVETICA_12,
GLUT_BITMAP_HELVETICA_18
};
print_bitmap_string(void* font,const char* s)

{

if (s && strlen(s)) {

while (*s) {
glutBitmapCharacter(font, *s);
s++;
}
}
}
int CDGL::TextOut(int x,int y,const char* cstr,int color)

{
glRasterPos2f(x, y);
print_bitmap_string(bitmap_fonts[4], cstr);

return 1;
}
我在我的Plot3D项目里试用,能够用,尽管还不是很方便。