opengl 学习笔记(1)setting up opengl

 setting up opengl

Windows does not include GLUT standard. The following steps will help you to figure out how to make it work:
1. Download GLUT and unzip. Then:
2. Put the file "glut32.dll" into the system path (or see table below)
• This can be in the same directory as your executable file.
• On Windows 32 bit or earlier, this can be in "C:\WINDOWS\system32"
• On Windows 64 bits: C:\Windows\SysWOW64\
• Or you can create a directory like "C:\DLLs", put the file in this directory and change your system path to include this new directory.
• Do this by opening Control Panel -> System, clicking on "Advanced System Settings", followed by "Environment Variables", and editing the "Path" variable.
3. Put the file "glut.h" into the standard Visual C++ include directory
• For Visual Studio 2015, this should be: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\gl\
• Optionally can be put in: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\gl") - You've got the right directory if you see a copy of "gl.h"
4. Put the file "glut32.lib" into the standard Visual C++ library directory
• For Visual Studio 2015, this should be:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\
• There should be lots of .lib files here, including "opengl32.lib" and "glu32.lib".
• Optionally C:\Program Files\Microsoft SDKs\Windows\v7.1A\lib
5. Make sure your Visual C++ project links in the GLUT/gl/glu libraries. This is located in:
• Menu: "Project -> (your-project-name) Properties"
• Tab: "Configuration Properties -> Linker -> Input"
• Under "Additional Dependencies", add "glut32.lib glu32.lib opengl32.lib"
6. #include < GL/glut.h > in your program.
• Note: This needs to come after you #include < stdio.h > and < stdlib.h >.
• Note: < GL/gl.h >. Is included within glut.h therefore, no need to include gl.h
• Also note that glut.h includes gl.h for you (so you need not explicitly #include < GL/gl.h >).
Create a new project (Visual C++, Win32 Console Application) and then: Right-click the project you created, go to Properties, then open Configuration Properties\Linker\Input and add the following to the “Additional Dependencies” field: “opengl32.lib;glut32.lib;glu32.lib”.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值