Windows 8.1+VS2013 配置 OpenGL
来源:互联网 发布:交通组织优化有哪些 编辑:程序博客网 时间:2024/06/05 09:29
转自: http://blog.csdn.net/lvhao578041381/article/details/18971691
一. 下载OpenGL代码——glut(The OpenGL Utility Toolkit)
glut下载地址: http://www.opengl.org/resources/libraries/glut/glut_downloads.php
for windows的code:
http://user.xmission.com/~nate/glut.html
其中:
Ø glut-3.7.6-bin.zip : GLUT forWin32 dll, lib and header file (everything you need to get started programmingwith GLUT).
Ø glut-3.7.6-src.zip : GLUTsource code distribution (including a whole slew of great example programs +data).
现使用glut-3.7.6-bin.zip配置环境。
二. VS2013配置
1. Copy your glut.h to:<drive>:\<VC++ path>\include\GL\glut.h
*** put the drive where you installed VC++ instead of the<drive>
*** put the directory where you installed VC++ instead of the<VC++ path>
比如,glut.h---> C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\GL\ (新建一个GL的文件夹)
2. Copy your glut32.lib to:
<drive>:\<VC++path>\lib\glut32.lib
*** put the drive where youinstalled VC++ instead of the <drive> ***
*** put the directory whereyou installed VC++ instead of the <VC++ path>
比如,glut32.lib --->C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib
3. Copy glut32.dllinto your windows directory (windows or winnt, depends on if you are usingWindows95/98 or Windows NT)
注意:glut32.dll ---> C:\Windows\SysWOW64 (windows8.1 64位操作系统)
---> C:\Windows\System32 (windows8.1 32位操作系统)
比如,本人系统64位,因此glut32.dll ---> C:\Windows\SysWOW64
4.打开vs2013,随便打开或新建一个项目。选择 project->project property-> ConfigurationProperties->Linker->Input->Additional Dependencies 在其中添加opengl32.lib;glu32.lib;glut32.lib
三. 测试
在工程中添加如下代码编译(32位)即可。
注意:用x64编译不行,因为glut32.lib是给32位编译用的。
//glExampl01.cpp : Defines the entry point for the console application.#include <Gl/glut.h>void myDisplay(void){ glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0, 0.0, 0.0); glBegin(GL_LINES); glVertex2i(180, 15); glVertex2i(10, 145); glEnd(); glRectf(-0.5f, -0.5f, 0.5f, 0.5f); glFlush();}void init(void){ glClearColor(1.0, 1.0, 1.0, 0.0); glMatrixMode(GL_PROJECTION); gluOrtho2D(0.0, 200.0, 0.0, 150.0);}int main(int argc, char * argv[]){ glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE); glutInitWindowPosition(50, 100); glutInitWindowSize(400, 300); glutCreateWindow("OpenGL"); init(); glutDisplayFunc(&myDisplay); glutMainLoop(); return 0;}
——————————————————————————————————————————————————————————————
编译时出错:
1>c:\program files\microsoft visual studio 8\vc\include\stdlib.h(406) : error C2381: 'exit' : redefinition; __declspec(noreturn) differs1> c:\program files\microsoft visual studio 8\vc\platformsdk\include\gl\glut.h(146) : see declaration of 'exit'
搜索到solution:http://social.msdn.microsoft.com/Forums/en-US/aeacc105-2f6b-4480-862f-775a24c5e26e/what-means-active-win32-vs-win32?forum=csharpide
To fix the error, right click on the project name in the Solution Explorer tab and select Properties -> C/C++ -> Preprocessor -> Preprocessor definitions and append GLUT_BUILDING_LIB to the existing definitions, seperated by semicolons.
- Windows 8.1+VS2013 配置 OpenGL
- Windows 8.1+VS2013 配置 OpenGL
- VS2013配置opengl
- VS2013配置OpenGL
- Vs2013 OpenGL配置
- vs2013 opengl配置
- vs2013配置OpenGL
- VS2013配置OpenGL
- VS2013配置OpenGL
- VS2013+OpenGL配置
- VS2013+OpenGL配置
- OpenGL超级宝典Windows + VS2013开发环境配置
- OpenGL超级宝典第五版 Windows + VS2013配置
- OpenGL(一)《OpenGL超级宝典第五版》Windows + VS2013配置
- vs2013配置openGL编译环境
- OpenGL+VS2013+WIN7(64)配置
- Win8.1 VS2013 配置 OpenGL
- VS2013配置OpenGL编译环境
- [ExtJS5学习笔记]第二十二节 Extjs5中使用beforeLabelTpl配置给标签增加必填选项星号标志
- OGG-01224 Bad file number
- android 部分韩国手机采用KSC5601编码保存联系人,MTK平台手机无法显示联系人姓名
- redhat6.4 tftp服务器配置
- IGMP 因特网组管理协议
- Windows 8.1+VS2013 配置 OpenGL
- TAR门限模型
- 导航菜单的实例
- epoll使用详解(精髓)
- android Copy联系人到SIM卡时,如何对姓名自动截断
- 简单总结我对单例模式的理解
- 耶稣有13个门徒,其中有一个就是出卖耶稣的叛徒,请用排除法找出这位叛徒:13人围坐一圈,从第一个开始报号:1,2,3,1,2,3„„,凡是报到“3”就退出圈子,最后留在圈内的人就是出卖耶稣的叛徒,请找
- 代码编辑神器VIM安装及使用入门教程
- C++中的new和delete在类中的应用