在OpenGL中怎样安装glut库
2014-12-21 20:38
183 查看
Visual C++用户:
1。下载GLUT库:http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
2。将压缩包内的glut.h放到.../Microsoft Visual Studio/VC98/Include/GL目录下
将glut32.lib放到.../Microsoft Visual Studio/VC98/Lib目录下
将glut32.dll放到X:/windows/systom32目录下(win98用户放到X:/windows/systom目录下)
3。建立一个控制台工程Win32 Console Application,加入hello.c并运行:
#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);/* clear all pixels */
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);/* draw white polygon with corners at(0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();/* start processing buffered OpenGL routines */
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);/* select clearing color */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);/* initialize viewing values */
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);/*Declare initial display mode(single buffer and RGBA).*/
glutInitWindowSize (250, 250); /*Declare initial window size.*/
glutInitWindowPosition (100, 100);/*Declare initial window position.*/
glutCreateWindow ("hello");/*Open window with "hello"in its title bar.*/
init ();/*Call initialization routines.*/
glutDisplayFunc(display); /*Register callback function to display graphics.*/
glutMainLoop();/*Enter main loop and process events.*/
return 0; /* ANSI C requires main to return int. */
}
DEVCPP用户:
1。下载GLUT库:http://www.cs.uofs.edu/~mpc3/cmps370/glut-MingW-DEV-C++.zip
2。将压缩包内的glut.h放到.../Dev-Cpp/include/GL目录下
将libglut.a和glut32.def放到.../Dev-Cpp/lib目录下
将glut32.dll放到X:/windows/systom32目录下(win98用户放到X:/windows/systom目录下)
3。建立一个控制台工程Console Application,修改工程属性project options中的参数parameter中的连接器linker,加入库或者对象addlibrary or object中加入:
.../Dev-Cpp/lib/libglu32.a
.../Dev-Cpp/lib/libglut32.a
.../Dev-Cpp/lib/libopengl32.a
或直接键入-lopengl32 -lglu32 -lglut32
4。加入hello.c并运行:
#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);/* clear all pixels */
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);/* draw white polygon with corners at(0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();/* start processing buffered OpenGL routines */
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);/* select clearing color */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);/* initialize viewing values */
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);/*Declare initial display mode(single buffer and RGBA).*/
glutInitWindowSize (250, 250); /*Declare initial window size.*/
glutInitWindowPosition (100, 100);/*Declare initial window position.*/
glutCreateWindow ("hello");/*Open window with "hello"in its title bar.*/
init ();/*Call initialization routines.*/
glutDisplayFunc(display); /*Register callback function to display graphics.*/
glutMainLoop();/*Enter main loop and process events.*/
return 0; /* ANSI C requires main to return int. */
}
1。下载GLUT库:http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
2。将压缩包内的glut.h放到.../Microsoft Visual Studio/VC98/Include/GL目录下
将glut32.lib放到.../Microsoft Visual Studio/VC98/Lib目录下
将glut32.dll放到X:/windows/systom32目录下(win98用户放到X:/windows/systom目录下)
3。建立一个控制台工程Win32 Console Application,加入hello.c并运行:
#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);/* clear all pixels */
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);/* draw white polygon with corners at(0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();/* start processing buffered OpenGL routines */
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);/* select clearing color */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);/* initialize viewing values */
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);/*Declare initial display mode(single buffer and RGBA).*/
glutInitWindowSize (250, 250); /*Declare initial window size.*/
glutInitWindowPosition (100, 100);/*Declare initial window position.*/
glutCreateWindow ("hello");/*Open window with "hello"in its title bar.*/
init ();/*Call initialization routines.*/
glutDisplayFunc(display); /*Register callback function to display graphics.*/
glutMainLoop();/*Enter main loop and process events.*/
return 0; /* ANSI C requires main to return int. */
}
DEVCPP用户:
1。下载GLUT库:http://www.cs.uofs.edu/~mpc3/cmps370/glut-MingW-DEV-C++.zip
2。将压缩包内的glut.h放到.../Dev-Cpp/include/GL目录下
将libglut.a和glut32.def放到.../Dev-Cpp/lib目录下
将glut32.dll放到X:/windows/systom32目录下(win98用户放到X:/windows/systom目录下)
3。建立一个控制台工程Console Application,修改工程属性project options中的参数parameter中的连接器linker,加入库或者对象addlibrary or object中加入:
.../Dev-Cpp/lib/libglu32.a
.../Dev-Cpp/lib/libglut32.a
.../Dev-Cpp/lib/libopengl32.a
或直接键入-lopengl32 -lglu32 -lglut32
4。加入hello.c并运行:
#include <GL/glut.h>
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);/* clear all pixels */
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);/* draw white polygon with corners at(0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();/* start processing buffered OpenGL routines */
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);/* select clearing color */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);/* initialize viewing values */
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);/*Declare initial display mode(single buffer and RGBA).*/
glutInitWindowSize (250, 250); /*Declare initial window size.*/
glutInitWindowPosition (100, 100);/*Declare initial window position.*/
glutCreateWindow ("hello");/*Open window with "hello"in its title bar.*/
init ();/*Call initialization routines.*/
glutDisplayFunc(display); /*Register callback function to display graphics.*/
glutMainLoop();/*Enter main loop and process events.*/
return 0; /* ANSI C requires main to return int. */
}
相关文章推荐
- 在OpenGL中怎样安装glut库
- windows下安装opengl的glut库(转)
- VC6.0上安装OpenGL的glut库
- OpenGL初使用,glut库安装(vs2013)
- Windows下安装openGL的glut库(openGL入门)
- OpenGL学习之windows下安装opengl的glut库
- OpenGL学习之windows下安装opengl的glut库
- windows下安装opengl的glut库
- windows下安装opengl的glut库
- windows下安装opengl的glut库
- Linux(Ubuntu)安装OpenGL/Glut库
- windows下安装opengl的glut库
- windows下安装opengl的glut库
- windows下安装opengl的glut库
- [OpenGL] glut库的安装
- openGL,glut库安装(vs2013)
- (Ubuntu)安装OpenGL/Glut库
- windows下安装opengl的glut库
- windows下安装opengl的glut库
- windows下安装opengl的glut库