VS2015 5opengl library configuration tutorial under VS2015

Source: Internet
Author: User

VS2015 5opengl library configuration tutorial under VS2015

Preface:

Recently, OpenGL is used. It takes a lot of effort to configure it in VS2015. Now, I will contribute my achievements directly to you, it is hoped that it will save some trouble for readers who need to configure OpenGL in VS2015.

Body:

Resource address: OpenGL installation package

Resources are compiled and can be used directly for test.

After the resources are downloaded, decompress openglinstallation package. Zip. In the "OPenGL installation package" folder, you can see the Demo, freeglut, glew, gltools, and glut folders, where Demo is the sample program, and the remaining four are the installation packages.

The configuration is briefly described below.

1. glew Configuration

The glew folder contains the compiled and src folders. The compiled folder contains the compiled installation package and the src folder contains the source code. The following code is configured with the compiled installation package. The source code in the src folder is prepared for installing gltools (see the appendix below ). If you want to use the source code to install glew, please explore it on your own. The installation steps are as follows.

1. Decompress compiledfolder named “glew-2.0.0-win32.zip to get the glew-2.0.0 folder.

2. find the installation directory of VS2015. If it is installed on drive C, most of them are similar to the path C: \ Program Files (x86) \ Microsoft Visual Studio 15.0. If it is installed on another disk, the directory is "D: \ Software Installation \ VS2015". For the sake of convenience, the following directories are all described later.

3. find the header file directory of C ++, for example, "D: \ Software Installation \ VS2015 \ VC \ include", and create a GL folder under the include directory (if not ).

4. Copy the 4 header files in the glew-2.0.0 \ include \ GL folder in 1 to the GL folder in 3.

5. Copy the glew32.dll under glew-2.0.0 \ bin \ Release \ Win32 to the d: \ Software Installation \ VS2015 \ VC \ bin directory.

6. Copy the two lib files under glew-2.0.0 \ lib \ Release \ Win32 to the d: \ Software Installation \ VS2015 \ VC \ lib directory.

Note,You do not need to copy the dll file to C: \ Windows \ System32 or C: \ Windows \ SysWOW64.

So far, the glew configuration is complete.

2. glut Configuration

1. decompress the named gludlls37beta.zip under the folder to obtain five files: glut. h, gult. dll, glu32.dll, glut. lib, and glu32.lib.

2. Copy glut. h to the Directory D: \ Software Installation \ VS2015 \ VC \ include \ GL.

3. Copy gult. dll and glu32.dll to the d: \ Software Installation \ VS2015 \ VC \ bin directory.

4. Copy glut. lib and glu32.lib to the d: \ Software Installation \ VS2015 \ VC \ lib directory.

So far, the glut configuration is complete.

3. freeglut Configuration

1.decompress freeglut-msvc-3.0.0-2.mp.zip under the freeglutfile folder to obtain the freeglut folder.

2. there are 4 header files in the freeglut/include/GL directory, except for glut. copy three headers other than h to the D: \ Software Installation \ VS2015 \ VC \ include \ GL directory.

3. Copy the freeglut. dll file in the freeglut/bin directory to the D: \ Software Installation \ VS2015 \ VC \ bin directory.

4. Copy the freeglut. lib file under the freeglut/lib directory to the D: \ Software Installation \ VS2015 \ VC \ lib directory.

Now, freeglut configuration is complete.

4. Configure gltools

1. Copy all the 11 header files under the gltools \ include directory to the D: \ Software Installation \ VS2015 \ VC \ include directory (note that the include directory is not the GL subdirectory ).

2. Copy the gltools. lib file under the gltools \ lib directory to the D: \ Software Installation \ VS2015 \ VC \ lib directory.

So far, the gltools configuration is complete.

So far, OpenGL configuration is complete.

Test

1. Create a Win32 console application.

2. Copy all files under the Demo \ Block directory to the new project directory (for example, E: \ OpenGLTest)

3. Right-click the "source file" and choose "add"> "existing items" to add the Block. cpp file in 2 to the project.

4. Add # pragma comment (lib, "gltools. lib") after the include statement of the Block. cpp file ").

5. Compile and run the program. The result is as follows:

Press the Space key and the style of the cube in the center will change. There are 6 types of changes and 6 types of changes are cyclical.

How to compile and generate gltools. lib in Appendix

Note:To compile and generate gltools. lib, you must configure glew first. The following describes the compilation steps.

1. Copy all the 11 header files under the gltools \ include directory to the D: \ Software Installation \ VS2015 \ VC \ include directory (note that the include directory is not the GL subdirectory ).

2. Start VS2015 and create a Win32 application named gltools.

3. Select "static library" and tick off the pre-compiled header.

4. Copy the six file files under the gltools \ src directory to the new project directory (for example, E: \ gltools ).

5. Right-click the "source file" and choose "add"> "existing items" to add the six files in Step 4 to the project.

Note that the glew. c here is the glew. c file under the glew \ src \ glew-2.0.0 \ src directory.

6. Generate --> Generate gltools

During compilation, there will be a warning that the "dll link inconsistency" is pushed. (If you have tried all the methods available on the Internet, it is useless. If you want to know the solution, please kindly advise ), however, the compilation was successful.

7. You can find the generated gltools. lib file in the E: \ gltools \ Debug directory.

So far, the compilation of gltools is complete.

Written below:

Your mistakes are inevitable. Please criticize and correct your mistakes. Your criticism and help are the inexhaustible motive force for your future development.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.