'Use of undeclared identifier 'glutBitmapString' in Xcode
I am using Xcode. I have already linked OpenGL.framework and GLUT.framework.
Here is my code btw
#ifdef __APPLE__
#define GL_SILENCE_DEPRECATION
#include <OpenGL/gl.h>
#include <GLUT/glut.h>
#else
#include <GL/gl.h>
#include <GL/glut.h>
#endif
using namespace std;
void func(){
glClear(GL_COLOR_BUFFER_BIT);
const unsigned char str[100] = {"some message"};
glColor3f(0.0f, 0.0f, 1.0f);
glRasterPos2f(0.0, 0.0);
glutBitmapString(GLUT_BITMAP_HELVETICA_18, str); //Use of undeclared identifier 'glutBitmapString'
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc,argv);
glutCreateWindow("simple");
glutDisplayFunc(func);
glutMainLoop();
}
Solution 1:[1]
Make sure you're using FreeGLUT or some other GLUT implementation that supports glutBitmapString():
...
3.4.5 String Rendering
New functions have been added to render full character strings (including carriage returns) rather than rendering one character at a time. More functions return the widths of character strings and the font heights, in pixels for bitmapped fonts and in OpenGL units for the stroke fonts.
glutBitmapString() is not a part of the GLUT 3.X spec, which only has character-by-character drawing functions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | genpfault |
