[Reprinted] composition of OpenGL Development Library
Source: Internet
Author: User
[From] http://blog.csdn.net/yqxx/archive/2005/05/27/382519.aspx Composition of OpenGL Development Library Develop OpenGL-based applicationsProgramFirst, you must understand the library functions of OpenGL. It adopts the C language style and provides a large number of functions for graphic processing and display. The names of OpenGL library functions are quite regular. All OpenGL functions use the following format: <Database prefix> <root command> <number of optional parameters> <optional parameter types> The database prefixes include GL, Glu, aux, glut, WGL, Glx, and AGL, respectively, indicating that the function belongs to the Development Library of OpenGL, the number of parameters required and the type of parameters can be seen from the function name. I indicates the int type, F indicates the float type, D indicates the double type, and u indicates the unsigned integer type. For example, glvertex3fv () indicates that the function belongs to the GL Library and the parameter is three float parameter pointers. We use glvertex * () to represent this type of function. 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. The function that draws the basic geometric elements. For example, the function glbegain (), glend (), glnormal * (), and glvertex * () for drawing elements *(). Matrix operation, geometric transformation, 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. Color, illumination, and material functions. For example, set the color mode function glcolor * (), glindex * (), gllight * (), gllightmodel * (), and glmaterial. Display list functions, including glnewlist (), gldlist (), glgenlists (), glcalllist (), and gldeletelists (). Texture ing functions include glteximage1d (), glteximage2d (), glteximage2d (), gltexparameter * (), and gltexenv *() and gltetcoord. Special Effect functions. Glblendfunc (), glhint (), and glfog *(). Raster and pixel operation functions. Such as glrasterpos * (), gllinewidth (), glpolygonmode (), glreadpixel (), and glcopypixel. Select and feedback functions. It mainly includes the rendering mode glrendermode (), the selection buffer glselectbuffer (), and the feedback buffer glfeedbackbuffer. Curves and surfaces. The glmap * () and glmapgrid * () functions that generate curves or surfaces, and the glevalcoord * () glevalmesh * () function of the calculator *(). Status settings 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. Auxiliary texture map functions, including gluscaleimage (), glubuild1dmipmaps (), and glubuild2dmipmaps (). Coordinate Transformation and Projection Transformation functions, define projection method functions gluperspective (), gluortho2d (), glulookat (), pick up the projection visual body function glupickmatrix (), and calculate the projection matrix gluproject () and gluunproject. Polygon embedding tools include glunewtess (), gludeletetess (), glutesscallback (), glubeginpolygon () glutessvertex (), glunextcontour (), and gluendpolygon. Quadratic Surface rendering tools, mainly including spherical surface, cone surface, cylindrical surface, ring surface glunewquadric (), glusphere (), glucylinder (), gludisk (), glupartialdisk (), gludeletequadric () and so on. A non-uniform rational B-spline drawing tool is mainly used to define and plot the curve and surface of a rectangle, including glunewnurbsrenderer (), glunurbscurve (), glubeginsurface (), gluendsurface (), and glubegincurve () and glunurbsproperty. Error feedback tool, the string for obtaining error information gluerrorstring (). 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. Window initialization and exit functions, auxinitdisplaymode () and auxinitposition (). Window processing and time input functions, auxreshapefunc (), auxkeyfunc (), and auxmousefunc (). Color index Loading Function, auxsetonecolor (). 3D object rendering function. Includes two forms of mesh and solid body, such as drawingCubeAuxwirecube () 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 (). Background process management function auxidlefunc (). 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.CodeAnd then integrated into the complete application. These functions mainly include: Window operation functions, window initialization, window size, window location, and other functions such as gluinit () gluinitdisplaymode () gluinitwindowsize () gluinitwindowposition. Callback function. Response to refresh messages, keyboard messages, mouse messages, timer functions, etc (). 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. Menu function. Create the functions for adding a menu, such as glucreatemenu (), glusetmenu (), gluaddmenuentry (), gluaddsubmenu (), and gluattachmenu (). Program running function, FIG (). 5. Windows library For Windows platform extensions. Contains 16 functions with the prefix WGL. These functions are mainly used to connect OpenGL and windows to make up for OpenGL's text deficiency. Windows libraries can only be used in Windows environments. These functions mainly include the following types: Graph context functions such as wglcreatecontext () and wgldeletecontext () wglgetcurrentcontent () wglgetcurrentdc () wgldeletecontent () Text and text processing functions: wglusefontbitmaps () and wglusefontoutlines (). Covering Layer, formation and Main Plane layer processing functions such as wglcopycontext (), wglcreatelayerplane (), wgldescribelayerplane (), wglreakizelayerplatte () Other functions, such as wglsharelists () and wglgetprocaddress. 6. Win32 API function library There are 6 functions, and the function name has no special prefix. Is a Win32 Extension function. These functions are mainly used to process the pixel storage format and dual-frame cache. These six functions will replace the original functions of Windows GDI. The WIN32API function library can only be used in Windows 95/98/NT. 7. X Window dedicated Library Is an extension function for UNIX and Linux. Including rendering context, drawing elements, display list, texture maps, etc. Initialize glxqueryextension () Rendering Context Function, glxcreatecontext () glxdestroycontext () glxcopycontext () glxmakecurrent () glxcreateglxpixmap () Run glxwaitgl () and glxwaitx () Buffer and font glxswapbuffers (), glxusexfont () 8. Other extension Libraries These functions may be new OpenGL functions that are not implemented in the standard OpenGL library, or they are used to extend existing OpenGL functions. Like Glu, Glx, and WGL, these OpenGL extensions are developed by hardware vendors and vendors. OpenGL extention contains a large number of extended API functions. As the hardware is updated, the hardware vendor first applies to SGI to register new extensions and write the specification (specification ). Then follow the instructions to develop the extension program. Different OpenGL implementation may support different extensions, only with the promotion of a certain extension and the improvement of application and hardware technology will the extension be supported in all OpenGL implementations and eventually become part of the OpenGL standard library. Extensions are maintained by SGI and are listed on the SGI website as publicly available extensions and their official manuals. The extension source is indicated by the extension function suffix (or the extension constant suffix is used ). For example, the suffix win indicates an extension that complies with Windows specifications, and the ext or ARB suffix indicates that the extension is defined by multiple vendors. The naming rules officially stipulated by OpenGL are as follows: The extension officially approved by ARB-OpenGL architecture Review Board is often developed by the vendor. If both the extension developed by the vendor and the ARB extension exist, the ARB extension should be used first. EXT-extensions supported by multiple OpenGL vendors HP-Hewlett-Packard HP IBM-International Business Machines KTX-kinetix, maker of 3D Studio MAX Intel-intel Nv-NVIDIA Mesa-Brian Paul's freeware portable OpenGL implementation Extensions developed by SGI-Silicon Graphics Experimental extensions developed by sgix-Silicon Graphics (experimental) Sun-Sun Microsystems Win-Microsoft Since OpenGL extensions are applicable to different platforms and drivers, it is impossible for OpenGL to put all interface programs in GL. h, Glx. h. WGL. h, but put these function headers in glext. h. glxext. H and wglext. h. These extensions are seen as the addition and modification of OpenGL core library specifications. OpenGL extensions do not have any disadvantages. Because each hardware vendor can develop its own extensions, the number of extensions is large and a bit confusing. Some extensions implement the same functions, however, because the interfaces are developed by different vendors, different programs are often required for different graphics cards to implement this function. This problem may be solved after OpenGL 2.0 is released. One goal of OpenGL 2.0 is to unify the extension and reduce the number of extensions.
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.