Dev-Cpp: configure the OpenGL graphics library (successful version: Dev-Cpp 5.7.1 MinGW 4.8.1), dev-cppmingw

Source: Internet
Author: User

Dev-Cpp: configure the OpenGL graphics library (successful version: Dev-Cpp 5.7.1 MinGW 4.8.1), dev-cppmingw

★Before configuration, note: Use andOpenGL Introduction

(With Dev-Cpp: http://sourceforge.net/projects/orwelldevcpp? Source = directory)

OpenGL Introduction: OpenGL (Open Graphics Library) is a powerful and convenient underlying Graphics Library.

Dev-Cpp already contains the basic functions for developing OpenGL programs.

■ Create an OpenGL project:

Select (file [F]) --> (new [N]) --> (project [P]...) --> (multimedia --> opengl ). Details such as:

 

This project contains the basic OpenGL program structure, including the window generation, message driver mechanism, and basic OpenGL program.

Click "run" to view a continuously rotating colored triangle.

In the Project Option-> Parameters-> Link of the Project, we found that the library libglu32.a and libopengl32.a have been connected.

-lopengl32

In Makefile. win of the Project root directory, you can also see

LIBS     = -L"D:/Dev-Cpp/MinGW32/lib" -L"D:/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -mwindows -lopengl32

Therefore, to create your own OpenGL project, you must add the following parameters to the Link that creates the win32 project.

-lglu32 -lopengl32

★Start configuring and implementing Dev-cpp compiling and running OpenGL program

Now, according to the routine in the OpenGL programming guide, simple implementation: rendering a White Rectangle in a black background

1 # include <windows. h> 2 // # include <gl/gl. h> // glut. h already contains 3 // # include <gl/glu. h> 4 # include <gl/glut. h> 5 // plot program 6 void display () {7 glClear (GL_COLOR_BUFFER_BIT); // set the screen to black 8 glColor3f (10 ., 1.0, 1.0); // set the current color to white 9 glBegin (GL_POLYGON); // draw a polygon 10 glVertex3f (0.25, 0.25, 0.0); 11 glVertex3f (0.75, 0.25, 0.0); 12 glVertex3f (0.75, 0.75, 0.0); 13 glVertex3f (0.25, 0.75, 0.0); 14 glEnd (); 15 glFlush (); // send the buffer 16} 17 // initialize and draw 18 void init () {19 glClearColor (0.0, 0.0, 0.0, 0.0); // clear the color setting 20 glMatrixMode (GL_PROJECTION ); // set the Projection Method 21 glLoadIdentity (); 22 glOrtho (0.0, 1.0, 0.0, 1.0,-1.0, 1.0 ); // set the projection space 23} 24 int main (int argc, char ** argv) {25 gluinit (& argc, argv); // initialize the glu26 gluinitdisplaymode (glu_single | glu_rgb ); // set the display mode to single buffer, and the RGB mode to 27-bit-size (250,250); // set the window size to 28-bit-size (100,100 ); // set the window position 29}OpenGL program

With the above understanding, we can further understand the principle of OpenGL configuration in Dev-Cpp.

(Link: http://pan.baidu.com/s/1pK4SKRp password: faka)

Customized WINDOWS Configuration:

C:/WINDOWS/SYSTEM32 files: glu32.dll, glu32.dll, glut. dll, and opengl32.dll.

(Path of the decompressed file: Dev-Cpp: The file \ bin required to configure OpenGL graphics library)

Configure the development Dev-Cpp Library:

The Lib file in the Dev-Cpp installation directory must contain the following files: libglu32.a, libglu32.a, libglut. a, libopengl.

(After decompression, the file location is Dev-Cpp, and the file \ lib required to configure the OpenGL graphics library)

The inlude \ GL file in the Dev-Cpp installation directory must contain the following header files: gl. h, glu. h, and glut. h.

(After decompression, the file location is Dev-Cpp. Configure the file \ index required by the OpenGL graphics library)

!! If the following conditions occur, perform the following operations.

The binfile In the Dev-Cpp installation directory must contain the following file: glu32.dll (you can see the prompt to add the desired file)

(Path of the decompressed file: Dev-Cpp: The file \ bin required to configure OpenGL graphics library)

Attribute settings of the Development Dev-Cpp project:

Select (tool [T]) --> (compilation option [C]).

Add the following code to "Add the following command to the connector command line"(Do not add spaces between each link):

-lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32

Details such as:

OK !! Now you can useDev-CppCompile and run your own OpenGL project. Congratulations !!!

Zhiyin Reference URL: http://www.2cto.com/kf/201505/399368.html

Started on: 2016.3.22

 

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.