当我尝试使用以下代码绘制一些字符串时:

    // label min and max for current vector
    glRasterPos2f(nx+1,y1);
    glutBitmapString(GLUT_BITMAP_8_BY_13,"min");

    glRasterPos2f(nx+1,y2);
    glutBitmapString(GLUT_BITMAP_8_BY_13,"max");

我得到了错误
error: ‘glutBitmapString’ was not declared in this scope

在编译时。疯狂的是
    // label min and max for current vector
    glRasterPos2f(nx+1,y1);
    glutBitmapCharacter(GLUT_BITMAP_8_BY_13,'1');

    glRasterPos2f(nx+1,y2);
    glutBitmapCharacter(GLUT_BITMAP_8_BY_13,'2');

编译就可以了,所以这不是我没有包括glut库或其他任何东西(我也有glutSwapBuffers()和数十亿其他glut调用!)

为什么地球上glutBitmapString()无法编译?我已经检查了拼写和所有内容,但不会编译!

最佳答案

您正在使用哪种Glut实现?根据FreeGlut文档,原始的Glut不包含glutBitmapString
http://freeglut.sourceforge.net/docs/api.php#FontRendering

实际上,Glut文档中没有提及glutBitmapString http://www.opengl.org/resources/libraries/glut/spec3/node75.html#SECTION000110000000000000000

如果您确实需要使用此功能,则看起来您将需要使用FreeGlut。

10-08 07:51