3

I tried to run some opengl program in Xcode, but it always failed by showing an error:use of undeclared identifier 'GLUT_3_2_CORE_PROFILE'. I tried the .cpp documents on terminal, the error seems the same, error: ‘GLUT_3_2_CORE_PROFILE’ was not declared in this scope. I don't know what's the problem, how can I fix this? My mac version is 10.7, xcode version is 4.5. Thanks.

int main(int argc, char** argv)
 {
 glutInit(&argc, argv);

#ifdef __APPLE__
glutInitDisplayMode(GLUT_3_2_CORE_PROFILE | GLUT_RGBA | GLUT_DOUBLE);
#else
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
glutInitContextVersion (3, 2);
glutInitContextFlags (GLUT_FORWARD_COMPATIBLE);
#endif
glutInitWindowSize(512, 512);
glutInitWindowPosition(500, 300);
glutCreateWindow("Simple Open GL Program");
printf("%s\n%s\n", glGetString(GL_RENDERER), glGetString(GL_VERSION));

init();


glutKeyboardFunc(keyboard);
glutDisplayFunc(display);
glutMainLoop();

return(0);
}

This is the main part, and the result is only to show a red square.

4

0 回答 0