Legal Notices The information contained in this document is subject to change without notice. Hewlett-Packard assumes no responsibility for the use or reliability of its software on equipment that is not furnished by Hewlett-Packard. This document contains proprietary information that is protected by copyright. All rights reserved.
glAccum glAccum glAccum: operate on the accumulation buffer. C Specification void glAccum( GLenum op, GLfloat value) Parameters value Description The accumulation buffer is an extended-range color buffer. Images are not rendered into it. Rather, images rendered into one of the color buffers are added to the contents of the accumulation buffer after rendering.
Page 11
GL_LOAD GL_ADD GL_MULT GL_RETURN To clear the accumulation buffer, call glClearAccum with R, G, B, and A values to set it to, then call glClear with the accumulation buffer enabled. Notes Only pixels within the current scissor box are updated by a glAccum operation. Errors •...
glAlphaFunc glAlphaFunc: specify the alpha test function. C Specification void glAlphaFunc( GLenum func, GLclampf ref) Parameters func Description The alpha test discards fragments depending on the outcome of a comparison between an incoming fragment’s alpha value and a constant reference value. glAlphaFunc specifies the reference value and the comparison function.
Page 14
glAlphaFunc glAlphaFunc operates on all pixel write operations, including those resulting from the scan conversion of points, lines, polygons, and bitmaps, and from pixel draw and copy operations. glAlphaFunc does not affect screen-clear operations. Notes Alpha testing is performed only in RGBA mode. Errors •...
glAreaTexturesResident glAreaTexturesResident: determine if textures are loaded in texture memory. C Specification GLboolean glAreTexturesResident( GLsizei n, const GLuint *textures, GLboolean *residences) Parameters textures residences Description GL establishes a “working set” of textures that are resident in texture memory. These textures can be bound to a texture target much more efficiently than textures that are not resident.
Page 16
glAreaTexturesResident Errors • GL_INVALID_VALUE is generated if n is negative. • GL_INVALID_VALUE is generated if any element in textures is 0 or does not name a texture. In that case, the function returns GL_FALSE and the contents of residences is indeterminate. •...
glArrayElement glArrayElement glArrayElement: render a vertex using the specified vertex array element. C Specification void glArrayElement( GLint i) Parameters Specifies an index into the enabled vertex data arrays. Description glArrayElement commands are used within glBegin/glEnd pairs to specify vertex and attribute data for point, line, and polygon primitives.
glBegin glBegin glBegin, glEnd: delimit the vertices of a primitive or a group of like primitives. C Specification void glBegin( GLenum mode) void glEnd(void) Parameters mode Description glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives.
Page 21
GL_TRIANGLE_FAN GL_QUADS GL_QUAD_STRIP GL_POLYGON Only a subset of GL commands can be used between glBegin and glEnd. The commands are glVertex, glColor, glIndex, glNormal, glTexCoord, glEvalCoord, glEvalPoint, glArrayElement, glMaterial, and glEdgeFlag. Also, it is acceptable to use glCallList or glCallLists to execute display lists that include only the preceding commands. If any other GL command is executed between glBegin and glEnd, the error flag is set and the command is ignored.
Page 22
glBegin Execution of glEnableClientState, glDisableClientState, glEdgeFlagPointer, glTexCoordPointer, glColorPointer, glIndexPointer, glNormalPointer, glVertexPointer, glInterleavedArrays, or glPixelStore is not allowed after a call to glBegin and before the corresponding call to glEnd, but an error may or may not be generated. See Also glArrayElement, glCallList, glCallLists,...
gluBeginCurve gluBeginCurve, gluEndCurve: delimit a NURBS curve definition. C Specification void gluBeginCurve( GLUnurbs* nurb) void gluEndCurve( GLUnurbs* nurb) Parameters nurb Description Use gluBeginCurve to mark the beginning of a NURBS curve definition. After calling gluBeginCurve, make one or more calls to gluNurbsCurve to define the attributes of the curve.
gluBeginPolygon gluBeginPolygon gluBeginPolygon, gluEndPolygon: delimit a polygon description. C Specification void gluBeginPolygon( GLUtesselator* tess) void gluEndPolygon( GLUtesselator* tess) Parameters tess Description gluBeginPolygon and gluEndPolygon delimit the definition of a nonconvex polygon. To define such a polygon, first call gluBeginPolygon. Then define the contours of the polygon by calling gluTessVertex for each vertex and gluNextContour to start each new contour.
gluBeginSurface gluBeginSurface, gluEndSurface: delimit a NURBS surface definition. C Specification void gluBeginSurface( GLUnurbs* nurb) void gluEndSurface( GLUnurbs* nurb) Parameters nurb Description Use gluBeginSurface to mark the beginning of a NURBS surface definition. After calling gluBeginSurface, make one or more calls to gluNurbsSurface to define the attributes of the surface.
gluBeginTrim gluBeginTrim gluBeginTrim, gluEndTrim: delimit a NURBS trimming loop definition. C Specification void gluBeginTrim( GLUnurbs* nurb) void gluEndTrim( GLUnurbs* nurb) Parameters nurb Description Use gluBeginTrim to mark the beginning of a trimming loop, and gluEndTrim to mark the end of a trimming loop. A trimming loop is a set of oriented curve segments (forming a closed curve) that define boundaries of a NURBS surface.
Page 27
gluBeginTrim If a trimming loop definition contains multiple curves, the direction of the curves must be consistent (that is, the inside must be to the left of all of the curves). Nested trimming loops are legal as long as the curve orientations alternate correctly. If trimming curves are self-intersecting, or intersect one another, an error results.
glBindTexture glBindTexture glBindTexture: bind a named texture to a texture target. C Specification void glBindTexture( GLenum target, GLuint texture) Parameters target texture Description glBindTexture binds the texture named texture to the specified target. If the name does not exist, it is created. target must be either GL_TEXTURE_1D or GL_TEXTURE_2D. When a texture is bound to a target, the previous binding for that target is broken.
Page 29
Notes glBindTexture is available only if the GL version is 1.1 or greater. Errors • GL_INVALID_ENUM is generated if target is not one of the allowable values. • GL_INVALID_OPERATION is generated if texture has a dimensionality that doesn’t match that of target. •...
glBitMap glBitMap glBitmap: draw a bitmap. C Specification void glBitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap) Parameters width, height xorig, yorig xmove, ymove bitmap Description A bitmap is a binary image. When drawn, the bitmap is positioned relative to the current raster position, and frame buffer pixels corresponding to 1s in the bitmap are written using the current raster color or index.
Page 31
where (x generated for each pixel corresponding to a 1 (one) in the bitmap image. These fragments are generated using the current raster z coordinate, color or color index, and current raster texture coordinates. They are then treated just as if they had been generated by a point, line, or polygon, including texture mapping, fogging, and all per-fragment operations such as alpha and depth testing.
glBlendColorEXT glBlendColorEXT glBlendColorEXT: set the blend color. C Specification void glBlendColorEXT( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) Parameters red, green, blue, alpha Specify the components of GL_BLEND_COLOR_EXT. Description The GL_BLEND_COLOR_EXT may be used to calculate the source and destination blending factors.
glBlendFunc glBlendFunc: specify pixel arithmetic. C Specification void glBlendFunc( GLenum sfactor, GLenum dfactor) Parameters sfactor dfactor Description In RGBA mode, pixels can be drawn using a function that blends the incoming (source) RGBA values with the RGBA values that are already in the frame buffer (the destination values).
Page 34
glBlendFunc Parameters Table 2-1 Parameter GL_ZERO GL_ONE GL_SRC_COLOR GL_ONE_MINUS_SRC_COLOR GL_DST_COLOR GL_ONE_MINUS_DST_COLOR GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA GL_DST_ALPHA GL_ONE_MINUS_DST_ALPHA GL_SRC_ALPHA_SATURATE In the table, i = min(A To determine the blended RGBA values of a pixel when drawing in RGBA mode, the system uses the following equations: = min(k = min(k = min(k...
Page 35
Examples Blend function (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) is also useful for rendering anti-aliased points and lines in arbitrary order. Polygon anti-aliasing is optimized using blend function (GL_SRC_ALPHA_SATURATE, GL_ONE) with polygons sorted from nearest to farthest. (See the glEnable, glDisable reference page and the GL_POLYGON_SMOOTH argument for information on polygon anti-aliasing.) Destination alpha bitplanes, which must be present for this blend function to operate correctly, store the accumulated coverage.
gluBuild1DMipmaps gluBuild1DMipmaps gluBuild1DMipmaps: create 1D mipmaps. C Specification GLint gluBuild1DMipmaps( GLenum target, GLint component, GLsizei width, GLenum format, GLenum type, const void *data) Parameters target component width format type data Description gluBuild1DMipmaps builds a series of pre-filtered 1D texture maps of decreasing resolution.
Page 37
Next, gluBuild1DMipmaps builds a series of mipmap levels; it halves a copy of data (or a scaled version of data, if necessary) until size 1 is reached. At each level, each texel in the halved image is an average of the corresponding two texels in the larger image. glTexImage1D is called to load each of these images by level.
gluBuild2DMipmaps gluBuild2DMipmaps gluBuild2DMipmaps: create 2D mipmaps. C Specification GLint gluBuild2DMipmaps( GLenum target, GLint component, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data) Parameters target component target width, height format type data Description gluBuild2DMipmaps builds a series of pre-filtered 2D texture maps of decreasing resolution.
Page 39
If the GL version is 1.1 or greater, gluBuild2DMipmaps then uses proxy textures (see glTexImage1D) to determine whether there’s enough room for the requested texture in the implementation. If not, width is halved (and halved again) until it fits. gluBuild2DMipmaps then uses proxy textures (see glTexImage2D) to determine if the implementation can store the requested texture in texture memory.
glCallList glCallList glCallList: execute a display list. C Specification void glCallList( GLuint list) Parameters list Description glCallList causes the named display list to be executed. The commands saved in the display list are executed in order, just as if they were called without using a display list. If list has not been defined as a display list, glCallList is ignored.
glCallLists glCallLists: execute a list of display lists. C Specification void glCallLists( GLsizei n, GLenum type, const GLvoid *lists) Parameters type lists Description glCallLists causes each display list in the list of names passed as lists to be executed. As a result, the commands saved in each display list are executed in order, just as if they were called without using a display list.
Page 44
glCallLists GL_2_BYTES GL_3_BYTES GL_4_BYTES The list of display-list names is not null-terminated. Rather, n specifies how many names are to be taken from lists. An additional level of indirection is made available with the glListBase command, which specifies an unsigned offset that is added to each display-list name specified in lists before that display list is executed.
Page 45
glCallLists See Also glCallList, glDeleteLists, glGenLists, glListBase, glNewList, glPushAttrib, glPushMatrix Chapter 3...
glXChooseVisual glXChooseVisual glXChooseVisual: return a visual that matches specified attributes. C Specification XVisualInfo *glXChooseVisual( Display *dpy, int screen, int *attribList) Parameters screen attribList Description glXChooseVisual returns a pointer to an XVisualInfo structure describing the visual that best meets a minimum specification. The boolean GLX attributes of the visual that is returned will match the specified values, and the integer GLX attributes will meet or exceed the specified minimum values.
Page 47
glXChooseVisual GLX_RGBA If present, only TrueColor and DirectColor visuals are considered. Otherwise, only PseudoColor and StaticColor visuals are considered. GLX_DOUBLEBUFFER If present, only double-buffered visuals are considered. Otherwise, only single-buffered visuals are considered. GLX_STEREO If present, only stereo visuals are considered. Otherwise, only monoscopic visuals are considered.
Page 48
glXChooseVisual GLX_ACCUM_GREEN_SIZE Must be followed by a nonnegative minimum size specification. If this value is zero, visuals with no green accumulation buffer are preferred. Otherwise, the largest possible green accumulation buffer of at least the minimum size is preferred. GLX_ACCUM_BLUE_SIZE Must be followed by a nonnegative minimum size specification.
Page 49
glXChooseVisual See Also glXCreateContext, glXGetConfig Chapter 3...
glClear glClear glClear: clear buffers to preset values. C Specification void glClear( GLbitfield mask) Parameters mask Description glClear sets the bitplane area of the window to values previously selected by glClearColor, glClearIndex, glClearDepth, glClearStencil, and glClearAccum. Multiple color buffers can be cleared simultaneously by selecting more than one buffer at a time using glDrawBuffer.
Page 51
Errors • GL_INVALID_VALUE is generated if any bit other than the four defined bits is set in mask. • GL_INVALID_OPERATION is generated if glClear is executed between the execution of glBegin and the corresponding execution of glEnd. Associated gets glGet with argument GL_ACCUM_CLEAR_VALUE glGet with argument GL_DEPTH_CLEAR_VALUE glGet with argument GL_INDEX_CLEAR_VALUE glGet with argument GL_COLOR_CLEAR_VALUE...
glClearAccum glClearAccum glClearAccum: specify clear values for the accumulation buffer. C Specification void glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) Parameters red, green, blue, alpha Description glClearAccum specifies the red, green, blue, and alpha values used by glClear to clear the accumulation buffer.
glClearColor glClearColor: specify clear values for the color buffers. C Specification void glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) Parameters red, green, blue, alpha Description glClearColor specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
glClearDepth glClearDepth glClearDepth: specify the clear value for the depth buffer. C Specification void glClearDepth( GLclampd depth) Parameters depth Description glClearDepth specifies the depth value used by glClear to clear the depth buffer. Values specified by glClearDepth are clamped to the range [0, 1]. Errors •...
glClearindex glClearIndex: specify the clear value for the color index buffers. C Specification void glClearIndex( GLfloat c) Parameters Description glClearIndex specifies the index used by glClear to clear the color index buffers. c is not clamped. Rather, c is converted to a fixed-point value with unspecified precision to the right of the binary point.
glClearStencil glClearStencil glClearStencil: specify the clear value for the stencil buffer. C Specification void glClearStencil( GLint s) Parameters Description glClearStencil specifies the index used by glClear to clear the stencil buffer. s is masked with 2 - 1, where m is the number of bits in the stencil buffer. Errors •...
glClipPlane glClipPlane: specify a plane against which all geometry is clipped. C Specification void glClipPlane( GLenum plane, const GLdouble *equation) Parameters plane equation Description Geometry is always clipped against the boundaries of a six-plane frustum in x, y, and z. glClipPlane allows the specification of additional planes, not necessarily perpendicular to the x, y, or Z axis, against which all geometry is clipped.
Page 58
glClipPlane Associated gets glGetClipPlane glIsEnabled with argument GL_CLIP_PLANE\f2i\fP See Also glEnable Chapter 3...
glColorMask glColorMask: enable and disable writing of frame buffer color components. C Specification void glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) Parameters red, green, blue, alpha Description glColorMask specifies whether the individual color components in the frame buffer can or cannot be written.
glColorMaterial glColorMaterial glColorMaterial: cause a material color to track the current color. C Specification void glColorMaterial( GLenum face, GLenum mode) Parameters face mode Description glColorMaterial specifies which material parameters track the current color. When GL_COLOR_MATERIAL is enabled, the material parameter or parameters specified by mode, of the material or materials specified by face, track the current color at all times.
Page 65
• GL_INVALID_OPERATION is generated if glColorMaterial is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glIsEnabled with argument GL_COLOR_MATERIAL glGet with argument GL_COLOR_MATERIAL_PARAMETER glGet with argument GL_COLOR_MATERIAL_FACE See Also glColor, glColorPointer, glDrawElements, glEnable, glLight, glLightModel, glMaterial Chapter 3...
glColorPointer glColorPointer glColorPointer: define an array of colors. C Specification void glColorPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) Parameters size type stride pointer Description glColorPointer specifies the location and data format of an array of color components to use when rendering.
Page 67
Execution of glColorPointer is not allowed between the execution of glBegin and the corresponding execution of glEnd, but an error may or may not be generated. If no error is generated, the operation is undefined. glColorPointer is typically implemented on the client side. Color array parameters are client-side state and are therefore not saved or restored by glPushAttrib and glPopAttrib.
glXCopyContext glXCopyContext glXCopyContext: copy state from one rendering context to another. C Specification void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, unsigned long mask) Parameters mask Description glXCopyContext copies selected groups of state variables from src to dst. mask indicates which groups of state variables are to be copied.
Page 69
Errors • BadMatch is generated if rendering contexts src and dst do not share an address space or were not created with respect to the same screen. • BadAccess is generated if dst is current to any thread (including the calling thread) at the time glXCopyContext is called.
glCopyPixels glCopyPixels glCopyPixels: copy pixels in the frame buffer. C Specification void glCopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) Parameters x, y width, height type Description glCopyPixels copies a screen-aligned rectangle of pixels from the specified frame buffer location to a region relative to the current raster position.
Page 71
right of the binary point. Each index is then shifted left by GL_INDEX_SHIFT bits, and added toGL_INDEX_OFFSET. If GL_INDEX_SHIFT is negative, the shift is to the right. In either case, zero bits fill otherwise unspecified bit locations in the result. If GL_MAP_COLOR is true, the index is replaced with the value that it references in lookup table GL_PIXEL_MAP_I_TO_I.
Page 72
glCopyPixels The rasterization described thus far assumes pixel zoom factors of 1.0. If glPixelZoom is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows. If (x the jth row of the source pixel rectangle, then fragments are generated for pixels whose centers are in the rectangle with corners at + zoom + zoom...
glCopyTexImage1D glCopyTexImage1D glCopyTexImage1D: copy pixels into a 1D texture image. C Specification void glCopyTexImage1D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) Parameters target level internalFormat Specifies the internal format of the texture. Must be one of the x, y width border...
Page 75
The screen-aligned pixel row with left corner at (x, y) and with a length of width+2 border defines the texture array at the mipmap level specified by level. internalFormat specifies the internal format of the texture array. The pixels in the row are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion.
Page 76
glCopyTexImage1D See Also glCopyPixels, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glPixelStore glPixelTransfer, glTexEnv, glTexGen, glTexImage1D, glTexImage2D, glTexSubImage1D, glTexSubImage2D, glTexParameter Chapter 3...
glCopyTexImage2D glCopyTexImage2D: copy pixels into a 2D texture image. C Specification C Specification void glCopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) Parameters target level internalFormat Specifies the internal format of the texture. Must be one of the x, y width height...
Page 78
glCopyTexImage2D Description glCopyTexImage2D defines a two-dimensional texture image with pixels from the current GL_READ_BUFFER. The screen-aligned pixel rectangle with lower left corner at (x, y) and with a width of width + 2 mipmap level specified by level. internalFormat specifies the internal format of the texture array.
Page 79
glCopyTexImage2D Associated Gets glGetTexImage glIsEnabled with argument GL_TEXTURE_2D See Also glCopyPixels, glCopyTexImage1D, glCopyTexSubImage1D, glCopyTexSubImage2D, glPixelStore, glPixelTransfer, glTexEnv, glTexGen, glTexImage1D, glTexImage2D, glTexSubImage1D, glTexSubImage2D, glTexParameter Chapter 3...
glCopyTexSubImage1D glCopyTexSubImage1D glCopyTexSubImage1D: copy a one-dimensional texture sub image. C Specification void glCopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) Parameters target level xoffset x, y width Description glCopyTexSubImage1D replaces a portion of a one-dimensional texture image with pixels from the current GL_READ_BUFFER (rather than from main memory, as is the case for glTexSubImage1D).
Page 81
Texturing has no effect in color index mode. glPixelStore and glPixelTransfer modes affect texture images in exactly the way they affect glDrawPixels. Errors • GL_INVALID_ENUM is generated if target is not GL_TEXTURE_1D. • GL_INVALID_OPERATION is generated if the texture array has not been defined by a previous glTexImage1D or glCopyTexImage1D operation.
glCopyTexSubImage2D glCopyTexSubImage2D glCopyTexSubImage2D: copy a two-dimensional texture sub image. C Specification void glCopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) Parameters target level xoffset yoffset x, y width height Description glCopyTexSubImage2D replaces a rectangular portion of a two-dimensional texture image with pixels from the current GL_READ_BUFFER (rather than from main memory, as is the case for glTexSubImage2D).
Page 83
If any of the pixels within the specified rectangle of the current GL_READ_BUFFER are outside the read window associated with the current rendering context, then the values obtained for those pixels are undefined. No change is made to the internalformat, width, height, or border parameters of the specified texture array or to texel values outside the specified subregion.
glCopyTexSubImage3DEXT glCopyTexSubImage3DEXT: copy pixels into a 3D texture sub image. C Specification void glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) Parameters target level xoffset yoffset zoffset width height Description glCopyTexSubImage3DEXT replaces a rectangular portion of a three-dimensional texture image with pixels from the current GL_READ_BUFFER (rather than from main...
Page 86
glCopyTexSubImage3DEXT The pixels in the rectangle are processed exactly as if glCopyPixels had been called, but the process stops just before final conversion. At this point all pixel component values are clamped to the range [0, 1] and then converted to the texture’s internal format for storage in the texel array.
glXCreateContext glXCreateContext: create a new GLX rendering context. C Specification GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct) Parameters sharelist direct Description glXCreateContext creates a GLX rendering context and returns its handle. This context can be used to render into both windows and GLX pixmaps. If glXCreateContext fails to create a rendering context, NULL is returned.
Page 88
glXCreateContext Notes XVisualInfo is defined in Xutil.h. It is a structure that includes visual, visualID, screen, and depth elements. A process is a single execution environment, implemented in a single address space, consisting of one or more threads. A thread is one of a set of subprocesses that share a single address space, but maintain separate program counters, stack spaces, and other related global data.
glXCreateGLXPixmap glXCreateGLXPixmap: create an off-screen GLX rendering area. C Specification GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *vis, Pixmap pixmap) Parameters pixmap Description glXCreateGLXPixmap creates an off-screen rendering area and returns its XID. Any GLX rendering context that was created with respect to vis can be used to render into this off-screen area.
Page 90
glXCreateGLXPixmap • BadAlloc is generated if the server cannot allocate the GLX pixmap. See Also glXCreateContext, glXIsDirect, glXMakeCurrent Chapter 3...
glCullFace glCullFace: specify whether front- or back-facing facets can be culled. C Specification void glCullFace( GLenum mode) Parameters mode Description glCullFace specifies whether front- or back-facing facets are culled (as specified by mode) when facet culling is enabled. Facet culling is initially disabled. To enable and disable facet culling, call the glEnable and glDisable commands with the argument GL_CULL_FACE.
gluCylinder gluCylinder gluCylinder: draw a cylinder. C Specification void gluCylinder( GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks) Parameters quad base height slices stacks Description gluCylinder draws a cylinder oriented along the Z axis. The base of the cylinder is placed at Z = 0, and the top at Z = height.
glDeleteLists glDeleteLists glDeleteLists: delete a contiguous group of display lists. C Specification void glDeleteLists( GLuint list, GLsizei range) Parameters list range Description glDeleteLists causes a contiguous group of display lists to be deleted. list is the name of the first display list to be deleted, and range is the number of display lists to delete. All display lists d with list All storage locations allocated to the specified display lists are freed, and the names are available for reuse at a later time.
gluDeleteNurbsRenderer gluDeleteNurbsRenderer gluDeleteNurbsRenderer: destroy a NURBS object. C Specification void gluDeleteNurbsRenderer( GLUnurbs* nurb) Parameters nurb Specifies the NURBS object to be destroyed. Description gluDeleteNurbsRenderer destroys the NURBS object (which was created with gluNewNurbsRenderer) and frees any memory it uses. Once gluDeleteNurbsRenderer has been called, nurb cannot be used again.
gluDeleteQuadric gluDeleteQuadric gluDeleteQuadric: destroy a quadrics object. C Specification void gluDeleteQuadric( GLUquadric* quad) Parameters quad Description gluDeleteQuadric destroys the quadrics object (created with gluNewQuadric) and frees any memory it uses. Once gluDeleteQuadric has been called, quad cannot be used again. See Also gluNewQuadric Specifies the quadrics object to be destroyed.
gluDeleteTess gluDeleteTess gluDeleteTess: destroy a tessellation object. C Specification void gluDeleteTess( GLUtesselator* tess) Parameters tess Specifies the tessellation object to destroy. Description gluDeleteTess destroys the indicated tessellation object (which was created with gluNewTess) and frees any memory that it used. See Also gluBeginPolygon, gluNewTess,...
glDeleteTextures glDeleteTextures glDeleteTextures: delete named textures. C Specification void glDeleteTextures( GLsizei n, const GLuint *textures) Parameters textures Description glDeleteTextures deletes n textures named by the elements of the array textures. After a texture is deleted, it has no contents or dimensionality, and its name is free for reuse (for example by glGenTextures).
glDepthFunc glDepthFunc glDepthFunc: specify the value used for depth buffer comparisons. C Specification void glDepthFunc( GLenum func) Parameters func Description glDepthFunc specifies the function used to compare each incoming pixel depth value with the depth value present in the depth buffer. The comparison is performed only if depth testing is enabled.
Page 101
Notes Even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. Errors • GL_INVALID_ENUM is generated if func is not an accepted value. • GL_INVALID_OPERATION is generated if glDepthFunc is executed between the execution of glBegin and the corresponding execution of glEnd.
glDepthMask glDepthMask glDepthMask: enable or disable writing into the depth buffer. C Specification void glDepthMask( GLboolean flag) Parameters flag Description glDepthMask specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer writing is enabled.
glDepthRange glDepthRange: specify mapping of depth values from normalized device coordinates to window coordinates. C Specification void glDepthRange( GLclampd zNear, GLclampd zFar) Parameters zNear zFar Description After clipping and division by w, depth coordinates range from - 1 to 1, corresponding to the near and far clipping planes.
glXDestroyContext glXDestroyContext glXDestroyContext: destroy a GLX context. C Specification void glXDestroyContext( Display *dpy, GLXContext ctx) Parameters Description If the GLX rendering context ctx is not current to any thread, glXDestroyContext destroys it immediately. Otherwise, ctx is destroyed when it becomes not current to any thread.
glXDestroyGLXPixmap glXDestroyGLXPixmap: destroy a GLX pixmap. C Specification void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pix) Parameters Description If the GLX pixmap pix is not current to any client, glXDestroyGLXPixmap destroys it immediately. Otherwise, pix is destroyed when it becomes not current to any client. In either case, the resource ID is freed immediately.
glDisable glDisable glEnable, glDisable: enable or disable server-side GL capabilities. C Specification void glEnable( GLenum cap) void glDisable( GLenum cap) Parameters Description glEnable and glDisable enable and disable various capabilities. Use glIsEnabled or glGet to determine the current setting of any capability. The initial value for each capability with the exception of GL_DITHER is GL_FALSE.
Page 107
glDisable If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRange. GL_DITHER If enabled, dither color components or indices before they are written to the color buffer.
Page 108
glDisable GL_MAP1_TEXTURE_COORD_4 If enabled, calls to glEvalCoord1, glEvalMesh1, and glEvalPoint1 generate s, t, r, and q texture coordinates. See glMap1. GL_MAP1_VERTEX_3 If enabled, calls to glEvalCoord1, glEvalMesh1, and glEvalPoint1 generate x, y, and z vertex coordinates. See glMap1. GL_MAP1_VERTEX_4 If enabled, calls to glEvalCoord1, glEvalMesh1, and glEvalPoint1 generate homogeneous x, y, z, and w vertex coordinates.
Page 109
This token enables HP’s occlusion-testing extension. If any geometry is rendered while occlusion culling is enabled, and if that geometry would be visible (i.e., rendering it would affect the Z-buffer), the occlusion test state bit is set, indicating that the rendered object is visible.
Page 110
glDisable If enabled, one-dimensional texturing is performed (unless two-dimensional texturing is also enabled). See glTexImage1D. GL_TEXTURE_2D If enabled, two-dimensional texturing is performed. See glTexImage2D. GL_TEXTURE_3D_EXT If supported and enabled, three-dimensional texturing is performed. See glTexImage3DEXT. GL_TEXTURE_GEN_Q If enabled, the q texture coordinate is computed using the texture generation function defined with glTexGen.
gluDisk gluDisk gluDisk: draw a disk. C Specification void gluDisk( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops) Parameters quad inner outer slices loops Description gluDisk renders a disk on the z = 0 plane. The disk has a radius of outer, and contains a concentric circular hole with a radius of inner.
glDrawArrays glDrawArrays: render primitives from array data. C Specification void glDrawArrays( GLenum mode, GLint first, GLsizei count) Parameters mode first count Description glDrawArrays specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can pre-specify separate arrays of vertexes, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArrays.
Page 114
glDrawArrays Errors • GL_INVALID_ENUM is generated if mode is not an accepted value. • GL_INVALID_VALUE is generated if count is negative. • GL_INVALID_OPERATION is generated if glDrawArrays is executed between the execution of glBegin and the corresponding glEnd. See Also glArrayElement, glColorPointer, glDrawElements,...
glDrawArraysSethp glDrawArraySethp: render multiple primitives from array data. C Specification void glDrawArraySethp( GLenum mode, const GLint* list, GLsizei count) Parameters mode list count Description glDrawArraySethp specifies multiple geometric primitives of the same type with a single subroutine call. Instead of calling a GL procedure to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can use the vertex array calls to pre-specify arrays of vertices, normals, and colors and use them to construct a sequence of primitives with a single call to glDrawArraySethp.
Page 116
glDrawArraysSethp glDrawArraySethp is included in display lists. If glDrawArraySethp is entered into a display list, the necessary array data (determined by the array pointers and enables) is also entered into the display list. Because the array pointers and enables are client- side state, their values affect display lists when the lists are created, not when the lists are executed.
glDrawBuffer glDrawBuffer: specify which color buffers are to be drawn into. C Specification void glDrawBuffer( GLenum mode) Parameters mode Description When colors are written to the frame buffer, they are written into the color buffers specified by glDrawBuffer. The specifications are as follows: GL_NONE No color buffers are written.
Page 118
glDrawBuffer Only the front left and back left color buffers are written. If there is no back left color buffer, only the front left color buffer is written. GL_RIGHT Only the front right and back right color buffers are written. If there is no back right color buffer, only the front right color buffer is written.
glDrawElements glDrawElements: render primitives from array data. C Specification void glDrawElements( GLenum GLsizei GLenum const GLvoid *indices) Parameters mode count type indices Description glDrawElements specifies multiple geometric primitives with very few subroutine calls. Instead of calling a GL function to pass each individual vertex, normal, texture coordinate, edge flag, or color, you can pre-specify separate arrays of vertexes, normals, and so on and use them to construct a sequence of primitives with a single call to glDrawElements.
Page 120
glDrawElements glDrawElements is included in display lists. If glDrawElements is entered into a display list, the necessary array data (determined by the array pointers and enables) is also entered into the display list. Because the array pointers and enables are client-side state, their values affect display lists when the lists are created, not when the lists are executed.
glDrawPixels glDrawPixels: write a block of pixels to the frame buffer. C Specification void glDrawPixels( GLsizei GLsizei GLenum GLenum const GLvoid *pixels) Parameters width, height format type pixels Description glDrawPixels reads pixel data from memory and writes it into the frame buffer relative to the current raster position.
Page 122
glDrawPixels width height pixels are read from memory, starting at location pixels. By default, these pixels are taken from adjacent memory locations, except that after all width pixels are read, the read pointer is advanced to the next four-byte boundary. The four-byte row alignment is specified by glPixelStore with argument GL_UNPACK_ALIGNMENT, and it can be set to one, two, four, or eight bytes.
Page 123
GL_MAP_STENCIL is true, the index is replaced with the value that it references in lookup table GL_PIXEL_MAP_S_TO_S. Whether the lookup replacement of the index is done or not, the integer part of the index is then ANDed with 2 number of bits in the stencil buffer. The resulting stencil indices are then written to the stencil buffer such that the nth index is written to location + n mod width + n/width...
Page 124
glDrawPixels + n/width where (x like the fragments generated by rasterizing points, lines, or polygons. Texture mapping, fog, and all the fragment operations are applied before the fragments are written to the frame buffer. GL_RED Each pixel is a single red component. This component is converted to the internal floating-point format in the same way the red component of an RGBA pixel is.
Page 125
The following table summarizes the meaning of the valid constants for the type parameter: Table 4-1 Type GL_UNSIGNED_BYTE GL_BYTE GL_BITMAP GL_UNSIGNED_SHORT GL_SHORT GL_UNSIGNED_INT GL_INT GL_FLOAT The rasterization described so far assumes pixel zoom factors of 1. If glPixelZoom is used to change the x and y pixel zoom factors, pixels are converted to fragments as follows.
Page 126
glDrawPixels See Also glAlphaFunc, glBlendFunc, glCopyPixels, glDepthFunc, glLogicOp, glPixelMap, glPixelStore, glPixelTransfer, glPixelZoom, glRasterPos, glReadPixels, glScissor, glStencilFunc Chapter 4...
glEdgeFlag glEdgeFlag glEdgeFlag, glEdgeFlagv: flag edges as either boundary or non-boundary. C Specification void glEdgeFlag( GLboolean flag) void glEdgeFlagv( const GLboolean *flag) Parameters flag flag Description Each vertex of a polygon, separate triangle, or separate quadrilateral specified between a glBegin/glEnd pair is marked as the start of either a boundary or non-boundary edge. If the current edge flag is true when the vertex is specified, the vertex is marked as the start of a boundary edge.
glEdgeFlagPointer glEdgeFlagPointer: define an array of edge flags. C Specification void glEdgeFlagPointer( GLsizei stride const GLvoid *pointer) Parameters stride pointer Description glEdgeFlagPointer specifies the location and data format of an array of boolean edge flags to use when rendering. stride specifies the byte stride from one edge flag to the next allowing vertexes and attributes to be packed into a single array or stored in separate arrays.
Page 130
glEdgeFlagPointer Errors • GL_INVALID_ENUM is generated if stride is negative. Associated Gets glIsEnabled with argument GL_EDGE_FLAG_ARRAY glGet with argument GL_EDGE_FLAG_ARRAY_STRIDE glGetPointer with argument GL_EDGE_FLAG_ARRAY_POINTER See Also glArrayElement, glColorPointer, glDrawArrays, glDrawElements, glEnable, glGetPointer, glIndexPointer, glNormalPointer, glPopClientAttrib, glPushClientAttrib, glTexCoordPointer, glVertexPointer Chapter 5...
glEnable glEnable, glDisable: enable or disable server-side GL capabilities. C Specification void glEnable( GLenum cap) void glDisable( GLenum cap) Parameters Description glEnable and glDisable enable and disable various capabilities. Use glIsEnabled or glGet to determine the current setting of any capability. The initial value for each capability with the exception of GL_DITHER is GL_FALSE.
Page 132
glEnable If enabled, do depth comparisons and update the depth buffer. Note that even if the depth buffer exists and the depth mask is non-zero, the depth buffer is not updated if the depth test is disabled. See glDepthFunc and glDepthRange. GL_DITHER If enabled, dither color components or indices before they are written to the color buffer.
Page 133
GL_MAP1_TEXTURE_COORD_4 If enabled, calls to glEvalCoord1, glEvalMesh1, and glEvalPoint1 generate s, t, r, and q texture coordinates. See glMap1. GL_MAP1_VERTEX_3 If enabled, calls to glEvalCoord1, glEvalMesh1, and glEvalPoint1 generate x, y, and z vertex coordinates. See glMap1. GL_MAP1_VERTEX_4 If enabled, calls to glEvalCoord1, glEvalMesh1, and glEvalPoint1 generate homogeneous x, y, z, and w vertex coordinates.
Page 134
This token enables HP’s occlusion-testing extension. If any geometry is rendered while occlusion culling is enabled, and if that geometry would be visible (i.e., rendering it would affect the Z-buffer), the occlusion test state bit is set, indicating that the rendered object is visible.
Page 135
If enabled, one-dimensional texturing is performed (unless two-dimensional texturing is also enabled). See glTexImage1D. GL_TEXTURE_2D If enabled, two-dimensional texturing is performed. See glTexImage2D. GL_TEXTURE_3D_EXT If supported and enabled, three-dimensional texturing is performed. See glTexImage3DEXT. GL_TEXTURE_GEN_Q If enabled, the q texture coordinate is computed using the texture generation function defined with glTexGen.
glEnableClientState glEnableClientState, glDisableClientState: enable or disable client-side capability. C Specification void glEnableClientState( GLenum cap) void glDisableClientState( GLenum cap) Parameters Description glEnableClientState and glDisableClientState enable or disable individual client-side capabilities. By default, all client-side capabilities are disabled. Both glEnableClientState and glDisableClientState take a single argument, cap, which can assume one of the following values: GL_COLOR_ARRAY If enabled, the color array is enabled for writing and used during rendering when...
Page 138
glEnableClientState If enabled, the vertex array is enabled for writing and used during rendering when glDrawArrays or glDrawElements is called. See glVertexPointer. Notes glEnableClientState is available only if the GL version is 1.1 or greater. Errors • GL_INVALID_ENUM is generated if cap is not an accepted value. glEnableClientState is not allowed between the execution of glBegin and the corresponding glEnd, but an error may or may not be generated.
glErrorString glErrorString gluErrorString: produce an error string from a GL or GLU error code. C Specification constGLubyte *gluErrorString( GLenum error) Parameters error Specifies a GL or GLU error code. Description gluErrorString produces an error string from a GL or GLU error code. The string is in ISO Latin 1 format.
Page 141
is produced, and if any of GL_MAP1_TEXTURE_COORD_1, GL_MAP1_TEXTURE_COORD_2, GL_MAP1_TEXTURE_COORD_3, GL_MAP1_TEXTURE_COORD_4, GL_MAP2_TEXTURE_COORD_1, GL_MAP2_TEXTURE_COORD_2, GL_MAP2_TEXTURE_COORD_3, or GL_MAP2_TEXTURE_COORD_4 is enabled, then an appropriate glTexCoord command is simulated. For color, color index, normal, and texture coordinates the GL uses evaluated values instead of current values for those evaluations that are enabled, and current values otherwise, However, the evaluated values do not update the current values.
Page 142
glEvalCoord glIsEnabled with argument GL_MAP2_INDEX glIsEnabled with argument GL_MAP2_COLOR_4 glIsEnabled with argument GL_MAP2_NORMAL glIsEnabled with argument GL_MAP2_TEXTURE_COORD_1 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_2 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_3 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_4 glIsEnabled with argument GL_AUTO_NORMAL glGetMap See Also glBegin, glColor, glEnable, glEvalMesh, glEvalPoint, glIndex, glMap1,...
glEvalMesh glEvalMesh1, glEvalMesh2: compute a one- or two-dimensional grid of points or lines. C Specification void glEvalMesh1( GLenum mode, GLint i1, GLint i2) void glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) Parameters mode i1, i2 mode i1, i2 j1, j2 Description...
Page 144
glEvalMesh and n, u , and u GL_POINTS if mode is GL_POINT, or GL_LINES if mode is GL_LINE. The one absolute numeric requirement is that if i=n, then the value computed from i In the two-dimensional case, glEvalMesh2, let u = (u u ) / n v = (v where n, u...
Page 145
• GL_INVALID_OPERATION is generated if glEvalMesh is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_MAP1_GRID_DOMAIN glGet with argument GL_MAP2_GRID_DOMAIN glGet with argument GL_MAP1_GRID_SEGMENTS glGet with argument GL_MAP2_GRID_SEGMENTS See Also glBegin, glEvalCoord, glEvalPoint, glMap1,...
glEvalPoint glEvalPoint glEvalPoint1, glEvalPoint2: generate and evaluate a single point in a mesh. C Specification void glEvalPoint1( GLint i) void glEvalPoint2( GLint i, GLint j) Parameters Description glMapGrid and glEvalMesh are used in tandem to efficiently generate and evaluate a series of evenly spaced map domain values.
Page 147
glEvalPoint Associated Gets glGet with argument GL_MAP1_GRID_DOMAIN glGet with argument GL_MAP2_GRID_DOMAIN glGet with argument GL_MAP1_GRID_SEGMENTS glGet with argument GL_MAP2_GRID_SEGMENTS See Also glEvalCoord, glEvalMesh, glMap1, glMap2, glMapGrid Chapter 5...
glFeedbackBuffer glFeedbackBuffer glFeedbackBuffer: controls feedback mode. C Specification void glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer) Parameters size type size Description The glFeedbackBuffer function controls feedback. Feedback, like selection, is a GL mode. The mode is selected by calling glRenderMode with GL_FEEDBACK. When the GL is in feedback mode, no pixels are produced by rasterization.
Page 151
in the feedback buffer. It can also occur after polygons with more than three edges are broken up into triangles, if the GL implementation renders polygons by performing this decomposition. The glPassThrough command can be used to insert a marker into the feedback buffer. See glPassThrough.
Page 152
glFeedbackBuffer The following table gives the correspondence between type and the number of values per vertex. k is 1 in color index mode and 4 in RGBA mode. Table 6-1 type GL_2D GL_3D GL_3D_COLOR GL_3D_COLOR_TEXTURE GL_4D_COLOR_TEXTURE Feedback vertex coordinates are in window coordinates, except w, which is in clip coordinates.
glFinish glFinish: block until all GL execution is complete. C Specification void glFinish(void) Description glFinish does not return until the effects of all previously called GL commands are complete. Such effects include all changes to GL state, all changes to connection state, and all changes to the frame buffer contents.
glFlush glFlush glFlush: force execution of GL commands in finite time. C Specification void glFlush(void) Description Different GL implementations buffer commands in several different locations, including network buffers and the graphics accelerator itself. glFlush empties all of these buffers, causing all issued commands to be executed as quickly as they are accepted by the actual rendering engine.
Page 156
glFog params is a single integer or floating-point value that specifies density, the fog density used in both exponential fog equations. Only nonnegative densities are accepted. The initial fog density is 1. GL_FOG_START params is a single integer or floating-point value that specifies start, the near distance used in the linear fog equation.
Page 157
glFog Associated Gets glIsEnabled with argument GL_FOG glGet with argument GL_FOG_COLOR glGet with argument GL_FOG_INDEX glGet with argument GL_FOG_DENSITY glGet with argument GL_FOG_START glGet with argument GL_FOG_END glGet with argument GL_FOG_MODE See Also glEnable Chapter 6...
glFrontFace glFrontFace glFrontFace: define front- and back-facing polygons. C Specification void glFrontFace( GLenum mode) Parameters mode Description In a scene composed entirely of opaque closed surfaces, back-facing polygons are never visible. Eliminating these invisible polygons has the obvious benefit of speeding up the rendering of the image.
glFrustum glFrustum: multiply the current matrix by a perspective matrix. C Specification void glFrustum( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) Parameters left, right bottom, top zNear, zFar Description glFrustum describes a perspective matrix that produces a perspective projection. The current matrix (see glMatrixMode) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument:...
Page 160
glFrustum Use glPushMatrix and glPopMatrix to save and restore the current matrix stack. Notes Depth buffer precision is affected by the values specified for zNear and zFar. The greater the ratio of zFar to zNear is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other.
glGenLists glGenLists glGenLists: generate a contiguous set of empty display lists. C Specification GLuint glGenLists( GLsizei range) Parameters range Description glGenLists has one argument, range. It returns an integer n such that range contiguous empty display lists, named n, n + 1, . . ., n + range - 1, are created. If range is 0, if there is no group of range contiguous names available, or if any error is generated, no display lists are generated, and 0 is returned.
glGenTextures glGenTextures: generate texture names. C Specification void glGenTextures( GLsizei n, GLuint *textures) Parameters textures Description glGenTextures returns n texture names in textures. There is no guarantee that the names form a contiguous set of integers; however, it is guaranteed that none of the returned names was in use immediately before the call to glGenTextures.
glGet glGetBooleanv, glGetDoublev, glGetFloatv, glGetIntegerv: return the value or values of a selected parameter. C Specification void glGetBooleanv( GLenum pname, GLboolean *params) void glGetDoublev( GLenum pname, GLdouble *params) void glGetFloatv( GLenum pname, GLfloat *params) void glGetIntegerv( GLenum pname, GLint *params) Parameters pname params...
Page 166
glGet GL_ACCUM_CLEAR_VALUE params returns four values: the red, green, blue, and alpha values used to clear the accumulation buffer. Integer values, if requested, are linearly mapped from the internal floating-point representation such that 1.0 returns the most positive representable integer value, and - 1.0 returns the most negative representable integer value. The initial value is (0, 0, 0, 0).
Page 167
glGet GL_BLEND_DST params returns one value, the symbolic constant identifying the destination blend function. The initial value is GL_ZERO. See glBlendFunc. GL_BLEND_SRC params returns one value, the symbolic constant identifying the source blend function. The initial value is GL_ONE. See glBlendFunc. GL_BLUE_BIAS params returns one value, the blue bias factor used during pixel transfers.
Page 168
glGet params returns a single boolean value indicating whether a fragment’s RGBA color values are merged into the frame buffer using a logical operation. The initial value is GL_FALSE. See glLogicOp. GL_COLOR_MATERIAL params returns a single boolean value indicating whether one or more material parameters are tracking the current color.
Page 169
glGet params returns four values: the red, green, blue, and alpha values of the current raster position. Integer values, if requested, are linearly mapped from the internal floating-point representation such that 1.0 returns the most positive representable integer value, and - 1.0 returns the most negative representable integer value. The initial value is (1, 1, 1, 1).
Page 170
glGet GL_DEPTH_SCALE params returns one value, the depth scale factor used during pixel transfers. The initial value is 1. See glPixelTransfer. GL_DEPTH_TEST params returns a single boolean value indicating whether depth testing of fragments is enabled. The initial value is GL_FALSE. See glDepthFunc and glDepthRange. GL_DEPTH_WRITEMASK params returns a single boolean value indicating if the depth buffer is enabled for writing.
Page 171
glGet params returns a single boolean value indicating whether edge clamping is enabled. The initial value is GL_FALSE. See glTexImage3DEXT. GL_FOG params returns a single boolean value indicating whether fogging is enabled. The initial value is GL_FALSE. See glFog. GL_FOG_COLOR params returns four values: the red, green, blue and alpha components of the fog color.
Page 172
glGet params returns a single boolean value indicating whether texture lighting is enabled. The initial value is GL_FALSE. See glTexImage3DEXT. GL_INDEX_ARRAY params returns a single boolean value indicating whether the color index array is enabled. The initial value is GL_FALSE. See glIndexPointer. GL_INDEX_ARRAY_STRIDE params returns one value, the byte offset between consecutive color indexes in the color index array.
Page 173
glGet params returns four values: the red, green, blue, and alpha components of the ambient intensity of the entire scene. Integer values, if requested, are linearly mapped from the internal floating-point representation such that 1.0 returns the most positive representable integer value, and - 1.0 returns the most negative representable integer value.
Page 174
glGet params returns one value, the name of the display list currently under construction. 0 is returned if no display list is currently under construction. The initial value is 0. See glNewList. GL_LIST_MODE params returns one value, a symbolic constant indicating the construction mode of the display list currently under construction.
Page 175
glGet params returns a single boolean value indicating whether 1D evaluation generates 4D vertex coordinates. The initial value is GL_FALSE. See glMap1. GL_MAP2_COLOR_4 params returns a single boolean value indicating whether 2D evaluation generates colors. The initial value is GL_FALSE. See glMap2. GL_MAP2_GRID_DOMAIN params returns four values: the endpoints of the 2D map’s i and j grid domains.
Page 176
glGet GL_MATRIX_MODE params returns one value, a symbolic constant indicating which matrix stack is currently the target of all matrix operations. The initial value is GL_MODELVIEW. See glMatrixMode. GL_MAX_CLIENT_ATTRIB_STACK_DEPTH params returns one value indicating the maximum supported depth of the client attribute stack.
Page 177
The initial value is GL_FALSE. See glNormal. GL_OCCLUSION_TEST_hp params returns a single boolean value indicating whether HP’s occlusion-testing extension is currently activated. See glEnable. GL_OCCLUSION_TEST_RESULT_hp params returns a single boolean value indicating whether the previously-rendered geometry was entirely occluded.
Page 178
glGet params returns a single boolean value indicating whether single-bit pixels being written to memory are written first to the least significant bit of each unsigned byte. The initial value is GL_FALSE. See glPixelStore. GL_PACK_ROW_LENGTH params returns one value, the row length used for writing pixel data to memory. The initial value is 0.
Page 179
glGet params returns one value, the size of the index-to-red pixel translation table. The initial value is 1. See glPixelMap. GL_PIXEL_MAP_R_TO_R_SIZE params returns one value, the size of the red-to-red pixel translation table. The initial value is 1. See glPixelMap. GL_PIXEL_MAP_S_TO_S_SIZE params returns one value, the size of the stencil-to-stencil pixel translation table.
Page 180
glGet params returns a single boolean value indicating whether polygon offset is enabled for polygons in line mode. The initial value is GL_FALSE. See glPolygonOffset. GL_POLYGON_OFFSET_POINT params returns a single boolean value indicating whether polygon offset is enabled for polygons in point mode. The initial value is GL_FALSE. See glPolygonOffset. GL_POLYGON_SMOOTH params returns a single boolean value indicating whether anti-aliasing of polygons is enabled.
Page 181
glGet params returns four values: the x and y window coordinates of the scissor box, followed by its width and height. Initially the x and y window coordinates are both 0 and the width and height are set to the size of the window. See glScissor. GL_SCISSOR_TEST params returns a single boolean value indicating whether scissoring is enabled.
Page 182
glGet params returns one value, the mask that controls writing of the stencil bitplanes. The initial value is all 1s. See glStencilMask. GL_STEREO params returns a single boolean value indicating whether stereo buffers (left and right) are supported. GL_SUBPIXEL_BITS params returns one value, an estimate of the number of bits of subpixel resolution that are used to position rasterized geometry in window coordinates.
Page 183
glGet params returns a single boolean value indicating whether automatic generation of the S texture coordinate is enabled. The initial value is GL_FALSE. See glTexGen. GL_TEXTURE_GEN_T params returns a single boolean value indicating whether automatic generation of the T texture coordinate is enabled. The initial value is GL_FALSE. See glTexGen. GL_TEXTURE_MATRIX params returns sixteen values: the texture matrix on the top of the texture matrix stack.
Page 184
glGet params returns one value, the data type of each coordinate in the vertex array. The initial value is GL_FLOAT. See glVertexPointer. GL_VIEWPORT params returns four values: the x and y window coordinates of the viewport, followed by its width and height. Initially the x and y window coordinates are both set to 0, and the width and height are set to the width and height of the window into which the GL will do its rendering.
glXGetClientString glXGetClientString glXGetClientString: return a string describing the client. C Specification constchar *glXGetClientString( Display *dpy, int name) Parameters name Description glXGetClientString returns a string describing some aspect of the client library. The possible values for name are GLX_VENDOR, GLX_VERSION, and GLX_EXTENSIONS. If name is not set to one of these values, glXGetClientString returns NULL.
glXGetClipPlane glGetClipPlane: return the coefficients of the specified clipping plane. C Specification void glGetClipPlane( GLenum plane, GLdouble *equation) Parameters plane equation Description glGetClipPlane returns in equation the four coefficients of the plane equation for plane. Notes It is always the case that GL_CLIP_PLANEi = GL_CLIP_PLANE0 + i. If an error is generated, no change is made to the contents of equation.
glXGetConfig glXGetConfig glXGetConfig: return information about GLX visuals. C Specification int glXGetConfig( Display *dpy, XVisualInfo *vis, int attrib, int *value) Parameters attrib Description glXGetConfig sets value to the attrib value of windows or GLX pixmaps created with respect to vis. glXGetConfig returns an error code if it fails for an reason. Otherwise, zero is returned.
Page 189
glXGetConfig GLX_AUX_BUFFERS Number of auxiliary color buffers that are available. Zero indicates that no auxiliary color buffers exist. GLX_RED_SIZE Number of bits of red stored in each color buffer. Undefined if GLX_RGBA is False. GLX_GREEN_SIZE Number of bits of green stored in each color buffer. Undefined if GLX_RGBA is False. GLX_BLUE_SIZE Number of bits of blue stored in each color buffer.
Page 190
glXGetConfig Notes XVisualInfo is defined in Xutil.h. It is a structure that includes visual, visualID, screen, and depth elements. Errors • GLX_NO_EXTENSION is returned if dpy does not support the GLX extension. • GLX_BAD_SCREEN is returned if the screen of vis does not correspond to a screen. •...
glXGetCurrentContext glXGetCurrentContext glXGetCurrentContext: return the current context. C Specification GLXContext glXGetCurrentContext(void) Description glXGetCurrentContext returns the current context, as specified by glXMakeCurrent. If there is no current context, NULL is returned. glXGetCurrentContext returns client-side information. It does not make a round trip to the server. See Also glXCreateContext, glXMakeCurrent...
glXGetCurrentDisplay glXGetCurrentDisplay glXGetCurrentDisplay: get display for current context. C Specification Display *glXGetCurrentDisplay(void) Description glXGetCurrentDisplay returns the display for the current context. If no context is current, NULL is returned. glXGetCurrentDisplay returns client-side information. It does not make a round trip to the server, and therefore does not flush any pending events.
glXGetCurrentDrawable glXGetCurrentDrawable glXGetCurrentDrawable: return the current drawable. C Specification GLXDrawable glXGetCurrentDrawable(void) Description glXGetCurrentDrawable returns the current drawable, as specified by glXMakeCurrent. If there is no current drawable, None is returned. glXGetCurrentDrawable returns client-side information. It does not make a round trip to the server.
glGetError glGetError glGetError: return error information. C Specification GLenum glGetError(void) Description glGetError returns the value of the error flag. Each detectable error is assigned a numeric code and symbolic name. When an error occurs, the error flag is set to the appropriate error code value.
Page 195
There is not enough memory left to execute the command. The state of the GL is undefined, except for the state of the error flags, after this error is recorded. When an error flag is set, results of a GL operation are undefined only if GL_OUT_OF_MEMORY has occurred.
glGetLight glGetLight glGetLightfv, glGetLightiv: return light source parameter values. C Specification void glGetLightfv( GLenum light, GLenum pname, GLfloat *params) void glGetLightiv( GLenum light, GLenum pname, GLint *params) Parameters light pname params Description glGetLight returns in params the value or values of a light source parameter. light names the light and is a symbolic name of the form GL_LIGHTi for 0 GL_MAX_LIGHTS, where GL_MAX_LIGHTS is an implementation-dependent constant that is greater than or equal to eight.
Page 197
glGetLight params returns four integer or floating-point values representing the diffuse intensity of the light source. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and - 1.0 maps to the most negative representable integer value. If the internal value is outside the range [- 1, 1], the corresponding integer return value is undefined.
Page 198
glGetLight params returns a single integer or floating-point value representing the linear attenuation of the light. An integer value, when requested, is computed by rounding the internal floating-point representation to the nearest integer. The initial value is 0. GL_QUADRATIC_ATTENUATION params returns a single integer or floating-point value representing the quadratic attenuation of the light.
glGetMap glGetMapdv, glGetMapfv, glGetMapiv: return evaluator parameters. C Specification void glGetMapdv( GLenum target, GLenum query, GLdouble *v) void glGet GLenum target, GLenum query, GLfloat *v) void glGetMapiv( GLenum target, GLenum query, GLint *v) Parameters target query Description glMap1 and glMap2 define evaluators. glGetMap returns evaluator parameters. target chooses a map, query selects a specific parameter, and v points to storage where the values will be returned.
Page 200
glGetMap the type of the evaluator. The GL returns two-dimensional control points in row-major order, incrementing the uorder index quickly and the vorder index after each row. Integer values, when requested, are computed by rounding the internal floating-point values to the nearest integer values. GL_ORDER v returns the order of the evaluator function.
glGetMaterial glGetMaterialfv, glGetMaterialiv: return material parameters. C Specification void glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params) void glGetMaterialiv( GLenum face, GLenum pname, GLint *params) Parameters face pname params Description glGetMaterial returns in params the value or values of parameter pname of material face.
Page 202
glGetMaterial params returns four integer or floating-point values representing the specular reflectance of the material. Integer values, when requested, are linearly mapped from the internal floating-point representation such that 1.0 maps to the most positive representable integer value, and - 1.0 maps to the most negative representable integer value.
gluGetNurbsProperty gluGetNurbsProperty: get a NURBS property. C Specification void gluGetNurbsProperty( GLUnurbs* nurb, GLenum property, GLfloat* data) Parameters nurb property data Description gluGetNurbsProperty retrieves properties stored in a NURBS object. These properties affect the way that NURBS curves and surfaces are rendered. See the gluNurbsProperty reference page for information about what the properties are and what they do.
glGetPixelMap glGetPixelMap glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv: return the specified pixel map. C Specification void glGetPixelMapfv GLenum map GLfloat *values void glGetPixelMapuiv GLenum map GLuint *values void glGetPixelMapusv GLenum map GLushort *values) Parameters values Description See the glPixelMap reference page for a description of the acceptable values for the map parameter.
Page 205
• GL_INVALID_OPERATION is generated if glGetPixelMap is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_PIXEL_MAP_I_TO_I_SIZE glGet with argument GL_PIXEL_MAP_S_TO_S_SIZE glGet with argument GL_PIXEL_MAP_I_TO_R_SIZE glGet with argument GL_PIXEL_MAP_I_TO_G_SIZE glGet with argument GL_PIXEL_MAP_I_TO_B_SIZE glGet with argument GL_PIXEL_MAP_I_TO_A_SIZE glGet with argument GL_PIXEL_MAP_R_TO_R_SIZE glGet with argument GL_PIXEL_MAP_G_TO_G_SIZE...
glGetPointer glGetPointer glGetPointer: return the address of the specified pointer. C Specification void glGetPointerv( GLenum pname, GLvoid* *params) Parameters pname params Description glGetPointerv returns pointer information. pname is a symbolic constant indicating the pointer to be returned, and params is a pointer to a location in which to place the returned data.
glGetPolygonStipple glGetPolygonStipple glGetPolygonStipple: return the polygon stipple pattern. C Specification void glGetPolygonStipple GLubyte *mask) Parameters mask Description glGetPolygonStipple returns to mask a 32 packed into memory as if glReadPixels with both height and width of 32, type of GL_BITMAP, and format of GL_COLOR_INDEX were called, and the stipple pattern were stored in an internal 32 32 color index buffer.
glGetString glGetString: return a string describing the current GL connection. C Specification constGLubyte *glGetString( GLenum name) Parameters name Description glGetString returns a pointer to a static string describing some aspect of the current GL connection. name can be one of the following: GL_VENDOR Returns the company responsible for this GL implementation.
Page 210
glGetString All strings are null-terminated. Notes If an error is generated, glGetString returns 0. The client and server may support different versions or extensions. glGetString always returns a compatible version number or list of extensions. The release number always describes the server. Errors •...
gluGetString gluGetString: return a string describing the GLU version or GLU extensions. C Specification constGLubyte *gluGetString(GLenum Parameters name Description gluGetString returns a pointer to a static string describing the GLU version or the GLU extensions that are supported. The version number is one of the following forms: <major_number>.<minor_number>...
gluGetTessProperty gluGetTessProperty gluGetTessProperty: get a tessellation object property. C Specification void gluGetTessProperty( GLUtesselator* tess, GLenum which, GLdouble* data) Parameters tess which data Description gluGetTessProperty retrieves properties stored in a tessellation object. These properties affect the way that tessellation objects are interpreted and rendered. See the gluTessProperty reference page for information about the properties and what they do.
glGetTexEnv glGetTexEnvfv, glGetTexEnviv: return texture environment parameters. C Specification void glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params) void glGetTexEnviv( GLenum target, GLenum pname, GLint *params) Parameters target pname params Description glGetTexEnv returns in params selected values of a texture environment that was specified with glTexEnv.
Page 214
glGetTexEnv GL_TEXTURE_LIGHTING_MODE_hp is only supported if the GL_hp_texture_lighting extension is supported. Errors • GL_INVALID_ENUM is generated if target or pname is not an accepted value. • GL_INVALID_OPERATION is generated if glGetTexEnv is executed between the execution of glBegin and the corresponding execution of glEnd. See Also glTexEnv Chapter 7...
glGetTexGen glGetTexGendv, glGetTexGenfv, glGetTexGeniv: return texture coordinate generation parameters. C Specification void glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params) void glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params) void glGetTexGeniv( GLenum coord, GLenum pname, GLint *params) Parameters coord pname params Description glGetTexGen returns in params selected parameters of a texture coordinate generation function that was specified using glTexGen.
Page 216
glGetTexGen params returns the four plane equation coefficients that specify eye linear-coordinate generation. Integer values, when requested, are mapped directly from the internal floating-point representation. The returned values are those maintained in eye coordinates. They are not equal to the values specified using glTexGen, unless the modelview matrix was identity when glTexGen was called.
glGetTexImage glGetTexImage: return a texture image. C Specification void glGetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels) Parameters target level format type pixels Description glGetTexImage returns a texture image into pixels. target specifies whether the desired texture image is one specified by glTexImage1D (GL_TEXTURE_1D) or by glTexImage2D (GL_TEXTURE_2D).
Page 218
glGetTexImage If the selected texture image does not contain four components, the following mappings are applied. Single-component textures are treated as RGBA buffers with red set to the single-component value, green set to 0, blue set to 0, and alpha set to 1. Two-component textures are treated as RGBA buffers with red set to the value of component zero, alpha set to the value of component one, and green and blue set to 0.
glGetTexLevelParameter glGetTexLevelParameterfv, glGetTexLevelParameteriv: return texture parameter values for a specific level of detail. C Specification void glGetTexLevelParameterfv( GLenum target, GLint level, GLenum pname GLfloat *params) void glGetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params) Parameters target level pname params Description glGetTexLevelParameter returns in params texture parameter values for a specific level-of-detail value, specified as level.
Page 220
glGetTexLevelParameter pname specifies the texture parameter whose value or values will be returned. The accepted parameter names are as follows: GL_TEXTURE_WIDTH params returns a single value, the width of the texture image. This value includes the border of the texture image. The initial value is 0. GL_TEXTURE_HEIGHT params returns a single value, the height of the texture image.
glGetTexParameter glGetTexParameter glGetTexParameterfv, glGetTexParameteriv: return texture parameter values. C Specification void glGetTexParameterfv( GLenum target, GLenum pname, GLfloat *params) void glGetTexParameteriv( GLenum target, GLenum pname, GLint *params) Parameters target pname params Description glGetTexParameter returns in params the value or values of the texture parameter specified as pname.
Page 223
Returns the single-valued wrapping function for texture coordinate s, a symbolic constant. The initial value is GL_REPEAT. GL_TEXTURE_WRAP_T Returns the single-valued wrapping function for texture coordinate t, a symbolic constant. The initial value is GL_REPEAT. GL_TEXTURE_BORDER_COLOR Returns four integer or floating-point numbers that comprise the RGBA color of the texture border.
Page 224
glGetTexParameter See Also glAreTexturesResident, glPrioritizeTextures, glTexParameter Chapter 7...
glHint glHint glHint: specify implementation-specific hints. C Specification void glHint( GLenum target, GLenum mode) Parameters target mode Description Certain aspects of GL behavior, when there is room for interpretation, can be controlled with hints. A hint is specified with two arguments. target is a symbolic constant indicating the behavior to be controlled, and mode is another symbolic constant indicating the desired behavior.
Page 227
GL_PERSPECTIVE_CORRECTION_HINT Indicates the quality of color and texture coordinate interpolation. If perspective-corrected parameter interpolation is not efficiently supported by the GL implementation, hinting GL_DONT_CARE or GL_FASTEST can result in simple linear interpolation of colors and/or texture coordinates. GL_POINT_SMOOTH_HINT Indicates the sampling quality of anti-aliased points. If a larger filter function is applied, hinting GL_NICEST can result in more pixel fragments being generated during rasterization, GL_POLYGON_SMOOTH_HINT...
glIndex glIndex glIndexd, glIndexf, glIndexi, glIndexs, glIndexub, glIndexdv, glIndexfv, glIndexiv, glIndexsv, glIndexubv: set the current color index. C Specification void glIndexd( GLdouble c) void glIndexf( GLfloat c) void glIndexi( GLint c) void glIndexs( GLshort c) void glIndexub( GLubyte c) void glIndexdv( const GLdouble *c) void glIndexfv( const GLfloat *c)
Page 231
glIndex Notes glIndexub and glIndexubv are available only if the GL version is 1.1 or greater. The current index can be updated at any time. In particular, glIndex can be called between a call to glBegin and the corresponding call to glEnd. Associated Gets glGet with argument GL_CURRENT_INDEX See Also...
glIndexMask glIndexMask glIndexMask: control the writing of individual bits in the color index buffers. C Specification void glIndexMask( GLuint mask) Parameters mask Description glIndexMask controls the writing of individual bits in the color index buffers. The least significant n bits of mask, where n is the number of bits in a color index buffer, specify a mask.
glIndexPointer glIndexPointer: define an array of color indexes. C Specification void glIndexPointer( GLenum type, GLsizei stride, const GLvoid *pointer) Parameters type array stride pointer Description glIndexPointer specifies the location and data format of an array of color indexes to use when rendering.
Page 234
glIndexPointer glIndexPointer is typically implemented on the client side. Since the color index array parameters are client-side state, they are not saved or restored by glPushAttrib and glPopAttrib. Use glPushClientAttrib and glPopClientAttrib instead. Errors • GL_INVALID_ENUM is generated if type is not an accepted value. •...
glInitNames glInitNames: initialize the name stack. C Specification void glInitNames(void) Description The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers. glInitNames causes the name stack to be initialized to its default empty state. The name stack is always empty while the render mode is not GL_SELECT.
glInterleavedArrays glInterleavedArrays glInterleavedArrays: simultaneously specify and enable several interleaved arrays. C Specification void glInterleavedArrays( GLenum format, GLsizei stride, const GLvoid *pointer) Parameters format stride Description glInterleavedArrays lets you specify and enable individual color, normal, texture and vertex arrays whose elements are part of a larger aggregate array element. For some implementations, this is more efficient than specifying the arrays separately.
Page 237
Vertex array parameters are client-side state and are therefore not saved or restored by glPushAttrib and glPopAttrib. Use glPushClientAttrib and glPopClientAttrib instead. Errors • GL_INVALID_ENUM is generated if format is not an accepted value. • GL_INVALID_VALUE is generated if stride is negative. See Also glArrayElement, glColorPointer,...
glXIntro glXIntro glXIntro: Introduction to OpenGL in the X Window system. Overview OpenGL (called GL in other pages) is a high-performance 3D-oriented renderer. It is available in the X window system through the GLX extension. To determine whether the GLX extension is supported by an X server, and if so, what version is supported, call glXQueryExtension and glXQueryVersion.
Page 239
GLX_RGBA, GLX_DOUBLE_BUFFER, /*In case single buffering is not supported*/ GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, None}; static Bool WaitForNotify(Display *d, XEvent *e, char *arg) { return (e->type == MapNotify) && (e->xmap.window == (Window)arg); int main(int argc, char **argv) { Display *dpy; XVisualInfo *vi;...
Page 240
glXIntro /* wait a while */ sleep(10); Notes A color map must be created and passed to XCreateWindow. See the preceding example code. A GLX context must be created and attached to an X drawable before OpenGL commands can be executed. OpenGL commands issued while no context/drawable pair is current result in undefined behavior.
glXIsDirect glXIsDirect glXIsDirect: indicate whether direct rendering is enabled. C Specification Bool glXIsDirect( Display *dpy, GLXContext ctx) Parameters Description glXIsDirect returns True if ctx is a direct rendering context, False otherwise. Direct rendering contexts pass rendering commands directly from the calling process’s address space to the rendering system, bypassing the X server.
glIsEnabled glIsEnabled: test whether a capability is enabled. C Specification GLboolean glIsEnabled( GLenum cap) Parameters Description glIsEnabled returns GL_TRUE if cap is an enabled capability and returns GL_FALSE otherwise. Initially all capabilities except GL_DITHER are disabled; GL_DITHER is initially enabled. The following capabilities are accepted for cap: Constant GL_ALPHA_TEST...
Page 245
GL_COLOR_LOGIC_OP, GL_COLOR_ARRAY, GL_EDGE_FLAG_ARRAY, GL_INDEX_ARRAY, GL_INDEX_LOGIC_OP, GL_NORMAL_ARRAY, GL_POLYGON_OFFSET_FILL,GL_POLYGON_OFFSET_LINE, GL_POLYGON_OFFSET_POINT, GL_TEXTURE_COORD_ARRAY, and GL_VERTEX_ARRAY are only available if the GL version is 1.1 or greater Errors • GL_INVALID_ENUM is generated if cap is not an accepted value. • GL_INVALID_OPERATION is generated if glIsEnabled is executed between the execution of glBegin and the corresponding execution of glEnd.
glIsList glIsList glIsList: determine if a name corresponds to a display-list. C Specification GLboolean glIsList( GLuint list) Parameters list Description glIsList returns GL_TRUE if list is the name of a display list and returns GL_FALSE otherwise. Errors • GL_INVALID_OPERATION is generated if glIsList is executed between the execution of glBegin and the corresponding execution of glEnd.
glIsTexture glIsTexture: determine if a name corresponds to a texture. C Specification GLboolean glIsTexture( GLuint texture) Parameters texture Description glIsTexture returns GL_TRUE if texture is currently the name of a texture. If texture is zero, or is a non-zero value that is not currently the name of a texture, or if an error occurs, glIsTexture returns GL_FALSE.
Page 251
glLight Description glLight sets the values of individual light source parameters. light names the light and is a symbolic name of the form GL_LIGHTi, where 0 i < GL_MAX_LIGHTS. pname specifies one of ten light source parameters, again by symbolic name. params is either a single value or a pointer to an array that contains the new values.
Page 252
glLight direction is transformed by the inverse of the modelview matrix when glLight is called (just as if it were a normal), and it is stored in eye coordinates. It is significant only when GL_SPOT_CUTOFF is not 180, which it is initially. The initial direction is (0, 0, 1). GL_SPOT_EXPONENT params is a single integer or floating-point value that specifies the intensity distribution of the light.
Page 253
glLight Associated Gets glGetLight glIsEnabled with argument GL_LIGHTING See Also glColorMaterial, glLightModel, glMaterial Chapter 10...
Page 255
params is a single integer or floating-point value that specifies how specular reflection angles are computed. If params is 0 (or 0.0), specular reflection angles take the view direction to be parallel to and in the direction of the - Z axis, regardless of the location of the vertex in eye coordinates.
Page 256
glLightModel See Also glLight, glMaterial Chapter 10...
glLineStipple glLineStipple: specify the line stipple pattern. C Specification void glLineStipple( GLint factor, GLushort pattern) Parameters factor pattern Description Line stippling masks out certain fragments produced by rasterization; those fragments will not be drawn. The masking is achieved by using three parameters: the 16-bit line stipple pattern pattern, the repeat count factor, and an integer stipple counter s.
Page 258
glLineStipple Associated Gets glGet with argument GL_LINE_STIPPLE_PATTERN glGet with argument GL_LINE_STIPPLE_REPEAT glIsEnabled with argument GL_LINE_STIPPLE See Also glLineWidth, glPolygonStipple Chapter 10...
glLineWidth glLineWidth glLineWidth: specify the width of rasterized lines. C Specification void glLineWidth( GLfloat width) Parameters width Specifies the width of rasterized lines. The initial value is 1. Description glLineWidth specifies the rasterized width of both aliased and anti-aliased lines. Using a line width other than 1 has different effects, depending on whether line anti-aliasing is enabled.
Page 260
glLineWidth • GL_INVALID_OPERATION is generated if glLineWidth is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_LINE_WIDTH glGet with argument GL_LINE_WIDTH_RANGE glGet with argument GL_LINE_WIDTH_GRANULARITY glIsEnabled with argument GL_LINE_SMOOTH See Also glEnable Chapter 10...
glListBase glListBase: set the display-list base for glCallLists. C Specification void glListBase( GLuint base) Parameters base Description glCallLists specifies an array of offsets. Display-list names are generated by adding base to each offset. Names that reference valid display lists are executed; the others are ignored.
glLoadIdentity glLoadIdentity glLoadIdentity: replace the current matrix with the identity matrix. C Specification void glLoadIdentity(void) Description glLoadIdentity replaces the current matrix with the identity matrix. It is semantically equivalent to calling glLoadMatrix with the identity matrix: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1...
glLoadMatrix glLoadMatrixd, glLoadMatrixf: replace the current matrix with the specified matrix. C Specification void glLoadMatrixd( const GLdouble *m) void glLoadMatrixf( const GLfloa *m) Parameters Description glLoadMatrix replaces the current matrix with the one whose elements are specified by m. The current matrix is the projection matrix, modelview matrix, or texture matrix, depending on the current matrix mode (see glMatrixMode).
Page 264
glLoadMatrix Associated Gets glGet with argument GL_MATRIX_MODE glGet with argument GL_MODELVIEW_MATRIX glGet with argument GL_PROJECTION_MATRIX glGet with argument GL_TEXTURE_MATRIX See Also glLoadIdentity, glMatrixMode, glMultMatrix, glPushMatrix Chapter 10...
glLoadName glLoadName: load a name onto the name stack. C Specification void glLoadName( GLuint name) Parameters name Description The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers. glLoadName causes name to replace the value on the top of the name stack, which is initially empty.
glLogicOp glLogicOp: specify a logical pixel operation for color index rendering. C Specification void glLogicOp( GLenum opcode) Parameters opcode Description glLogicOp specifies a logical operation that, when enabled, is applied between the incoming color index or RGBA color and the color index or RGBA color at the corresponding location in the frame buffer.
Page 268
glLogicOp opcode is a symbolic constant chosen from the list above. In the explanation of the logical operations, s represents the incoming color index and d represents the index in the frame buffer. Standard C-language operators are used. As these bitwise operators suggest, the logical operation is applied independently to each bit pair of the source and destination indices or colors.
glXMakeCurrent glXMakeCurrent glXMakeCurrent: attach a GLX context to a window or a GLX pixmap. C Specification Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, GLXContext ctx) Parameters drawable Description glXMakeCurrent does two things: It makes ctx the current GLX rendering context of the calling thread, replacing the previously current context if there was one, and it attaches ctx to a GLX drawable, either a window or a GLX pixmap.
Page 273
Errors • BadMatch is generated if drawable was not created with the same X screen and visual as ctx. It is also generated if drawable is None and ctx is not NULL. • BadAccess is generated if ctx was current to another thread at the time glXMakeCurrent was called.
Page 275
All polynomial or rational polynomial splines of any degree (up to the maximum degree supported by the GL implementation) can be described using evaluators. These include almost all splines used in compute graphics: B-splines, Bezier curves, Hermite splines, and so on. Evaluators define curves based on Bernstein polynomials.
Page 276
glMap1 Each control point is four floating-point values representing red, green, blue, and alpha. Internal glColor4 commands are generated when the map is evaluated but the current color is not updated with the value of these glColor4 commands. GL_MAP1_NORMAL Each control point is three floating-point values representing the x, y, and z components of a normal vector.
Page 277
• GL_INVALID_VALUE is generated if order is less than 1 or greater than the return value of GL_MAX_EVAL_ORDER. • GL_INVALID_OPERATION is generated if glMap1 is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGetMap glGet with argument GL_MAX_EVAL_ORDER glIsEnabled with argument GL_MAP1_VERTEX_3 glIsEnabled with argument GL_MAP1_VERTEX_4...
Page 279
v1, v2 vstride vorder Description Evaluators provide a way to use polynomial or rational polynomial mapping to produce vertices, normals, texture coordinates, and colors. The values produced by an evaluator are sent on to further stages of GL processing just as if they had been presented using glVertex, glNormal, glTexCoord, and glColor commands, except that the generated values do not update the current normal, texture coordinates, or color.
Page 280
glMap2 Equation 11-8 glMap2 is used to define the basis and to specify what kind of values are produced. Once defined, a map can be enabled and disabled by calling glEnable and glDisable with the map name, one of the nine predefined values for target, described below. WhenglEvalCoord2 presents values u and v, the bivariate Bernstein polynomials are evaluated using û...
Page 281
Each control point is two floating-point values representing the s and t texture coordinates. Internal glTexCoord2 commands are generated when the map is evaluated but the current texture coordinates are not updated with the value of these glTexCoord commands. GL_MAP2_TEXTURE_COORD_3 Each control point is three floating-point values representing the s, t, and r texture coordinates.
Page 282
glMap2 Associated Gets glGetMap glGet with argument GL_MAX_EVAL_ORDER glIsEnabled with argument GL_MAP2_VERTEX_3 glIsEnabled with argument GL_MAP2_VERTEX_4 glIsEnabled with argument GL_MAP2_INDEX glIsEnabled with argument GL_MAP2_COLOR_4 glIsEnabled with argument GL_MAP2_NORMAL glIsEnabled with argument GL_MAP2_TEXTURE_COORD_1 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_2 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_3 glIsEnabled with argument GL_MAP2_TEXTURE_COORD_4 See Also glBegin,...
glMapGrid glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f: define a one- or two-dimensional mesh. C Specification void glMapGrid1d( GLint un, GLdouble u1, GLdouble u2) void glMapGrid1f( GLint un, GLfloat u1, GLfloat u2) void glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2) void glMapGrid2f( GLint un,...
Page 284
glMapGrid glMapGrid1 and glMapGrid2 specify the linear grid mappings between the i (or i and j) integer grid coordinates, to the u (or u and v) floating-point evaluation map coordinates. See glMap1 and glMap2 for details of how u and v coordinates are evaluated. glMapGrid1 specifies a single linear mapping such that integer grid coordinate 0 maps exactly to u1, and integer grid coordinate un maps exactly to u2.
Page 286
glMaterials glMaterial takes three arguments. The first, face, specifies whether the GL_FRONT materials, the GL_BACK materials, or both GL_FRONT_AND_BACK materials will be modified. The second, pname, specifies which of several parameters in one or both sets will be modified. The third, params, specifies what value or values will be assigned to the specified parameter.
Page 287
params contains three integer or floating-point values specifying the color indices for ambient, diffuse, and specular lighting. These three values, and GL_SHININESS, are the only material values used by the color index mode lighting equation. Refer to the glLightModel reference page for a discussion of color index lighting. Notes The material parameters can be updated at any time.
glMatrixMode glMatrixMode glMatrixMode: specify which matrix is the current matrix. C Specification void glMatrixMode( GLenum mode) Parameters mode Description glMatrixMode sets the current matrix mode. mode can assume one of three values: GL_MODELVIEW Applies subsequent matrix operations to the modelview matrix stack. GL_PROJECTION Applies subsequent matrix operations to the projection matrix stack.
glMultMatrix glMultMatrixd, glMultMatrixf: multiply the current matrix with the specified matrix. C Specification void glMultMatrixd( const GLdouble *m) void glMultMatrixf( const GLfloat *m) Parameters Description glMultMatrix multiplies the current matrix with the one specified using m, and replaces the current matrix with the product. The current matrix is determined by the current matrix mode (see glMatrixMode).
Page 290
glMultMatrix In many computer languages, 4 4 arrays are represented in row-major order. The transformations just described represent these matrices in column-major order. The order of the multiplication is important. For example, if the current transformation is a rotation, and glMultMatrix is called with a translation matrix, the translation is done directly on the coordinates to be transformed, while the rotation is done on the results of that translation.
glNewList glNewList glNewList, glEndList: create or replace a display list. C Specification void glNewList( GLuint list, GLenum mode) void glEndList(void) Parameters list mode Description Display lists are groups of GL commands that have been stored for subsequent execution. Display lists are created with glNewList. All subsequent commands are placed in the display list, in the order issued, until glEndList is called.
Page 293
Notes glCallList and glCallLists can be entered into display lists. Commands in the display list or lists executed by glCallList or glCallLists are not included in the display list being created, even if the list creation mode is GL_COMPILE_AND_EXECUTE. A display list is just a group of commands and arguments, so errors generated by commands in a display list must be generated when the list is executed.
glNextVisibilityTesthp glNextVisibilityTesthp glNextVisibilityTesthp - end the current visibility test and begin the next. C Specification void glNextVisibilityTesthp(void) Parameters None Description glNextVisibilityTesthp is used in conjunction with glVisibilityBufferhp to test the visibility of primitives against the current contents of the depth buffer. With glVisibilityBufferhp, the programmer specifies a boolean array in which to store the results of the visibility tests;...
gluNewNurbsRenderer gluNewNurbsRenderer gluNewNurbsRenderer: create a NURBS object. C Specification GLUnurbs* gluNewNurbsRenderer(void) Description gluNewNurbsRenderer creates and returns a pointer to a new NURBS object. This object must be referred to when calling NURBS rendering and control functions. A return value of 0 means that there is not enough memory to allocate the object. See Also gluBeginCurve, gluBeginSurface,...
gluNewQuadric gluNewQuadric gluNewQuadric: create a quadrics object. C Specification GLUquadric* gluNewQuadric(void) Description gluNewQuadric creates and returns a pointer to a new quadrics object. This object must be referred to when calling quadrics rendering and control functions. A return value of 0 means that there is not enough memory to allocate the object.
gluNewTess gluNewTess gluNewTess: create a tessellation object. C Specification GLUtesselator* gluNewTess(void) Description gluNewTess creates and returns a pointer to a new tessellation object. This object must be referred to when calling tessellation functions. A return value of 0 means that there is not enough memory to allocate the object.
gluNextContour gluNextContour gluNextContour: mark the beginning of another contour. C Specification void gluNextContour( GLUtesselator* tess, GLenum type) Parameters tess type Description gluNextContour is used in describing polygons with multiple contours. After the first contour has been described through a series of gluTessVertex calls, a gluNextContour call indicates that the previous contour is complete and that the next contour is about to begin.
Page 299
gluNextContour Before the first contour is described, gluNextContour can be called to define the type of the first contour. If gluNextContour is not called before the first contour, then the first contour is marked GLU_EXTERIOR. This command is obsolete and is provided for backward compatibility only. Calls to gluNextContour are mapped to gluTessEndContour followed by gluTessBeginContour.
glNormal glNormal glNormal3b, glNormal3d, glNormal3f, glNormal3i, glNormal3s, glNormal3bv, glNormal3dv, glNormal3fv, glNormal3iv, glNormal3sv: set the current normal vector. C Specification void glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz) void glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz) void glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz) void glNormal3i( GLint nx,...
Page 301
glNormal Description The current normal is set to the given coordinates whenever glNormal is issued. Byte, short, or integer arguments are converted to floating-point format with a linear mapping that maps the most positive representable integer value to 1.0, and the most negative representable integer value to - 1.0.
glNormalPointer glNormalPointer glNormalPointer: define an array of normals. C Specification void glNormalPointer( GLenum type, GLsizei stride, const GLvoid *pointer) Parameters type stride pointer Description glNormalPointer specifies the location and data format of an array of normals to use when rendering. type specifies the data type of the normal coordinates and stride gives the byte stride from one normal to the next, allowing vertexes and attributes to be packed into a single array or stored in separate arrays.
Page 303
glNormalPointer is typically implemented on the client side. Since the normal array parameters are client-side state, they are not saved or restored by glPushAttrib and glPopAttrib. Use glPushClientAttrib and glPopClientAttrib instead. Errors • GL_INVALID_ENUM is generated if type is not an accepted value. •...
gluNurbsCallback gluNurbsCallback gluNurbsCallback: define a callback for a NURBS object. C Specification void gluNurbsCallback( GLUnurbs* nurb, GLenum which, GLvoid (*CallBackFunc)() Parameters nurb which CallBackFunc Description gluNurbsCallback is used to define a callback to be used by a NURBS object. If the specified callback is already defined, then it is replaced.
gluNurbsCurve gluNurbsCurve: define the shape of a NURBS curve. C Specification void gluNurbsCurve( GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type) Parameters nurb knotCount knots stride control order type Description Use gluNurbsCurve to describe a NURBS curve. When gluNurbsCurve appears between a gluBeginCurve/gluEndCurve pair, it is used to describe a curve to be rendered.
Page 306
gluNurbsCurve When gluNurbsCurve appears between a gluBeginTrim/gluEndTrim pair, it is used to describe a trimming curve on a NURBS surface. If type is GLU_MAP1_TRIM_2, then it describes a curve in two-dimensional (u and v) parameter space. If it is GLU_MAP1_TRIM_3, then it describes a curve in two-dimensional homogeneous (u, v, and w) parameter space.
gluNurbsPrperty gluNurbsProperty: set a NURBS property. C Specification void gluNurbsProperty( GLUnurbs* nurb, GLenum property, GLfloat value) Parameters nurb property value Description gluNurbsProperty is used to control properties stored in a NURBS object. These properties affect the way that a NURBS curve is rendered. The accepted values for property are as follows: GLU_SAMPLING_METHOD Specifies how a NURBS surface should be tessellated.
Page 308
gluNurbsPrperty Specifies the maximum length, in pixels to use when the sampling method is set to GLU_PATH_LENGTH. The NURBS code is conservative when rendering a curve or surface, so the actual length can be somewhat shorter. The initial value is 50.0 pixels. GLU_PARAMETRIC_TOLERANCE Specifies the maximum distance, in pixels, to use when the sampling method is GLU_PARAMETRIC_ERROR.
Page 309
gluNurbsPrperty A property of GLU_PARAMETRIC_TOLERANCE, GLU_SAMPLING_METHOD, GLU_U_STEP, or GLU_V_STEP, or a value of GLU_PATH_LENGTH, GLU_PARAMETRIC_ERROR, GLU_DOMAIN_DISTANCE are only available if the GLU version is 1.1 or greater. They are not valid parameters in GLU 1.0. gluGetString can be used to determine the GLU version. See Also gluGetNurbsProperty, gluLoadSamplingMatrices,...
Page 311
gluNurbsSurface Description Use gluNurbsSurface within a NURBS (Non-Uniform Rational B-Spline) surface definition to describe the shape of a NURBS surface (before any trimming). To mark the beginning of a NURBS surface definition, use the gluBeginSurface command. To mark the end of a NURBS surface definition, use the gluEndSurface command. Call gluNurbsSurface within a NURBS surface definition only.
glOrtho glOrtho glOrtho: multiply the current matrix with an orthographic matrix. C Specification void glOrtho( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) Parameters left, right bottom, top zNear, zFar Description glOrtho describes a transformation that produces a parallel projection. The current matrix (see glMatrixMode) is multiplied by this matrix and the result replaces the current matrix, as if glMultMatrix were called with the following matrix as its argument:...
Page 315
Typically, the matrix mode is GL_PROJECTION, and (left, bottom, zNear) and (right, top, zNear) specify the points on the near clipping plane that are mapped to the lower left and upper right corners of the window, respectively, assuming that the eye is located at (0, 0, 0).
gluOrtho2D gluOrtho2D gluOrtho2D: define a 2D orthographic projection matrix. C Specification void gluOrtho2D( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top) Parameters left, right bottom, top Description gluOrtho2D sets up a two-dimensional orthographic viewing region. This is equivalent to calling glOrtho with near = 1 and far = 1. See Also glOrtho, gluPerspective...
gluPartialDisk gluPartialDisk gluPartialDisk: draw an arc of a disk. C Specification void gluPartialDisk( GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep) Parameters quad inner outer slices loops start sweep Description gluPartialDisk renders a partial disk on the Z = 0 plane. A partial disk is similar to a full disk, except that only the subset of the disk from start through start + sweep is included (where 0 degrees is along the +Y axis, 90 degrees along the +X axis, 180 along the Y axis, and 270 along the X axis).
Page 319
gluPartialDisk See Also gluCylinder, gluDisk, gluNewQuadric, gluQuadricOrientation, gluQuadricTexture, gluSphere Chapter 14...
glPassThrough glPassThrough glPassThrough: place a marker in the feedback buffer. C Specification void glPassThrough( GLfloat token) Parameters token Description Feedback is a GL render mode. The mode is selected by calling glRenderMode with GL_FEEDBACK. When the GL is in feedback mode, no pixels are produced by rasterization.
gluPerspective gluPerspective: set up a perspective projection matrix. C Specification void gluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) Parameters fovy aspect zNear zFar Description gluPerspective specifies a viewing frustum into the world coordinate system. In general, the aspect ratio in gluPerspective should match the aspect ratio of the associated viewport.
Page 322
gluPerspective Notes Depth buffer precision is affected by the values specified for zNear and zFar. The greater the ratio of zFar to zNear is, the less effective the depth buffer will be at distinguishing between surfaces that are near each other. If r = zFar / zNear, roughly log depth buffer precision are lost.
gluPickMatrix gluPickMatrix: define a picking region. C Specification void gluPickMatrix( GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport) Parameters x, y xdelX, delY viewport Description gluPickMatrix creates a projection matrix that can be used to restrict drawing to a small region of the viewport.
glPixelMap glPixelMap glPixelMapfv, glPixelMapuiv, glPixelMapusv: set up pixel transfer maps. C Specification void glPixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values) void glPixelMapuiv( GLenum map, GLsizei mapsize, const GLuint *values) void glPixelMapusv( GLenum map, GLsizei mapsize,const GLushort *values) Parameters mapsize values Description glPixelMap sets up translation tables, or maps, used by glCopyPixels,...
Page 325
glPixelMap GL_PIXEL_MAP_I_TO_R Maps color indices to red components. GL_PIXEL_MAP_I_TO_G Maps color indices to green components. GL_PIXEL_MAP_I_TO_B Maps color indices to blue components. GL_PIXEL_MAP_I_TO_A Maps color indices to alpha components. GL_PIXEL_MAP_R_TO_R Maps red components to red components. GL_PIXEL_MAP_G_TO_G Maps green components to green components. GL_PIXEL_MAP_B_TO_B Maps blue components to blue components.
Page 326
glPixelMap GL_PIXEL_MAP_I_TO_I GL_PIXEL_MAP_S_TO_S GL_PIXEL_MAP_I_TO_R GL_PIXEL_MAP_I_TO_G GL_PIXEL_MAP_I_TO_B GL_PIXEL_MAP_I_TO_A GL_PIXEL_MAP_R_TO_R GL_PIXEL_MAP_G_TO_G GL_PIXEL_MAP_B_TO_B GL_PIXEL_MAP_A_TO_A Errors • GL_INVALID_ENUM is generated if map is not an accepted value. • GL_INVALID_VALUE is generated if mapsize is less than one or larger than • GL_MAX_PIXEL_MAP_TABLE. GL_INVALID_VALUE is generated if map is GL_PIXEL_MAP_I_TO_I, GL_PIXEL_MAP_S_TO_S, GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, or GL_PIXEL_MAP_I_TO_A, and mapsize is not a power of two.
Page 327
glPixelMap glGet with argument GL_PIXEL_MAP_B_TO_B_SIZE glGet with argument GL_PIXEL_MAP_A_TO_A_SIZE glGet with argument GL_MAX_PIXEL_MAP_TABLE See Also glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glDrawPixels, glPixelStore, glPixelTransfer, glReadPixels, glTexImage1D, glTexImage2D, glTexSubImage1D, glTexSubImage2D Chapter 14...
glPixelStore glPixelStore glPixelStoref, glPixelStorei: set pixel storage modes. C Specification void glPixelStoref( GLenum pname, GLfloat param) void glPixelStorei( GLenum pname, GLint param) Parameters pname param Description glPixelStore sets pixel storage modes that affect the operation of subsequent glDrawPixels and glReadPixels as well as the unpacking of polygon stipple patterns (see glPolygonStipple), bitmaps (see glBitmap), and texture patterns (see glTexImage1D, glTexImage2D, glTexSubImage1D, and glTexSubImage2D).
Page 329
If true, bits are ordered within a byte from least significant to most significant; otherwise, the first bit in each byte is the most significant one. This parameter is significant for bitmap data only. GL_PACK_ROW_LENGTH If greater than 0, GL_PACK_ROW_LENGTH defines the number of pixels in a row. If the first pixel of a row is placed at location p in memory, then the location of the first pixel of the next row is obtained by skipping components or indices, where n is the number of components or indices in a pixel, l is...
Page 330
glPixelStore If true, byte ordering for multibyte color components, depth components, color indices, or stencil indices is reversed. That is, if a four-byte component consists of bytes b , it is taken from memory as b GL_UNPACK_SWAP_BYTES has no effect on the memory order of components within a pixel, only on the order of bytes within components or indices.
Page 331
equivalent to incrementing the pointer by jk components or indices, where k is the number of components or indices per row, as just computed in the GL_UNPACK_ROW_LENGTH section. GL_UNPACK_ALIGNMENT Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries).
Page 332
glPixelStore Errors • GL_INVALID_ENUM is generated if pname is not an accepted value. • GL_INVALID_VALUE is generated if a negative row length, pixel skip, or row skip value is specified, or if alignment is specified as other than 1, 2, 4, or 8. •...
glPixelTransfer glPixelTransferf, glPixelTransferi: set pixel transfer modes. C Specification void glPixelTransferf( GLenum pname, GLfloat param) void glPixelTransferi( GLenum pname, GLint param) Parameters pname param Description glPixelTransfer sets pixel transfer modes that affect the operation of subsequent glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glDrawPixels, glReadPixels, glTexImage1D, glTexImage2D, glTexSubImage1D, and glTexSubImage2D commands.
Page 334
glPixelTransfer Each of the four color components is multiplied by a scale factor, then added to a bias factor. That is, the red component is multiplied by GL_RED_SCALE, then added to GL_RED_BIAS; the green component is multiplied by GL_GREEN_SCALE, then added to GL_GREEN_BIAS;...
Page 335
Each index is shifted GL_INDEX_SHIFT bits just as a color index is, then added to GL_INDEX_OFFSET. If GL_MAP_STENCIL is true, each index is masked by 2 where n is GL_PIXEL_MAP_S_TO_S_SIZE, then replaced by the contents of GL_PIXEL_MAP_S_TO_S indexed by the masked value. The following table gives the type, initial value, and range of valid values for each of the pixel transfer parameters that are set with glPixelTransfer.
Page 336
glPixelTransfer Errors • GL_INVALID_ENUM is generated if pname is not an accepted value. • GL_INVALID_OPERATION is generated if glPixelTransfer is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_MAP_COLOR glGet with argument GL_MAP_STENCIL glGet with argument GL_INDEX_SHIFT glGet with argument GL_INDEX_OFFSET glGet with argument GL_RED_SCALE...
glPixelZoom glPixelZoom: specify the pixel zoom factors. C Specification void glPixelZoom( GLfloat xfactor, GLfloat yfactor) Parameters xfactor, yfactor Description glPixelZoom specifies values for the x and y zoom factors. During the execution of glDrawPixels or glCopyPixels, if (x element is in the mth row and nth column of the pixel rectangle, then pixels whose centers are in the rectangle with corners at + n ·xfactor, y + (n+1) ·xfactor, y...
glPointSize glPointSize glPointSize: specify the diameter of rasterized points. C Specification void glPointSize( GLfloat size) Parameters size Description glPointSize specifies the rasterized diameter of both aliased and anti-aliased points. Using a point size other than 1 has different effects, depending on whether point anti-aliasing is enabled.
Page 339
Notes The point size specified by glPointSize is always returned when GL_POINT_SIZE is queried. Clamping and rounding for aliased and anti-aliased points have no effect on the specified value. A non-anti-aliased point size may be clamped to an implementation-dependent maximum. Although this maximum cannot be queried, it must be no less than the maximum value for anti-aliased points, rounded to the nearest integer value.
glPolygonMode glPolygonMode glPolygonMode: select a polygon rasterization mode. C Specification void glPolygonMode( GLenum face, GLenum mode) Parameters face mode Description glPolygonMode controls the interpretation of polygons for rasterization. face describes which polygons mode applies to: front-facing polygons (GL_FRONT), back-facing polygons (GL_BACK), or both (GL_FRONT_AND_BACK). The polygon mode affects only the final rasterization of polygons.
Page 341
Examples To draw a surface with filled back-facing polygons and outlined front-facing polygons, call glPolygonMode(GL_FRONT, GL_LINE); Notes Vertices are marked as boundary or non-boundary with an edge flag. Edge flags are generated internally by the GL when it decomposes polygons; they can be set explicitly using glEdgeFlag.
glPolygonOffset glPolygonOffset glPolygonOffset: set the scale and bias used to calculate depth values. C Specification void glPolygonOffset( GLfloat factor, GLfloat units) Parameters factor units Description When GL_POLYGON_OFFSET is enabled, each fragment’s depth value will be offset after it is interpolated from the depth values of the appropriate vertices. The value of the offset is factor to the screen area of the polygon, and r is the smallest value that is guaranteed to produce a resolvable offset for a given implementation.
Page 343
glPolygonOffset See Also glDepthFunc, glDisable, glEnable, glGet, glIsEnabled, glLineWidth, glStencilOp, glTexEnv Chapter 14...
glPolygonStipple glPolygonStipple glPolygonStipple: set the polygon stippling pattern. C Specification void glPolygonStipple( const GLubyte *mask) Parameters mask Description Polygon stippling, like line stippling (see glLineStipple), masks out certain fragments produced by rasterization, creating a pattern. Stippling is independent of polygon anti-aliasing.
Page 345
glPolygonStipple See Also glDrawPixels, glLineStipple, glPixelStore, glPixelTransfer Chapter 14...
glPrioritizeTextures glPrioritizeTextures glPrioritizeTextures: set texture residence priority. C Specification void glPrioritizeTextures( GLsizei n, const GLuint *textures, const GLclampf *priorities) Parameters textures priorities Description glPrioritizeTextures assigns the n texture priorities given in priorities to the n textures named in textures. The GL establishes a “working set” of textures that are resident in texture memory. These textures may be bound to a texture target much more efficiently than textures that are not resident.
Page 347
Errors • GL_INVALID_VALUE is generated if n is negative. • GL_INVALID_OPERATION is generated if glPrioritizeTextures is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGetTexParameter with parameter name GL_TEXTURE_PRIORITY retrieves the priority of a currently bound texture. See Also glAreTexturesResident, glBindTexture,...
glPushAttrib glPushAttrib, glPopAttrib: push and pop the server attribute stack. C Specification void glPushAttrib( GLbitfield void glPopAttrib(void) Parameters mask Description glPushAttrib takes one argument, a mask that indicates which groups of state variables to save on the attribute stack. Symbolic constants are used to set bits in the mask. mask is typically constructed by ORing several of these constants together.
Page 350
glPushAttrib GL_CURRENT_BIT GL_DEPTH_BUFFER_BIT GL_ENABLE_BIT Current RGBA color Current color index Current normal vector Current texture coordinates Current raster position GL_CURRENT_RASTER_POSITION_VALID flag RGBA color associated with current raster position Color index associated with current raster position Texture coordinates associated with current raster position GL_EDGE_FLAG flag GL_DEPTH_TEST enable bit...
Page 351
GL_EVAL_BIT GL_FOG_BIT GL_HINT_BIT GL_LIGHTING_BIT GL_LINE_BIT GL_LIST_BIT Chapter 14 GL_MAP1_x enable bits, where x is a map type GL_MAP2_x enable bits, where x is a map type 1D grid endpoints and divisions 2D grid endpoints and divisions GL_AUTO_NORMAL enable bit GL_FOG enable bit Fog color Fog density Linear fog start...
Page 352
glPushAttrib GL_PIXEL_MODE_BIT GL_POINT_BIT GL_POLYGON_BIT GL_POLYGON_STIPPLE_BIT GL_SCISSOR_BIT GL_STENCIL_BUFFER_BIT GL_RED_BIAS and GL_RED_SCALE settings GL_GREEN_BIAS and GL_GREEN_SCALE values GL_BLUE_BIAS and GL_BLUE_SCALE GL_ALPHA_BIAS and GL_ALPHA_SCALE GL_DEPTH_BIAS and GL_DEPTH_SCALE GL_INDEX_OFFSET and GL_INDEX_SHIFT values GL_MAP_COLOR and GL_MAP_STENCIL flags GL_ZOOM_X and GL_ZOOM_Y factors GL_READ_BUFFER setting GL_POINT_SMOOTH flag Point size GL_CULL_FACE enable bit GL_CULL_FACE_MODE value...
Page 353
GL_TEXTURE_BIT GL_TRANSFORM_BIT GL_VIEWPORT_BIT glPopAttrib restores the values of the state variables saved with the last glPushAttrib command. Those not saved are left unchanged. It is an error to push attributes onto a full stack, or to pop attributes off an empty stack.
Page 354
glPushAttrib Associated Gets glGet with argument GL_ATTRIB_STACK_DEPTH glGet with argument GL_MAX_ATTRIB_STACK_DEPTH See Also glGet, glGetClipPlane, glGetError, glGetLight, glGetMap, glGetMaterial, glGetPixelMap, glGetPolygonStipple, glGetString, glGetTexEnv, glGetTexGen, glGetTexImage, glGetTexLevelParameter, glGetTexParameter, glIsEnabled, glPushClientAttrib Chapter 14...
glPushClientAttrib glPushClientAttrib, glPopClientAttrib: push and pop the client attribute stack. C Specification void glPushClientAttrib( GLbitfield mask) void glPopClientAttrib(void) Parameters mask Description glPushClientAttrib takes one argument, a mask that indicates which groups of client-state variables to save on the client attribute stack. Symbolic constants are used to set bits in the mask.
Page 356
glPushClientAttrib Errors • GL_STACK_OVERFLOW is generated if glPushClientAttrib is called while the attribute stack is full. • GL_STACK_UNDERFLOW is generated if glPopClientAttrib is called while the attribute stack is empty. Associated Gets glGet with argument GL_ATTRIB_STACK_DEPTH glGet with argument GL_MAX_CLIENT_ATTRIB_STACK_DEPTH See Also glColorPointer, glDisableClientState,...
glPushMatrix glPushMatrix, glPopMatrix: push and pop the current matrix stack. C Specification void glPushMatrix(void) void glPopMatrix(void) Description There is a stack of matrices for each of the matrix modes. In GL_MODELVIEW mode, the stack depth is at least 32. In the other two modes, GL_PROJECTION and GL_TEXTURE, the depth is at least 2.
Page 358
glPushMatrix See Also glFrustum, glLoadIdentity, glLoadMatrix, glMatrixMode, glMultMatrix, glOrtho, glRotate, glScale, glTranslate, glViewport Chapter 14...
glPushName glPushName, glPopName: push and pop the name stack. C Specification void glPushName( GLuint name) void glPopName(void) Parameters name Description The name stack is used during selection mode to allow sets of rendering commands to be uniquely identified. It consists of an ordered set of unsigned integers and is initially empty.
Page 360
glPushName See Also glInitNames, glLoadName, glRenderMode, glSelectBuffer Chapter 14...
gluPwlCurve gluPwlCurve: describe a piece-wise linear NURBS trimming curve. C Specification void gluPwlCurve( GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type) Parameters nurb count data stride type Description gluPwlCurve describes a piece-wise linear trimming curve for a NURBS surface. A piece-wise linear curve consists of a list of coordinates of points in the parameter space for the NURBS surface to be trimmed.
gluQuadricCallback gluQuadricCallback gluQuadricCallback: define a callback for a quadrics object. C Specification void gluQuadricCallback( GLUquadric* quad, GLenum which, GLvoid (*CallBackFunc)() Parameters quad which CallBackFunc Description gluQuadricCallback is used to define a new callback to be used by a quadrics object. If the specified callback is already defined, then it is replaced.
gluQuadricDrawStyle gluQuadricDrawStyle: specify the draw style desired for quadrics. C Specification void gluQuadricDrawStyle( GLUquadric* quad, GLenum draw) Parameters quad draw Description gluQuadricDrawStyle specifies the draw style for quadrics rendered with quad. The legal values are as follows: GLU_FILL Quadrics are rendered with polygon primitives. The polygons are drawn in a counterclockwise fashion with respect to their normals (as defined with gluQuadricOrientation).
gluQuadricNormals gluQuadricNormals gluQuadricNormals: specify what kind of normals are desired for quadrics. C Specification void gluQuadricNormals( GLUquadric* quad, GLenum normal) Parameters quad normal Description gluQuadricNormals specifies what kind of normals are desired for quadrics rendered with quad. The legal values are as follows: GLU_NONE No normals are generated.
gluQuadricOrientation gluQuadricOrientation: specify inside/outside orientation for quadrics. C Specification void gluQuadricOrientation( GLUquadric* quad, GLenum orientation) Parameters quad orientation Description gluQuadricOrientation specifies what kind of orientation is desired for quadrics rendered with quad. The orientation values are as follows: GLU_OUTSIDE Quadrics are drawn with normals pointing outward (the initial value). GLU_INSIDE Quadrics are drawn with normals pointing inward.
gluQuadricTexture gluQuadricTexture gluQuadricTexture: specify if texturing is desired for quadrics. C Specification void gluQuadricTexture( GLUquadric* quad, GLboolean texture) Parameters quad texture Description gluQuadricTexture specifies if texture coordinates should be generated for quadrics rendered with quad. If the value of texture is GL_TRUE, then texture coordinates are generated, and if texture is GL_FALSE, they are not.
glXQueryExtension glXQueryExtension: indicate whether the GLX extension is supported. C Specification Bool glXQueryExtension( Display *dpy, int *errorBase, int *eventBase) Parameters errorBase eventBase Description glXQueryExtension returns True if the X server of connection dpy supports the GLX extension, False otherwise. If True is returned, then errorBase and eventBase return the error base and event base of the GLX extension.
glXQueryExtensionsString glXQueryExtensionsString glXQueryExtensionsString: return list of supported extensions. C Specification constchar *glXQueryExtensionsString( Display *dpy, int screen) Parameters screen Description glXQueryExtensionsString returns a pointer to a string describing which GLX extensions are supported on the connection. The string is null-terminated and contains a space-separated list of extension names.
glXQueryServerString glXQueryServerString: return string describing the server. C Specification constchar *glXQueryServerString( Display *dpy, int screen, int name) Parameters screen name Description glXQueryServerString returns a pointer to a static, null-terminated string describing some aspect of the server’s GLX extension. The possible values for name and the format of the strings is the same as for glXGetClientString.
Page 376
glRasterPos glRasterPos3 specifies object coordinate x, y, and z explicitly, while w is implicitly set to 1. glRasterPos2 uses the argument values for x and y while implicitly setting z and w to 0 and 1. The object coordinates presented by glRasterPos are treated just like those of a glVertex command: They are transformed by the current modelview and projection matrices and passed to the clipping stage.
Page 377
glRasterPos glGet with argument GL_CURRENT_RASTER_COLOR glGet with argument GL_CURRENT_RASTER_INDEX glGet with argument GL_CURRENT_RASTER_TEXTURE_COORDS See Also glBitmap, glCopyPixels, glDrawElements, glDrawPixels, glLight, glLightModel, glShadeModel, glTexCoord, glTexGen, glVertex Chapter 16...
glReadBuffer glReadBuffer glReadBuffer: select a color buffer source for pixels. C Specification void glReadBuffer( GLenum mode) Parameters mode Description glReadBuffer specifies a color buffer as the source for subsequent glReadPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, and glCopyPixels commands. mode accepts one of twelve or more predefined values.
Page 379
glReadBuffer See Also glCopyPixels, glCopyTexImage1D, glCopyTexImage2D, glCopyTexSubImage1D, glCopyTexSubImage2D, glDrawBuffer, glReadPixels Chapter 16...
glReadPixels glReadPixels glReadPixels: read a block of pixels from the frame buffer. C Specification void glReadPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) Parameters x, y width, height format type pixels Description glReadPixels returns pixel data from the frame buffer, starting with the pixel whose lower left corner is at location (x, y), into client memory starting at location pixels.
Page 381
Color indices are read from the color buffer selected by glReadBuffer. Each index is converted to fixed point, shifted left or right depending on the value and sign of GL_INDEX_SHIFT, and added to GL_INDEX_OFFSET. If GL_MAP_COLOR is GL_TRUE, indices are replaced by their mappings in the table GL_PIXEL_MAP_I_TO_I.
Page 382
glReadPixels If format is GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA, GL_RGB, GL_RGBA, GL_LUMINANCE, or GL_LUMINANCE_ALPHA and type is not GL_FLOAT, each component is multiplied by the multiplier shown in the following table. If type is GL_FLOAT, then each component is passed as is (or converted to the client’s single-precision floating-point format if it is different from the one used by the GL).
Page 383
• GL_INVALID_OPERATION is generated if glReadPixels is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_INDEX_MODE See Also glCopyPixels, glDrawPixels, glPixelMap, glPixelStore, glPixelTransfer, glReadBuffer Chapter 16 glReadPixels...
Page 385
Description glRect supports efficient specification of rectangles as two corner points. Each rectangle command takes four arguments, organized either as two consecutive pairs of (x,y) coordinates, or as two pointers to arrays, each containing an (x, y) pair. The resulting rectangle is defined in the z = 0 plane.
glRenderMode glRenderMode glRenderMode: set rasterization mode. C Specification GLint glRenderMode( GLenum mode) Parameters mode Description glRenderMode sets the rasterization mode. It takes one argument, mode, which can assume one of three predefined values: GL_RENDER Render mode. Primitives are rasterized, producing pixel fragments, which are written into the frame buffer.
Page 387
Notes If an error is generated, glRenderMode returns 0 regardless of the current render mode. Errors • GL_INVALID_ENUM is generated if mode is not one of the three accepted values. • GL_INVALID_OPERATION is generated if glSelectBuffer is called while the render mode is GL_SELECT, or if glRenderMode is called with argument GL_SELECT before glSelectBuffer is called at least once.
glRotate glRotate glRotated, glRotatef: multiply the current matrix by a rotation matrix. C Specification void glRotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble z) void glRotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z) Parameters angle x, y, z Description glRotate produces a rotation of angle degrees around the vector (x, y, z).
Page 389
Errors • GL_INVALID_OPERATION is generated if glRotate is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_MATRIX_MODE glGet with argument GL_MODELVIEW_MATRIX glGet with argument GL_PROJECTION_MATRIX glGet with argument GL_TEXTURE_MATRIX See Also glMatrixMode, glMultMatrix, glPushMatrix,...
glScale glScale glScaled, glScalef: multiply the current matrix by a general scaling matrix. C Specification void glScaled( GLdouble x, GLdouble y, GLdouble z) void glScalef( GLfloat x, GLfloat y, GLfloat z) Parameters x, y, z Description glScale produces a nonuniform scaling along the x, y, and z axes. The three parameters indicate the desired scale factor along each of the three axes.
Page 393
glScale Associated Gets glGet with argument GL_MATRIX_MODE glGet with argument GL_MODELVIEW_MATRIX glGet with argument GL_PROJECTION_MATRIX glGet with argument GL_TEXTURE_MATRIX See Also glMatrixMode, glMultMatrix, glPushMatrix, glRotate, glTranslate Chapter 17...
gluScaleImage gluScaleImage gluScaleImage: scale an image to an arbitrary size. C Specification GLint gluScaleImage( GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut) Parameters format wIn, hIn typeIn dataIn wOut, hOut typeOut dataOut Description...
Page 395
A return value of 0 indicates success. Otherwise gluScaleImage returns a GLU error code that indicates what the problem is (see gluErrorString). See the glReadPixels reference page for a description of the acceptable values for format, typeIn, and typeOut. Errors •...
glScissor glScissor glScissor: define the scissor box. C Specification void glScissor( GLint x, GLint y, GLsizei width, GLsizei height) Parameters x, y width, height Description glScissor defines a rectangle, called the scissor box, in window coordinates. The first two arguments, x and y, specify the lower left corner of the box. width and height specify the width and height of the box.
Page 397
glScissor See Also glEnable, glViewport Chapter 17...
glSelectBuffer glSelectBuffer glSelectBuffer: establish a buffer for selection mode values. C Specification void glSelectBuffer( GLsizei size, GLuint *buffer) Parameters size buffer Description glSelectBuffer has two arguments: buffer is a pointer to an array of unsigned integers, and size indicates the size of the array. buffer returns values from the name stack (see glInitNames, glLoadName, glPushName) when the rendering mode is GL_SELECT (see glRenderMode).
Page 399
Notes The contents of buffer is undefined until glRenderModeis called with an argument other than GL_SELECT. glBegin/glEnd primitives and calls to glRasterPos can result in hits. Errors • GL_INVALID_VALUE is generated if size is negative. • GL_INVALID_OPERATION is generated if glSelectBuffer is called while the render mode is GL_SELECT, or if glRenderMode is called with argument GL_SELECT before glSelectBuffer is called at least once.
glShadeModel glShadeModel glShadeModel: select flat or smooth shading. C Specification void glShadeModel( GLenum mode) Parameters mode Description GL primitives can have either flat or smooth shading. Smooth shading, the default, causes the computed colors of vertices to be interpolated as the primitive is rasterized, typically assigning different colors to each resulting pixel fragment.
Page 401
Errors • GL_INVALID_ENUM is generated if mode is any value other than GL_FLAT or GL_SMOOTH. • GL_INVALID_OPERATION is generated if glShadeModel is executed between the execution of glBegin and the corresponding execution of glEnd. Associated Gets glGet with argument GL_SHADE_MODEL See Also glBegin, glColor,...
gluSphere gluSphere gluSphere: draw a sphere. C Specification void gluSphere( GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks) Parameters quad radius slices stacks Description gluSphere draws a sphere of the given radius centered around the origin. The sphere is subdivided around the Z axis into slices and along the Z axis into stacks (similar to lines of longitude and latitude).
glStencilFunc glStencilFunc: set function and reference value for stencil testing. C Specification void glStencilFunc( GLenum func, GLint ref, GLuint mask) Parameters func mask Description Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen.
Page 404
glStencilFunc The following values are accepted by func: GL_NEVER Always fails. GL_LESS Passes if (ref & mask) < (stencil & mask). GL_LEQUAL Passes if (ref & mask) (stencil & mask). GL_GREATER Passes if (ref & mask) > (stencil & mask). GL_GEQUAL Passes if (ref &...
glStencilMask glStencilMask: control the writing of individual bits in the stencil planes. C Specification void glStencilMask( GLuint mask) Parameters mask Description glStencilMask controls the writing of individual bits in the stencil planes. The least significant n bits of mask, where n is the number of bits in the stencil buffer, specify a mask.
glStencilOp glStencilOp glStencilOp: set stencil test actions. C Specification void glStencilOp( GLenum fail, GLenum zfail, GLenum zpass) Parameters fail zfail zpass Description Stenciling, like depth-buffering, enables and disables drawing on a per-pixel basis. You draw into the stencil planes using GL drawing primitives, then render geometry and images, using the stencil planes to mask out portions of the screen.
Page 407
GL_INCR Increments the current stencil buffer value. Clamps to the maximum representable unsigned value. GL_DECR Decrements the current stencil buffer value. Clamps to 0. GL_INVERT Bitwise inverts the current stencil buffer value. Stencil buffer values are treated as unsigned integers. When incremented and decremented, values are clamped to 0 and 2 querying GL_STENCIL_BITS.
glXSwapBuffers glXSwapBuffers glXSwapBuffers: make back buffer visible. C Specification void glXSwapBuffers( Display *dpy, GLXDrawable drawable) Parameters drawable Description glXSwapBuffers promotes the contents of the back buffer of drawable to become the contents of the front buffer of drawable. The contents of the back buffer then become undefined.
gluTessBeginContour gluTessBeginContour gluTessBeginContour, gluTessEndContour: delimit a contour description. C Specification void gluTessBeginContour( GLUtesselator* tess) void gluTessEndContour( GLUtesselator* tess) Parameters tess Description gluTessBeginContour and gluTessEndContour delimit the definition of a polygon contour. Within each gluTessBeginContour/gluTessEndContour pair, there can be zero or more calls to gluTessVertex.
gluTessBeginPolygon gluTessBeginPolygon: delimit a polygon description. C Specification void gluTessBeginPolygon( GLUtesselator* tess, GLvoid* data) Parameters tess data Description gluTessBeginPolygon and gluTessEndPolygon delimit the definition of a non-convex polygon. Within each gluTessBeginPolygon/gluTessEndPolygon pair, there must be one or more calls to gluTessBeginContour/gluTessEndContour. Within each contour, there are zero or more calls to gluTessVertex.
gluTessCallback gluTessCallback gluTessCallback: define a callback for a tessellation object. C Specification void gluTessCallback( GLUtesselator* tess, GLenum which, GLvoid (*CallBackFunc)() Parameters tess which CallBackFunc Description gluTessCallback is used to indicate a callback to be used by a tessellation object. If the specified callback is already defined, then it is replaced.
Page 413
The same as the GLU_TESS_BEGIN callback except that it takes an additional pointer argument. This pointer is identical to the opaque pointer provided when gluTessBeginPolygon was called. The function prototype for this callback is: void beginData(GLenum type, void *polygon_data); GLU_TESS_EDGE_FLAG The edge flag callback is similar to glEdgeFlag.
Page 414
gluTessCallback GLU_TESS_COMBINE The combine callback is called to create a new vertex when the tessellation detects an intersection, or wishes to merge features. The function takes four arguments: an array of three elements each of type GLdouble, an array of four pointers, an array of four elements each of type GLfloat, and a pointer to a pointer.
Page 415
gluTessCallback GLU_TESS_ERROR The error callback is called when an error is encountered. The one argument is of type GLenum; it indicates the specific error that occurred and will be set to one of GLU_TESS_MISSING_BEGIN_POLYGON, GLU_TESS_MISSING_END_POLYGON, GLU_TESS_MISSING_BEGIN_CONTOUR, GLU_TESS_MISSING_END_CONTOUR, GLU_TESS_COORD_TOO_LARGE, GLU_TESS_NEED_COMBINE_CALLBACK. Character strings describing these errors can be retrieved with the gluErrorString call. The function prototype for this callback is: void error(GLenum errno);...
gluTessEndPolygon gluTessEndPolygon gluTessEndPolygon: delimit a polygon description. C Specification void gluTessEndPolygon( GLUtesselator* tess) Parameters tess Description gluTessBeginPolygon and gluTessEndPolygon delimit the definition of a nonconvex polygon. Within each gluTessBeginPolygon/gluTessEndPolygon pair, there must be one or more calls to gluTessBeginContour/gluTessEndContour. Within each contour, there are zero or more calls to gluTessVertex.
gluTessNormal gluTessNormal: specify a normal for a polygon. C Specification void gluTessNormal( GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ) Parameters tess valueX valueY valueZ Description gluTessNormal describes a normal for a polygon that the program is defining. All input data will be projected onto a plane perpendicular to one of the three coordinate axes before tessellation and all output triangles will be oriented CCW with respect to the normal (CW orientation can be obtained by reversing the sign of the supplied normal).
gluTessProperty gluTessProperty gluTessProperty: set a tessellation object property. C Specification void gluTessProperty( GLUtesselator* tess, GLenum which, GLdouble data) Parameters tess which data Description gluTessProperty is used to control properties stored in a tessellation object. These properties affect the way that the polygons are interpreted and rendered. The legal values for which are as follows: GLU_TESS_WINDING_RULE Determines which parts of the polygon are on the “interior”.
Page 419
gluTessProperty Is a boolean value (“value” should be set to GL_TRUE or GL_FALSE). When set to GL_TRUE, a set of closed contours separating the polygon interior and exterior are returned instead of a tessellation. Exterior contours are oriented CCW with respect to the normal;...
gluTessVertex gluTessVertex gluTessVertex: specify a vertex on a polygon. C Specification void gluTessVertex( GLUtesselator* tess, GLdouble *location, GLvoid* data) Parameters tess location data Description gluTessVertex describes a vertex on a polygon that the program defines. Successive gluTessVertex calls describe a closed contour. For example, to describe a quadrilateral gluTessVertex should be called four times.
Page 421
gluTessVertex Two common symptoms of this problem are consists of a single point (when a local variable is used for data) and a GLU_TESS_NEED_COMBINE_CALLBACK error (when a local variable is used for location). See Also gluTessBeginPolygon, gluNewTess, gluTessBeginContour, gluTessCallback, gluTessProperty, gluTessNormal, gluTessEndPolygon Chapter 18...
Page 424
glTexCoord Parameters s, t, r, q Description glTexCoord specifies texture coordinates in one, two, three, or four dimensions. glTexCoord1 sets the current texture coordinates to (s, 0, 0, 1); a call to glTexCoord2 sets them to (s, t, 0, 1). Similarly, glTexCoord3 specifies the texture coordinates as (s, t, r, 1), and glTexCoord4 defines all four components explicitly as (s, t, r, q).
glTexCoordPointer glTexCoordPointer: define an array of texture coordinates. C Specification void glTexCoordPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) Parameters size type stride pointer Description glTexCoordPointer specifies the location and data format of an array of texture coordinates to use when rendering. size specifies the number of coordinates per element, and must be 1, 2, 3, or 4.
Page 426
glTexCoordPointer Notes glTexCoordPointer is available only if the GL version is 1.1 or greater. The texture coordinate array is initially disabled and it won’t be accessed when glArrayElement, glDrawElements or glDrawArrays is called. Execution of glTexCoordPointer is not allowed between the execution of glBegin and the corresponding execution of glEnd, but an error may or may not be generated.
Page 428
glTexEnv Description A texture environment specifies how texture values are interpreted when a fragment is textured. target must be GL_TEXTURE_ENV. pname can be either GL_TEXTURE_ENV_MODE, GL_TEXTURE_ENV_COLOR or GL_TEXTURE_LIGHTING_MODE_hp (if the extension GL_hp_texture_lighting is supported). If pname is GL_TEXTURE_ENV_MODE, then params is (or points to) the symbolic name of a texture function.
Page 429
Base Internal Format GL_RGB GL_RGBA If pname is GL_TEXTURE_ENV_COLOR, params is a pointer to an array that holds an RGBA color consisting of four values. Integer color components are interpreted linearly such that the most positive integer maps to 1.0, and the most negative integer maps to -1.0.
Page 432
glTexGen params Description glTexGen selects a texture-coordinate generation function or supplies coefficients for one of the functions. coord names one of the (s, t, r, q) texture coordinates; it must be one of the symbols GL_S, GL_T, GL_R, or GL_Q. pname must be one of three symbolic constants: GL_TEXTURE_GEN_MODE, GL_OBJECT_PLANE, or GL_EYE_PLANE.
Page 433
Finally, let m = 2 sqrt(f coordinates are s = f /m + 1/2 t = f /m + 1/2 To enable or disable a texture-coordinate generation function, call glEnable or glDisable with one of the symbolic texture-coordinate names (GL_TEXTURE_GEN_S, GL_TEXTURE_GEN_T, GL_TEXTURE_GEN_R, or GL_TEXTURE_GEN_Q) as the argument.
glTexImage1D glTexImage1D glTexImage1D: specify a one-dimensional texture image. C Specification void glTexImage1D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels) Parameters target level internalformat width border format Specifies the target texture. Must be GL_TEXTURE_1D or GL_PROXY_TEXTURE_1D.
Page 435
type pixels Description Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable one-dimensional texturing, call glEnable and glDisable with argument GL_TEXTURE_1D. Texture images are defined with glTexImage1D. The arguments describe the parameters of the texture image, such as width, width of the border, level-of-detail number (see glTexParameter), and the internal resolution and format used to store the image.
Page 436
glTexImage1D Each element is a single red component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for green and blue, and 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped to the range [0, 1] (see glPixelTransfer).
Page 437
If an application wants to store the texture at a certain resolution or in a certain format, it can request the resolution and format with internalformat. The GL will choose an internal representation that closely approximates that requested by internalformat, but it may not match exactly.
Page 438
glTexImage1D • GL_INVALID_VALUE may be generated if level is greater than log is the returned value of GL_MAX_TEXTURE_SIZE. • GL_INVALID_VALUE is generated if internalformat is not 1, 2, 3, 4, or one of the accepted resolution and format symbolic constants. •...
glTexImage2D glTexImage2D: specify a two-dimensional texture image. C Specification void glTexImage2D( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizeiheight, GLint border, GLenum format, GLenum type, const GLvoid *pixels) Parameters target level internalformat width height border Chapter 18 Specifies the target texture. Must be GL_TEXTURE_2D or GL_PROXY_TEXTURE_2D.
Page 440
glTexImage2D format type pixels Description Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable two-dimensional texturing, call glEnable and glDisable with argument GL_TEXTURE_2D. To define texture images, call glTexImage2D. The arguments describe the parameters of the texture image, such as height, width, width of the border, level-of-detail number (see glTexParameter), and number of color components provided.
Page 441
color components using the GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, and GL_PIXEL_MAP_I_TO_A tables, and clamped to the range [0,1]. GL_RED Each element is a single red component. The GL converts it to floating point and assembles it into an RGBA element by attaching 0 for green and blue, and 1 for alpha. Each component is then multiplied by the signed scale factor GL_c_SCALE, added to the signed bias GL_c_BIAS, and clamped to the range [0, 1] (see glPixelTransfer).
Page 442
glTexImage2D GL_DEPTH_COMPONENT Each element is a single depth component. It is converted to floating-point, then multiplied by the signed scale factor GL_DEPTH_SCALE, added to the signed bias GL_DEPTH_BIAS, and clamped to the range [0, 1] (see glPixelTransfer). Refer to the glDrawPixels reference page for a description of the acceptable values for the type parameter.
Page 443
• GL_INVALID_ENUM is generated if type is not a type constant. • GL_INVALID_ENUM is generated if type is GL_BITMAP and format is not GL_COLOR_INDEX. • GL_INVALID_VALUE is generated if level is less than 0. • GL_INVALID_VALUE may be generated if level is greater than log is the returned value of GL_MAX_TEXTURE_SIZE.
glTexImage3DEXT glTexImage3DEXT glTexImage3DEXT: Specify a three-dimensional texture image. C Specification void glTexImage3DEXT( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels) Parameters target level width height Specifies the target texture. Must be GL_TEXTURE_3D_EXT or GL_PROXY_TEXTURE_3D_EXT.
Page 445
depth border format type pixels Description Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. Three-dimensional texturing is enabled and disabled using glEnable and glDisable with argument GL_TEXTURE_3D_EXT. Texture images are defined with glTexImage3DEXT. The arguments describe the parameters of the texture image, such as height, width, depth, width of the border, level-of-detail number (see glTexParameter), and the internal resolution and format used to store the image.
Page 446
glTexImage3DEXT color components using the GL_PIXEL_MAP_I_TO_R, GL_PIXEL_MAP_I_TO_G, GL_PIXEL_MAP_I_TO_B, and GL_PIXEL_MAP_I_TO_A tables, and clamped to the range [0, 1]. GL_RED Each element is a single red component. It is converted to floating-point and assembled into an RGBA element by attaching 0.0 for green and blue, and 1.0 for alpha. GL_GREEN Each element is a single green component.
Page 447
A one-component texture image uses only the red component of the RGBA color extracted from pixels. A two-component image uses the R and A values. A three-component image uses the R, G, and B values. A four-component image uses all of the RGBA components.
Page 450
glTexParameter Description Texture mapping is a technique that applies an image onto an object’s surface as if the image were a decal or cellophane shrink-wrap. The image is created in texture space, with an (s, t) coordinate system. A texture is a one- or two-dimensional image and a set of parameters that determine how samples are derived from the image.
Page 451
glTexParameter Chooses the two mipmaps that most closely match the size of the pixel being textured and uses the GL_NEAREST criterion (the texture element nearest to the center of the pixel) to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.
Page 452
glTexParameter Sets the wrap parameter for texture coordinate t to GL_CLAMP, GL_REPEAT, GL_CLAMP_TO_BORDER_EXT, or GL_CLAMP_TO_EDGE_EXT. See the discussion under GL_TEXTURE_WRAP_S. Initially, GL_TEXTURE_WRAP_T is set to GL_REPEAT. GL_TEXTURE_WRAP_R_EXT Sets the wrap parameter for texture coordinate r to GL_CLAMP, GL_REPEAT, GL_CLAMP_TO_BORDER_EXT, or GL_CLAMP_TO_EDGE_EXT. See the discussion under GL_TEXTURE_WRAP_S.
Page 453
Notes Suppose that a program has enabled texturing (by calling glEnable with argument GL_TEXTURE_1D or GL_TEXTURE_2D) and has set GL_TEXTURE_MIN_FILTER to one of the functions that requires a mipmap. If either the dimensions of the texture images currently defined (with previous calls to glTexImage1D, glTexImage2D, glCopyTexImage1D, or glCopyTexImage2D) do not follow the proper sequence for mipmaps (described above), or there are fewer texture images defined than are needed, or the set of texture images have differing numbers of texture components, then it is as if...
glTexSubImage1D glTexSubImage1D: specify a two-dimensional texture sub-image. C Specification void glTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels) Parameters target level xoffset width format type pixels Description Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled.
Page 456
glTexSubImage1D Notes glTexSubImage1D is available only if the GL version is 1.1 or greater. Texturing has no effect in color index mode. The format GL_DEPTH_COMPONENT may only be used if the GL_EXT_shadow extension is supported. glPixelStore and glPixelTransfer modes affect texture images in exactly the way they affect glDrawPixels.
glTexSubImage2D glTexSubImage2D glTexSubImage2D: specify a two-dimensional texture sub-image. C Specification void glTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) Parameters target level xoffset yoffset width height format type pixels Description Texturing maps a portion of a specified texture image onto each graphical primitive for...
Page 459
yoffset + height - 1, inclusive. This region may not include any texels outside the range of the texture array as it was originally specified. It is not an error to specify a subtexture with zero width or height, but such a specification has no effect. Notes glTexSubImage2D is available only if the GL version is 1.1 or greater.
Page 462
glTexSubImage3DEXT Description Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. Three-dimensional texturing is enabled and disabled using glEnable and glDisable with argument GL_TEXTURE_3D_EXT. glTexSubImage3DEXT redefines a contiguous subregion of an existing three-dimensional texture image.
Page 463
glTexSubImage3DEXT See Also glDrawPixels, glFog, glPixelStore, glPixelTransfer, glTexEnv, glTexGen, glTexImage3D, glTexParameter. Chapter 18...
glTranslate glTranslate glTranslated, glTranslatef: multiply the current matrix by a translation matrix. C Specification void glTranslated( GLdouble x, GLdouble y, GLdouble z) void glTranslatef( GLfloat x, GLfloat y, GLfloat z) Parameters x, y, z Description glTranslate produces a translation by (x, y, z ). The current matrix (see glMatrixMode) is multiplied by this translation matrix, with the product replacing the current matrix, as if glMultMatrix were called with the following matrix for its argument: 1 0 0 x...
Page 465
glTranslate See Also glMatrixMode, glMultMatrix, glPushMatrix, glScale Chapter 18...
glXUseXFont glXUseXFont glXUseXFont: create bitmap display lists from an X font. C Specification void glXUseXFont( Font font, int first, int count, int listBase) Parameters font first count listBase Description glXUseXFont generates count display lists, named listBase through listBase + count - 1, each containing a single glBitmap command.
Page 471
glXUseXFont See Also glBitmap, glXMakeCurrent Chapter 19...
glVertexPointer glVertexPointer: define an array of vertex data. C Specification void glVertexPointer( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) Parameters size type stride pointer Description glVertexPointer specifies the location and data format of an array of vertex coordinates to use when rendering.
Page 478
glVertexPointer Execution of glVertexPointer is not allowed between the execution of glBegin and the corresponding execution of glEnd, but an error may or may not be generated. If no error is generated, the operation is undefined. glVertexPointer is typically implemented on the client side. Vertex array parameters are client-side state and are therefore not saved or restored by glPushAttrib and glPopAttrib.
glViewport glViewport: set the viewport. C Specification void glViewport( GLint x, GLint y, GLsizei width, GLsizei height) Parameters x, y width, height Description glViewport specifies the affine transformation of x and y from normalized device coordinates to window coordinates. Let (x the window coordinates (x = (x + 1) ·...
glVisibilityBufferhp glVisibilityBufferhp glVisibilityBufferhp - establish a buffer for Visibility Test results C Specification void glVisibilityBufferhp(GLSizei size, GLboolean *buffer, GLboolean wait_on_get) Parameters size buffer wait_on_get Description glVisibilityBuffer has three arguments: ’buffer’ is a pointer to an array of Boolean, and ’size’ indicates the size of the array. ’buffer’ returns values of GL_TRUE or GL_FALSE for each Visibility Test issued.
Page 481
Visibility Tests can be used by a programmer to determine whether or not a primitive or set of primitives are visible against the current contents of the depth buffer; “Visibile” in this context means that at least one pixel passes the depth test. This differs from previous Occlusion Culling extensions by allowing the programmer to provide memory for many different Visibility Test results to be returned at the same time.
glXWaitGL glXWaitGL glXWaitGL: complete GL execution prior to subsequent X calls. C Specification void glXWaitGL(void) Description GL rendering calls made prior to glXWaitGL are guaranteed to be executed before X rendering calls made after glXWaitGL. Although this same result can be achieved using glFinish, glXWaitGL does not require a round trip to the server, and it is therefore more efficient in cases where client and server are on separate machines.
glXWaitX glXWaitX: complete X execution prior to subsequent GL calls. C Specification void glXWaitX(void) Description X rendering calls made prior to glXWaitX are guaranteed to be executed before GL rendering calls made after glXWaitX. Although the same result can be achieved using XSync, glXWaitX does not require a round trip to the server, and it is therefore more efficient in cases where client and server are on separate machines.