glutBitmapString() 未在此范围内声明

发布于 2024-12-07 10:15:07 字数 727 浏览 1 评论 0原文

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

    // 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

睫毛上残留的泪 2024-12-14 10:15:07

只需添加一行:

#include < GL/freeglut.h>

该函数是freeglut添加的新函数,在glut中没有退出

just add one line:

#include < GL/freeglut.h>

This function is a new function added by freeglut which is not exited in glut

爱格式化 2024-12-14 10:15:07

您使用什么 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 documentation
http://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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文