OpenGL Super Collection fifth edition + VS2010/2012 environment configuration

For the fifth edition of the OpenGL Super Collection environment, please refer to this blog http://www.zyh1690.org/build-opengl-super-bible-fifth-edition-development-environment/ But there are still some details that are a bit problematic. It is based on some comments in this blog to build successfully. The most important thing is to be careful. Although this build environment is for VS2010, I helped students build it successfully under VS2012. So I think this is suitable for everything above VS210. The VS+OpenGL environment configuration is that the files to be added under Microsoft Visual Studio 10.0 become related files added under Microsoft Visual Studio 12.0.

Configuration Environment:

win7 X64 + Visua Studio 2010

Tools needed:

1

Build:

freeglut

Open the  x:\x\freeglut-2.8.1\VisualStudio\2010\freeglut.sln  project,

2

Solutions have been generated in Debug mode and Release mode respectively . (You can only generate one. It is recommended to compile in debug mode, no need to execute. If a black box pops up when running, just ignore it. Note that for 32-bit operating systems , if you encounter freeglut_static when running the code of Sapphire Chapter01\Block, .lib cannot open the problem, you should select Debug_Static mode to recompile, generate the required freeglut_static.lib, and add it to the specified folder . )

You will  see the generated .dll  and  .lib  files in the  x:\x\freeglut-2.8.1\lib\x86 directory.  Please  add _d  to the .dll  and  .lib  files  in the Debug directory  to distinguish them later. As shown:

3

 

Copy  the  .h file in  the  x:\x\freeglut-2.8.1\include\GL folder to the  x:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\GL  directory, there is no GL folder You have to build it yourself .

Copy the .dll  files in the  x:\x\freeglut-2.8.1\lib\x86  folder (and the Debug folder)  to the  C:\Windows\SysWOW64  directory ( x86 is  copied to the  System32 directory).

Copy the .lib file in the  x:\x\freeglut-2.8.1\lib\x86  folder (and the Debug folder)  to  x:\x\Microsoft Visual Studio 10.0\VC\lib .

At this point, freeglut is done!

Glew

 Copy the .h file in the  x:\x\glew-1.11.0\include\GL folder to the  x:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\GL  directory.

Copy  the  .lib file in the  x:\x\glew-1.11.0\lib\Release\Win32 folder to the  x:\x\Microsoft Visual Studio 10.0\VC\lib  directory.

Copy  the  .dll file in the  x:\x\glew-1.11.0\bin\Release\Win32 folder to the  C:\Windows\SysWOW64  directory. (If not, skip it)

Glut

 x:\x\glutdlls37beta 文件夹下的 .h文件 复制到 x:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\GL 目录下。

把 x:\x\glutdlls37beta 文件夹下的 .lib文件 复制到 x:\x\Microsoft Visual Studio 10.0\VC\lib 目录下。

把 x:\x\glutdlls37beta 文件夹下的 .dll文件 复制到 C:\Windows\SysWOW64 目录下。

构建GLTools库

新建一个gltoolswin32项目工程,如图:

a

 

b

先编译一下,(原文这里有错误,下面是我修改的)

把 x:\x\SB5\Src\GLTools\src 目录下的.cpp文件不包括glew.c文件)复制到 x:\x\gltools\gltools。

 x:\x\SB5\Src\GLTools\include 目录下的.h文件不包括GL文件夹)复制到 x:\x\gltools\gltools。

分别在头文件和源文件上右键 添加->现有项 把 .h 和 .cpp 文件添加到项目。如图:

d

注:在编译GLTools前需要更改其项目属性 > C/C++ > 预处理器右边的预处理器定义中添加 _CRT_SECURE_NO_WARNINGS

 

编译提示如下:

e

gltools.lib 文件生成成功。可以在 x:\x\gltools\Debug 目录下查看。

把 .lib文件 复制到 x:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib 文件夹下。

把 .h文件 复制到 x:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include 文件夹下(注意这次不是GL文件夹)。

到此gltoolsOK了。

测试

We use the examples given in the book to test the environment.

The project project to establish the test:

f

g

We use the example in Chapter 1 to test, copy  the files in  x:\x\ SB5\Src\Chapter01\Block  to the x:\x\test\test  folder. Also right-click on the source file to  add -> Existing Item to include the Block.cpp file.

Add additional dependencies (the first picture) : (This method of adding dependencies is only effective for the current test project. In order to allow other projects to use these .lib files, you should add dependencies in the property manager. See the second figure below for details)

h


Compile and run the project, the effect is as follows:

Press the space bar to change the display effect. There are six effects in total. I only post the three effect pictures 1, 3, and 6 here :

1

3

6

The above configuration is still a step, so this step should be added when building:

You also need to copy freeglut_static.lib in \OpenGL Super Collection\SB5\SB5\freeglut-2.6.0\VisualStudio2008Static\Release to x:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib to run successfully.

If c:\project\gltools\gltools\math3d.cpp(45): fatal error C1083: cannot open include file: "math3d.h": No such file or directory and other header files cannot be found, you need to put VC The include folder inside also adds math3d.h and other header files to run.

Guess you like

Origin blog.csdn.net/u011105442/article/details/53435031