Xcode下搭建OpenGL开发环境
#include <GLUT/GLUT.h>
void display()
{
glClear(GL_ENABLE_BIT);
glBegin(GL_POLYGON);
glVertex2f(-0.5, -0.5);
glVertex2f(-0.5, 0.5);
glVertex2f(0.5, 0.5);
glVertex2f(0.5, -0.5);
glEnd();
glFlush();
}
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutInitWindowSize(400, 400);
glutCreateWindow("test");
glutDisplayFunc(display);
glutMainLoop();
}