drjrm3
drjrm3

Reputation: 4728

glutBitmapString() was not declared in this scope

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!

Upvotes: 2

Views: 8843

Answers (2)

Aaron
Aaron

Reputation: 139

just add one line:

#include < GL/freeglut.h>

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

Upvotes: 4

Alan
Alan

Reputation: 1945

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.

Upvotes: 2

Related Questions