1.Bind Howto:
Download the glut library from
http://www.opengl.org/resources/libraries/glut/glut_downloads.php
glut-3.7.6-bin/
glut32.dll -> C:\Windows\System32
glut32.lib -> C:\MinGW\lib
glut.def -> C:\MinGW\lib
glut.h -> C:\MinGW\include\GLmain.c
2.Example:
#include <GL/glut.h>
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-0.5f, -0.5f, 0.5f, 0.2f);
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(400, 400);
glutCreateWindow("第一個OpenGL程序");
glutDisplayFunc(&myDisplay);
glutMainLoop();
return 0;
}
3.about the Makefile:
target:
gcc -o test main.c -D_STDCALL_SUPPORTED -D_M_IX86 -DGLUT_DISABLE_ATEXIT_HACK -lopengl32 -lglu32 -lglut32