MinGW 链接 glut 库编译 OpenGL 项目
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
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
相关推荐
wztwzt 2019-08-16
zhjn0 2011-09-19
rootdream 2011-05-20
aliceiwill 2011-12-23
tianshuijun 2019-02-15
csgvsjay000 2016-08-10
87560795 2013-12-27
不知鲸又是鱼 2010-01-15
yangyasong 2014-09-14
一点一刻 2014-01-26
qifei 2013-06-01
newdelete 2012-07-24
Blaze 2016-12-11
编程爱好者联盟 2016-10-25