glutBitmapString() 未在此范围内声明
当我尝试使用以下代码绘制一些字符串时:
// 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() 不能编译?我已经检查了拼写和所有内容,但它无法编译!
when i try to plot some strings with the following code:
// 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");
i get the error
error: ‘glutBitmapString’ was not declared in this scope
upon compilation. the crazy thing is that
// 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');
compiles just fine, so it's not like i have not included the glut library or anything (i have glutSwapBuffers() and a bajillion other glut calls as well!)
why on earth won't glutBitmapString() compile? i have checked the spelling and everything, and it just won't compile!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需添加一行:
该函数是freeglut添加的新函数,在glut中没有退出
just add one line:
This function is a new function added by freeglut which is not exited in glut
您使用什么 Glut 实现?根据 FreeGlut 文档,原始 Glut 不包含
glutBitmapString
http ://freeglut.sourceforge.net/docs/api.php#FontRendering
事实上,Glut 文档中没有提到
glutBitmapString
http://www.opengl.org/resources/libraries/glut/spec3/node75.html#SECTION00011000000000000000
如果你真的需要使用这个函数,看起来你需要使用 FreeGlut 。
What implementation of Glut are you using? According to the FreeGlut documentation, the original Glut does not include
glutBitmapString
http://freeglut.sourceforge.net/docs/api.php#FontRendering
And indeed, there is no mention of
glutBitmapString
in the Glut documentationhttp://www.opengl.org/resources/libraries/glut/spec3/node75.html#SECTION000110000000000000000
If you really need to use this function it looks like you will need to use FreeGlut.