OpenGL在w7下vs2010、vs2013及w8下vs2013配置

来源:互联网 发布:淘宝卖家催好评用语 编辑:程序博客网 时间:2024/04/30 14:29

所需资源:

下载glut

http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

这个应该都会下载。

解压之后得到的文件如下:



w7+vs2010配置

glut.h  ---> C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\Include\gl

glut.dll,glut32.dll --->C:\Windows\SysWOW64 (windows7 64位操作系统)

                        ---> C:\Windows\System32   (windows7 32位操作系统)

glut.lib,glut32.lib ---> C:\Program Files(x86)\Microsoft Visual Studio 10.0\VC\lib         ;此处为vs2010安装目录


w7+vs2013配置

看过很多w7下在vs2013中配置OpenG的文档,其中比较好的有 http://www.cnblogs.com/mr-p/p/3579046.html

但是过于复杂,推荐一种简单的方法:

glut.h  ---> D:\Program Files(x86)\vs2013\VC\Include\GL             ;此处为vs2013安装目录

                                                                                                                ;GL自己新建

glut.dll,glut32.dll --->C:\Windows\SysWOW64 (windows7 64位操作系统)

                        ---> C:\Windows\System32   (windows7 32位操作系统)

glut.lib,glut32.lib ---> D:\Program Files(x86)\vs2013\VC\lib         ;此处为vs2013安装目录



w8+vs2013配置

Glut.h就放到


另外四个文件的位置就比较好找了。

Dll文件就放在:


就ok了。

注意:上图是32位系统的,64位如下图

glut.dll,glut32.dll ---> C:\Windows\SysWOW64(windows7 64位操作系统)

                        ---> C:\Windows\System32   (windows7 32位操作系统)

 

Lib文件就放在:


这个其实就是放在安装VS2013那个安装 文件中,找到VC即可。



测试是否配置成功:

#include <GL/glut.h>         /* glut.h includes gl.h and glu.h*/void display(void){/* clear window */glClear(GL_COLOR_BUFFER_BIT);/* draw unit square polygon */glBegin(GL_POLYGON);glVertex2f(-0.5, -0.5);glVertex2f(-0.5, 0.5);glVertex2f(0.5, 0.5);glVertex2f(0.5, -0.5);glEnd();/* flush GLbuffers */glFlush();}void init(){/* set clear color to black */glClearColor(0.0, 0.0, 0.0, 0.0);/* set fill  color to white */glColor3f(1.0, 0.0, 0.0);/* set up standard orthogonal view with clipping *//* box as cube of side 2 centered at origin *//*This is default view and these statement could be removed */glMatrixMode(GL_PROJECTION);glLoadIdentity();glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0);}void main(int argc, char** argv){/* Initialize mode and open a window in upper left corner of screen *//* Window title is name of program (arg[0]) */glutInit(&argc, argv);glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);glutInitWindowSize(500, 500);glutInitWindowPosition(0, 0);glutCreateWindow("simple");glutDisplayFunc(display);init();glutMainLoop();}



0 0