Lesson 1st: preparations before learning OpenGL

Source: Internet
Author: User
First, we will briefly introduce OpenGL:

As one of the mainstream graphics APIs, OpenGL has superior features in some cases than DirectX.
1. closely integrated with C.
OpenGL commands are initially described using C language functions. For those who have learned C language, OpenGL is easy to understand and learn. If you have been familiar with graphics. h of TC, you will find that it is even easier to plot Using OpenGL than TC.
2. Powerful portability.
Microsoft's direct3d is also a very good graphic API, but it is only used in Windows systems (now an Xbox game machine is added ). OpenGL is not only used for windows, but also for Unix/Linux and other systems. It is applicable to large computers and various specialized computers (such as medical display devices. In addition, the basic commands of OpenGL are hardware-independent or even platform-independent.
3. High-Performance graphic rendering.
OpenGL is an industrial standard, and its technology keeps up with the times. Currently, all graphics card manufacturers provide strong support for OpenGL, and the fierce competition leads OpenGL Performance.
In short, OpenGL is a very Nb graphic software interface. As to whether there are many Nb games, check out professional games such as doom3 and quake4.
OpenGL official website (English)
Http://www.opengl.org

Then, set the programming environment and install the necessary files as follows:

Step 1: select a compiling environment

Currently, mainstream windows compiling environments include Visual Studio, broland C ++ builder, Dev-C ++, and so on. They all support OpenGL. But here we choose VC ++ 6.0 as the learning OpenGL environment.

Step 2: Install the glut Toolkit

Glut is not required by OpenGL, but it will bring some convenience to our learning. We recommend that you install it.

Glut in Windows: (the size is about 150 K)

If you cannot download from the above address, use the following connection:
Http://upload.programfan.com/upfile/200607311626279.zip

To install glut in Windows:
1. Unpack the downloaded package and obtain 5 files.
2. Take my installation directory as an example:
(1) "E:/program files/Microsoft Visual Studio/vc98/include/GL folder ". Put the extracted glut. h In this gl folder. You can create one by yourself without the GL folder.
(2) "E:/program files/Microsoft Visual Studio/vc98/lib folder "). Put the extracted glut. lib and glu32.lib in the folder where the static function library is located, that is, the Lib folder.
(3) Place the extracted glut. dll and glu32.dll In the System32 folder under the operating system directory. (Typical location: C:/Windows/system32) This is an important dynamic link library setting!

Step 3: Create a project as follows:

(1) create a Win32 console application.
(2) link OpenGL libraries. In Visual C ++, click Project, click Settings, click link, and add opengl32.lib glu32.lib Glaux. Lib glu32.lib at the beginning of the Object/library modules.
(3) Click the C/C ++ label in Project Settings and change _ console in Preprocessor definitions to _ windows. Click OK.

Now, the preparation work is almost complete. Do not underestimate this step. If you do not set it, errors will always occur during compilation and running. Http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip

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.