当我尝试使用以下代码绘制一些字符串时:
// 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');
编译得很好,所以我并不是没有包含过剩库或任何东西(我有 glutSwapBuffers() 和大量其他过剩调用!)
为什么 glutBitmapString() 不能编译?我已经检查了拼写和所有内容,但它无法编译!
最佳答案
只需添加一行:
#include < GL/freeglut.h>
该函数是freeglut新增的函数,glut中没有退出
关于c++ - glutBitmapString() 未在此范围内声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7611153/