[Go to] Introduction to OpenGL-related function libraries

Source: Internet
Author: User

Original article: http://blog.chinaunix.net/uid-20638550-id-1909182.html

The APIS related to OpenGL function libraries include core libraries (GL), practical libraries (Glu), auxiliary libraries (Aux), utility libraries (GLUT), and window libraries (Glx, AGL, and WGL) and extended function libraries. As shown in figure 1, GL is the core and Glu is the partial encapsulation of GL. Glx, AGL, and WGL are functions for different window systems. Glut is a tool kit for cross-platform OpenGL programs and is more powerful than aux. Extended Function libraries are functions developed by hardware vendors Using OpenGL to update hardware. The following describes these databases in detail.


1. OpenGL core library

The core library contains 115 functions with the function name prefixed with GL.

These functions are used for conventional and core graph processing. This function is interpreted and executed by Gl. dll. Because many functions can receive different numbers of the following classes. Data Type parameters, so the derived function has more than 300 original types.

Functions in the core library can be divided into the following types:
(1) function for drawing basic geometric elements. For example, the function glbegain (), glend (), glnormal * (), and glvertex * () for drawing elements *().
(2) matrix operations, geometric transformations, and Projection Transformation functions. Such as glpushmatrix (), glpopmatrix (), glloadmatrix (), glmultmatrix (), and glmatrixmode () and matrix standardization functions glloadidentity (), geometric transformation functions gltranslate * (), glrotate * () and glscale * (), projection transformation functions glortho (), glfrustum () and glviewport.
(3) color, illumination, and material functions. For example, set the color mode function glcolor * (), glindex * (), gllight * (), gllightmodel * (), and glmaterial.
(4) display list functions, including glnewlist (), gldlist (), glgenlists (), and glcalllist () functions for creating, ending, generating, deleting, and calling the display list () and gldeletelists ().
(5) Texture ing functions: glteximage1d (), glteximage2d (), and gltexparameter *(), gltexenv * () and gltetcoord.
(6) special effect functions. Glblendfunc (), glhint (), and glfog *().
(7) raster and pixel operation functions. Such as glrasterpos * (), gllinewidth (), glpolygonmode (), glreadpixel (), and glcopypixel.
(8) Selection and feedback functions. It mainly includes the rendering mode glrendermode (), the selection buffer glselectbuffer (), and the feedback buffer glfeedbackbuffer.
(9) curve and Surface Plotting functions. The glmap * () and glmapgrid * () functions that generate curves or surfaces, and the glevalcoord * () glevalmesh * () function of the calculator *().
(10) set the status and query functions. Mainly include glget * (), glable (), and glgeterror.


2. OpenGL utility library the OpenGL utility Library (Glu)

It contains 43 functions with the prefix of the function name: Glu.

OpenGL provides powerful but few drawing commands, and all the more complex drawings must be drawn from points. Line and plane start. In order to reduce the heavy programming workload, Glu encapsulates OpenGL functions. by calling the functions of the core library, it provides relatively simple usage for developers and implements some complex operations. This function is interpreted and executed by Glu. dll. The core library and utility library in OpenGL can be run on all OpenGL platforms.

It mainly includes the following types:
(1) Auxiliary texture map functions, including gluscaleimage (), glubuild1dmipmaps (), and glubuild2dmipmaps ().
(2) Coordinate Transformation and Projection Transformation functions, defining projection functions gluperspective (), gluortho2d (), glulookat (), picking the projection visual body function glupickmatrix (), and calculating the projection matrix gluproject () and gluunproject.
(3) polygon embedding tools, including glunewtess (), gludeletetess (), glutesscallback (), glubeginpolygon () glutessvertex (), glunextcontour (), and gluendpolygon.
(4) quadratic surface rendering tools, mainly including spherical surface, cone surface, cylindrical surface, ring surface glunewquadric (), glusphere (), glucylinder (), gludisk (), glupartialdisk () and gludeletequadric.
(5) Non-Uniform Rational B-spline drawing tool, which is mainly used to define and plot the curve and surface of the green (), including glunewnurbsrenderer (), glunurbscurve (), glubeginsurface (), gluendsurface () and glunurbsproperty.
(6) The gluerrorstring () of the error information obtained by the error feedback tool ().


3. OpenGL auxiliary Library

Contains 31 functions with the prefix of Aux.

These functions provide window management, input and output processing, and some simple 3D objects. This function is interpreted and executed by Glaux. dll. The aux library is created to learn and write OpenGL programs. It is more like a preliminary pipeline for testing creativity. The aux library has many errors in Windows implementation, so it is easy to cause frequent crashes. In cross-platform programming examples and demonstrations, aux has been largely replaced by the glut library. The auxiliary libraries in OpenGL cannot run on all OpenGL platforms.

Auxiliary library functions mainly include the following types:
(1) window initialization and exit functions, auxinitdisplaymode () and auxinitposition ().
(2) window processing and time input functions, auxreshapefunc (), auxkeyfunc (), and auxmousefunc ().
(3) color index Loading Function, auxsetonecolor ().
(4) 3D object rendering function. There are two forms of mesh and solid body, such as drawing a cube auxwirecube () and auxsolidcube (). Here we take the mesh as an example. The cuboid auxwirebox (), the ring surface auxwiretorus (), the cylindrical auxwirecylinder (), the twenty surface auxwireicosahedron (), auxwiredodecahedron (), cone auxwirecone () and teapot auxwireteapot ().
(5) background process management function auxidlefunc ().
(6) The program runs the auxmainloop () function ().


4. OpenGL ity Toolkit

Contains more than 30 functions, with the function name prefixed with glut.

Glut is an OpenGL toolkit independent of the window platform. It is written by Mark klilgrad in SGI (currently in NVIDIA) to hide the complexity of APIs on different Windows platforms. Functions start with glut. They serve as a more powerful alternative to the aux library and provide more complex plotting functions. This function is interpreted and executed by glut. dll. Since window management functions in glut do not depend on the runtime environment, the tool libraries in OpenGL can run in X-window, Windows NT, OS/2, and other systems, it is particularly suitable for developing OpenGL sample programs that do not require complex interfaces. For experienced programmers, glut is usually used to straighten out 3D graphics code and then integrate it into a complete application.

These functions mainly include:
(1) window operation functions, window initialization, window size, window location, etc.
(2) callback function. Response to refresh messages, keyboard messages, mouse messages, timer functions, etc ().
(3) create complex 3D objects. These functions are the same as those of the aux database. Create a mesh and a solid body. For example. We will not describe it here.
(4) menu functions. Create the functions for adding a menu, such as glucreatemenu (), glusetmenu (), gluaddmenuentry (), gluaddsubmenu (), and gluattachmenu ().
(5) program running function, FIG ().
Related Article

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.