First, Introduction
OpenGL is an open three-dimensional graphics software package, it is independent of the window system and the operating system, the application based on it can be easily ported between various platforms, and convenient two-dimensional, three-dimensional graphics algorithm, to ensure the correctness and reliability of the algorithm.
There are two dynamic link libraries in the Windows\System directory of WIN98 or WIN95: Opengl32.dll and Glu32.dll. This is required for the OpenGL application to run correctly.
Second, the WIN32 under the OpenGL programming skill
Under WIN32 The window program must first process the device Description table, and the OpenGL program must also use the device Description table, which is similar to other WIN95 programs. However, OpenGL must use a special graphical operation description table, the use of OpenGL calls must use a graphical Operation description table, an OpenGL graphics Operation description Table has OpenGL and Windows window System related to the various information. The application creates an OpenGL graphical operation description table based on the specified device description table, as follows:
HDC HDC; Device Description Table
HGLRC HRC; OpenGL Graphical Operation Description Table
HDC=GETDC (HWND);
Hrc=wglcreatecontext (HDC);
The OpenGL graphical Operations Description table contains information about OpenGL. An OpenGL application must create a graphical operation description table, then start it, and finally, in the defined window, call the OpenGL function to draw the graph in the usual way.
Third, the specific preparation
1. Add a member variable and a member function to the header file of the main form (see example). At the beginning of the plus preprocessing is as follows:
#include <gl/gl.h>
#include <gl\glu.h>
2, in the main form file to add color initialization.
3. Draw the function of drawing.