c++ - glutBitmapString() 未在此范围内声明

标签 c++ opengl compilation glut

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

    // 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/

相关文章:

c++ - OpenGL,具有正交投影的几何着色器

c++ - 在 C++ 编译器上安装 OpenCV

c++ - 使用顶点数组、四边形数组创建四边形网格

c++ - 在vs2012中使用opencv加载和显示图像

c++ - 为 OpenGL 编写我自己的三角形光栅化程序?

scala - 在 Scala 中使用方法名称 "x"和隐式转换

c - 编译C程序时 undefined symbol

c++ - Magic++ RGB 颜色值

c++ - 指针 vector 中的内存泄漏

java - 如何在不使用 glRotateF 内置函数的情况下在 JOGL 中绕 Z 轴旋转图像