This information resources from the network, Welcome to reprint! Please keep this article link (http://www.shopliyang.com.cn/) when reproduced!
The GL Library in OpenGL is the core library, Glu is a utility library, and glut is a utility library. GL is the core, Glu is part of the package for GL, glut is OpenGL's cross-platform tool Library. GL contains the most basic 3D functions, and Glu seems to support the GL, if the math is good, in the case of not Glu, but also can make the same effect. Glut is the basic window interface, is independent of GL and Glu, if you do not like to use glut can be used in MFC and Win32 window, etc., but glut is cross-platform, which ensures that our programming is a cross-platform If you use MFC or WIN32 only on Windows operating systems. One of the big reasons for choosing OpenGL is that it's cross-platform, so we can use the glut library as much as possible.
OpenGL Utility Library: 43 functions (starting with Glu, including texture mapping, coordinate transformation, polygon differentiation, drawing some simple polygon entities such as ellipsoid, cylinder, teapot, etc.).
OOPENGL Auxiliary Library: 31 functions (starting with aux the OpenGL library related APIs are core libraries (GL), utility libraries (GLU), auxiliary libraries (aux), utility libraries (glut), window libraries (GLX, AGL, WGL), and extension function libraries, etc.).
①opengl Core Library
The core library contains 115 functions with a prefix of GL for the function name. This part of the function is used for regular, core graphics processing. This function is interpreted by gl.dll. Functions in the core library can be divided into the following types of functions.
Functions for drawing basic geometry elements
Functions such as drawing entities Glbegain (), Glend (), glnormal* (), glvertex* ().
Functions of matrix manipulation, geometric transformations, and projection transformations
such as matrix into the Stack function Glpushmatrix (), Matrix stack function Glpopmatrix (), Load matrix function Glloadmatrix (), matrix multiplication function Glmultmatrix (), Current matrix function Glmatrixmode () and matrix normalization functions glloadidentity (), Geometric transformation functions gltranslate* (), glrotate* () and glscale* (), Projection transformation Functions Glortho (), Glfrustum () and the viewport transform function glviewport () and so on.
Functions for color, illumination, and materials
such as setting the color mode function glcolor* (), glindex* (), setting the lighting effect function gllight* (), gllightmodel* (), and setting the material effect function glmaterial () and so on.
Display list functions
There are primarily create, end, build, delete, and invoke display list functions glnewlist (), Glendlist (), glgenlists (), Glcalllist (), and gldeletelists ().
Texture mapping functions
There are mainly one-dimensional texture function glteximage1d (), two-dimensional texture function glteximage2d () and function gltexparameter* (), gltexenv* (), and gltetcoord* () to set texture parameters, texture environment and texture coordinates.
Special effects functions
The Fusion function Glblendfunc (), the anti-aliasing function glhint (), and the Atomization effect glfog* ().
Rasterization, pixel manipulation functions
Elephant position glrasterpos* (), line width gllinewidth (), polygon drawing Mode Glpolygonmode (), read Pixel glreadpixel (), copy Pixel Glcopypixel (), etc.
Selection and feedback functions
There are mainly render mode Glrendermode (), select Buffer Glselectbuffer () and feedback buffer Glfeedbackbuffer (), etc.
Drawing functions for curves and surfaces
The function glmap* (), glmapgrid* (), and the function glevalcoord* (), glevalmesh* () that generate a curve or surface.
State settings and query functions
There are mainly glget* (), glenable (), Glgeterror () and so on.
②opengl Utility Library The OpenGL Utility Library (GLU)
Contains 43 functions with a prefix of Glu for the function name. OpenGL provides a powerful but small number of drawing commands, and all the more complex drawings must be opened from points, lines, and polygons. Glu in order to alleviate the heavy programming work, encapsulated the OpenGL function, the Glu function by invoking the core library function, provides the developer with the relatively simple usage, Implement some of the more complex operations. This function is interpreted by Glu.dll to interpret the core libraries and utility libraries in the execution OpenGL to run on all OpenGL platforms. The main include the following several.
Auxiliary Texture mapping functions
There are Gluscaleimage (), Glubuild1dmipmaps (), Glubuild2dmipmaps ().
Coordinate transformation and projection transformation functions
Define the projection mode function gluperspective (), gluortho2d (), Glulookat (), pick up the projected view body function Glupickmatrix (), the projection matrix calculation gluproject (), and Gluunproject (), and so on.
Polygon Mosaic Tool
There are glunewtess (), gludeletetess (), Glutesscallback (), Glubeginpolygon (), Utessvertex (), Glunextcontour (), GluEndPolygon () and so on.
Two-time surface drawing tool
There are mainly drawn spherical, conical, cylindrical, torus glunewquadric (), Glusphere (), Glucylinder (), Gludisk (), Glupartialdisk (), Gludeletequadric (), and so on.
Non-uniform rational B-spline drawing tool
Mainly used to define and draw nurbs curves and surfaces, including glunewnurbsrenderer (), Glunurbscurve (), Glubeginsurface (), Gluendsurface (), Glubegincurve (), Functions such as Glunurbsproperty ().
Error Feedback Tool
Gets the string gluerrorstring () of the error message.
The ③opengl Auxiliary Library contains 31 functions with the function name prefix aux
This part of the function provides window management, input and output processing, and drawing some simple three-dimensional objects. This function is interpreted by glaux.dll for execution. The Aux library is created to learn and write OpenGL programs, which are more like a preliminary base takeover for testing ideas. The Aux library has many errors in Windows implementations, so it is easy to cause frequent crashes. In cross-platform programming examples and demos, the Aux has largely been replaced by the glut library. The secondary libraries in OpenGL cannot be run on all OpenGL platforms.
Auxiliary library functions mainly include the following categories:
Window initialization and exit functions Auxinitdisplaymode () and Auxinitposition ().
window processing and time input functions Auxreshapefunc (), Auxkeyfunc (), and Auxmousefunc ().
The color index is loaded into the function Auxsetonecolor ().
Three-dimensional object drawing function
Includes two forms of mesh and solid bodies, such as drawing Cubes auxwirecube () and Auxsolidcube (). Here, for example, the box Auxwirebox (), the annular surface auxwiretorus (), the cylindrical auxwirecylinder (), the 20-face Auxwireicosahedron (), the eight-body Auxwireoctahedron (), tetrahedron Auxwiretetrahedron (), 12-Face body Auxwiredodecahedron (), Cone auxwirecone (), and Teapot Auxwireteapot ().
Background Process management function Auxidlefunc ().
The program runs the function Auxmainloop ().
④opengl Tool Library OpenGL Utility Toolkit
Contains approximately 30 functions, the function name prefix is glut. Glut is an OpenGL toolkit that is not dependent on the Windows platform, written by Mark Klilgrad in SGI (now in Nvidia) to hide the complexity of the different window platform APIs. Functions begin with glut, which serve as a more powerful alternative to the AUX library, providing a more complex rendering function, which is interpreted by glut.dll to interpret execution. Because window management functions in glut are not dependent on the operating environment, the tools library in OpenGL can be run under X-window, Windows NT, OS/2 and other systems, especially for developing OpenGL sample programs that do not require complex interfaces. For experienced programmers, it is common to use glut to straighten out 3D graphics code and then set it up as a complete application. This part of the function mainly includes the following:
Window manipulation functions
Window initialization, size, position functions such as glutinit (), Glutinitdisplaymode (), Glutinitwindowsize (), Glutinitwindowposition (), and so on.
callback function
Respond to refresh messages, keyboard messages, mouse messages, timer functions, etc.: Glutdisplayfunc (), Glutpostredisplay (), Glutreshapefunc (), Gluttimerfunc (), Glutkeyboardfunc (), Glutmousefunc ().
Create complex three-dimensional objects
These functions are identical to those of the AUX library. Create meshes and solid bodies. such as Glutsolidsphere (), Glutwiresphere (), etc.
Menu functions
Create a function that adds a menu Glutcreatemenu (), Glutsetmenu (), Glutaddmenuentry (), Glutaddsubmenu (), and Glutattachmenu ().
The program runs the function Glutmainloop ().
Overview of the "Go" OpenGL basic API