开发者

glutBitmapString() was not declared in this scope

开发者 https://www.devze.com 2023-04-09 07:58 出处:网络
when i try to plot some strings with the following code: // label min and max for current vector glRasterPos2f(nx+1,y1);

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);
    glutBitmapS开发者_开发百科tring(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!


just add one line:

#include < GL/freeglut.h>

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号