VS2015 Some libraries that configure OpenGL

Source: Internet
Author: User

OpenGL is a very low default version under Windows and needs to update the driver itself, which contains the latest functions. OpenGL is a protocol that implements some functions. For different versions, in the enhancement, the aspect of rendering and you play the difference. This should be combined with the 1th.

1 Experimental Environment collocation

What exactly does the environment match? Download the library, is actually three files, dynamic library files, static library files and header files, copy them to some directories can be, then learn how to reference the library in code, static files and # include header files like, vs to add #pragma comment (lib, "path") To reference an external static library. Well, that's jiangzi. Very simple.

1.1 What is a dynamic library, a static library?

Dynamic Library: The program runs when loading, in the compile time without, put in the C:\windows directory or the directory of the. exe, which priority is better not know, I think is the current directory easy, the same kind of files in a relatively near place, memory of the nearest principle

Static Library: Compile the time to use, such as you need to call a function, a bit like a header file, to recompile, so compared to the dynamic library compile time to grow a bit. The default directory is placed in the installation Vs\vc\lib directory.

Header file: The default directory is placed in the installation Vs\vc\lib directory.

The paths for the above three libraries can be specified. Specifically, the additional library path in the Vs-Property-link is pressed. You can also add libraries here.

The static library can be used #pragma comment (lib "path"); It is important to have a dependency order between the different libraries here.

1.2 Case Analysis VS2015 Configuring OpenGL some of the libraries

(T t first time in VS configuration, spent a few hours, learned or some)

My platform is VS2015, the so-called environment configuration is the external library to be referenced in some way to let the compiler know you want to use this library. Then there is the header file, and OpenGL's operations are encapsulated in the library.

Library is someone else's written algorithm/function, provide an interface, is the function header to you, then why do you write.

Download a library online, after the choice of platform generally there are two ways, the source code and with a compiled package. Because the source code download after the compilation, the ultimate goal is to get dynamic static library. Here's how to handle these two libraries.

dependencies between different libraries, if there are dependencies between the two libraries, then unify the same version , such as release version, because different distributions support different functions

If you write the order of #pragma in the code, and then write another order in the Properties dialog box, the Order of the Properties dialog box on my computer, is this a good question? My guess is that the compiler compiles the source program and then links the library, but if there is no link to the library to compile, there will be undefined behavior, or the two are at the same time, that is, the idea of include, use the time to go to the library to find the function.

Libraries to install:

Glew Library with support for high-version OpenGL

GLFW for Window state operations (can be replaced as glut, glut is too old and has not been updated)

Matrix and other mathematical function library GLM, all header files, no libraries, very small

Load Picture Freeimage

Read the image data in different formats Assimp, this library configuration is a little cumbersome

See 1.1, How do you do it in the code?

The Code #pragma common (lib, "Path/.lib") refers to the static library. Include add header file.

It sounds like a simple look ...

Errors that may occur

# file directory not found, go to add directory

#pragma common (lib, "Glew32.lib") need to refer to a dynamic library, while Glew32s.lib is different.

# because Glew is placed first, because the other libraries may be replaced/overwritten, or their library file references a function of the Glew library. There may be an error code that undefine a function.

# [email protected] function undefined, duplicate definition, the library to the relationship between, you can try to change the order

# If there are dependencies between libraries, now I know only two, repeat the definition of function variables, this two library to engage with me, I think can only recompile it, in the file to add a conditional compilation. The second is a library of a function Reference B library function, then to have B again reference A, I configured the problem of this error a large number, combination of logic heuristic check bar T.

There is a dependency between the library is very tangled problem, compiler error many times will appear the irrelevant hint, if the Internet to find a dependency between the library, that is OK, but, there is no reliance on you to search! Because the library is already compiled, difficult to view, just detect.

Examples of recompiling libraries

ASSIMP Library directly downloaded down is VS06 VS08, if it is the above version,. lib. dll is useless, see the official website.

So we download the source code compiled. Take assimp-3.1.1 as an example.

Need to download the

-Assimp-3.1.1.zip package or Git down, open the Include directory after the header file can be used.

-DirectX SDK Download, installation

-CMake, a group of makefile in Assimp.

Steps:

Install CMAKE,DIRECX first, unzip. zip to get assimp-3.1.1 directory

Open cmake GUI (command line can also, tutorial see official website), add assimp-3.1.1 to the source directory, generate results you look at it, finally we generate the file right here, I set the Assimp-3.1.1\output directory, output is the one I just created

Click to start Confiure

Note: There are two major occurrences,

One is not to find DirectX, no installation, installed on the good.

The second is that zlib may be problematic, and the hint is that Makefilelist line fourth project (Zlib C) will project.

Zlib in the contrib (third party libraries) directory, open zlib, edit makefilelist Replace project (Zlib C) with the following code.

Cmake_policy (PUSH)

if (cmake_major_version GREATER 2)

Cmake_policy (SET CMP0048 old)

endif ()

Project (Zlib C)

Cmake_policy (POP)

Set (VERSION "1.2.8")

VS2015 Some libraries that configure OpenGL

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.