Hp HP-UX 11.x OpenGL 1.1 Reference

OpenGL 1.1 Reference

for HP-UX 11.x

Manufacturing Part Number: B2355-IE001

Edition E0302

© Copyright 2002 by Hewlett-Packard

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. No part of this document may be photocopied, reproduced or translated to another language without the prior written consent of Hewlett-Packard Company.

Restricted Rights Legend

Use, duplication, or disclosure by the U.S. Government Department of Defense is subject to restrictions as set forth in paragraph (b)(3)(ii) of the Rights in Technical Data and Software clause in DFARS
252.227.7013. This document contains proprietary information that is protected by copyright.
All rights arereserved.No part of this document may be photocopied, reproduced or translated to another language without the prior written consent of Hewlett-Packard Company.
UNIX is a registered trademark in the United States of America and other countries, licensed exclusively through X/Open Company Limited.
This software and documentation is based in part on the Fourth Berkeley Software Distribution under license from the Regents of the University of California.
© Copyright 2002 Hewlett-Packard Company. All Rights Reserved. © Copyright 1980, 1984 AT&T, Inc.

© Copyright 1979, 1980, 1983 The Regents of the University of California.

2
Contents
glAccum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
glAlphaFunc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
glAreaTexturesResident . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
glArrayElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
glBegin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
gluBeginCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
gluBeginPolygon. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
gluBeginSurface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
gluBeginTrim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
glBindTexture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
glBitMap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
glBlendColorEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
glBlendFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
gluBuild1DMipmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
gluBuild2DMipmaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
glCallList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
glCallLists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
glXChooseVisual. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
glClear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
glClearAccum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
glClearColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
glClearDepth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .54
glClearindex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55
glClearStencil. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56
glClipPlane. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
glColor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
glColorMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
glColorMaterial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
glColorPointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66
glXCopyContext . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
glCopyPixels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70
glCopyTexImage1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
glCopyTexImage2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
glCopyTexSubImage1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
glCopyTexSubImage2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
glCopyTexSubImage3DEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
glXCreateContext. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
glXCreateGLXPixmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3
Contents
glCullFace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
gluCylinder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
glDeleteLists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
gluDeleteNurbsRenderer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
gluDeleteQuadric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
gluDeleteTess. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97
glDeleteTextures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
glDepthFunc. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
glDepthMask . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
glDepthRange. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
glXDestroyContext. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
glXDestroyGLXPixmap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
glDisable. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
gluDisk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
glDrawArrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
glDrawArraysSethp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
glDrawBuffer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
glDrawElements. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
glDrawPixels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
glEdgeFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
glEdgeFlagPointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
glEnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
glEnableClientState. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
glErrorString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
glEvalCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
glEvalMesh. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
glEvalPoint. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
glFeedbackBuffer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
glFinish. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
glFlush . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
glFog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
glFrontFace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
glFrustum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
glGenLists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
glGenTextures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
glGet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
4
Contents
glXGetClientString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
glXGetClipPlane. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
glXGetConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
glXGetCurrentContext. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
glXGetCurrentDisplay. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
glXGetCurrentDrawable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
glGetError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
glGetLight. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
glGetMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
glGetMaterial. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
gluGetNurbsProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
glGetPixelMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
glGetPointer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
glGetPolygonStipple. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
glGetString. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
gluGetString. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
gluGetTessProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
glGetTexEnv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
glGetTexGen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
glGetTexImage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
glGetTexLevelParameter. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
glGetTexParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
glHint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
glIndex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
glIndexMask. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
glIndexPointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
glInitNames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
glInterleavedArrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
glXIntro. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
glXIsDirect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
glIsEnabled. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
glIsList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
glIsTexture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
glLight. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
glLightModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
glLineStipple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
glLineWidth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
glListBase. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5
Contents
glLoadIdentity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
glLoadMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
glLoadName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
gluLoadSamplingMatrices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
glLogicOp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
gluLookAt. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
glXMakeCurrent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
glMap1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
glMap2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
glMapGrid. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
glMaterials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
glMatrixMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
glMultMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
glNewList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
glNextVisibilityTesthp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
gluNewNurbsRenderer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
gluNewQuadric . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
gluNewTess. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
gluNextContour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
glNormal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
glNormalPointer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
gluNurbsCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
gluNurbsCurve. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
gluNurbsPrperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
gluNurbsSurface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
glOrtho . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
gluOrtho2D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
gluPartialDisk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
glPassThrough . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
gluPerspective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
gluPickMatrix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
glPixelMap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
glPixelStore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
glPixelTransfer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
glPixelZoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
glPointSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
6
Contents
glPolygonMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340
glPolygonOffset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
glPolygonStipple. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
glPrioritizeTextures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
gluProject . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
glPushAttrib. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
glPushClientAttrib. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
glPushMatrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
glPushName. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
gluPwlCurve. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
gluQuadricCallback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
gluQuadricDrawStyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
gluQuadricNormals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
gluQuadricOrientation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
gluQuadricTexture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
glXQueryExtension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
glXQueryExtensionsString . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
glXQueryServerString. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
glXQueryVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
glRasterPos. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
glReadBuffer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
glReadPixels. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
glRect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
glRenderMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
glRotate. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
glScale. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
gluScaleImage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
glScissor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
glSelectBuffer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
glShadeModel. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
gluSphere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
glStencilFunc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
glStencilMask. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
glStencilOp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
glXSwapBuffers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
gluTessBeginContour. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
gluTessBeginPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
gluTessCallback. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
7
Contents
gluTessEndPolygon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
gluTessNormal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
gluTessProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
gluTessVertex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
glTexCoord . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
glTexCoordPointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
glTexEnv. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
glTexGen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
glTexImage1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
glTexImage2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
glTexImage3DEXT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
glTexParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
glTexSubImage1D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
glTexSubImage2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 458
glTexSubImage3DEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
glTranslate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464
gluUnProject. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
glXUseXFont. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
glVertex. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
glVertexPointer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
glViewport . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
glVisibilityBufferhp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
glXWaitGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
glXWaitX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
8
1A
Chapter 1
9
A

glAccum

glAccum
glAccum: operate on the accumulation buffer.
C Specification
void glAccum(
GLenum op, GLfloat value)

Parameters

op Specifies the accumulation buffer operation. Symbolic constants
GL_ACCUM, GL_LOAD, GL_ADD, GL_MULT, and GL_RETURN are accepted.
value Specifies a floating-point value used in the accumulation buffer
operation. op determines how value is used.

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. Effects such as anti-aliasing (of points, lines, and polygons), motion blur, and depth of field can be created by accumulating images generated with different transformation matrices.
Each pixel in the accumulation buffer consists of red, green, blue, and alpha values. The number of bits per component in the accumulation buffer depends on the implementation. You can examine this number by calling glGetIntegerv four times, with arguments:
GL_ACCUM_RED_BITS, GL_ACCUM_GREEN_BITS, GL_ACCUM_BLUE_BITS, and GL_ACCUM_ALPHA_BITS.
Regardless of the number of bits per component, the range of values stored by each component is [- 1, 1]. The accumulation buffer pixels are mapped one-to-one with frame buffer pixels.
glAccum operates on the accumulation buffer. The first argument, op, is a symbolic constant that selects an accumulation buffer operation. The second argument, value,isa floating-point value to be used in that operation. Five operations are specified: GL_ACCUM, GL_LOAD, GL_ADD, GL_MULT, and GL_RETURN.
10
All accumulation buffer operations are limited to the area of the current scissor box and applied identically to the red, green, blue, and alpha components of each pixel. If a glAccum operation results in a value outside the range [- 1, 1], the contents of an accumulation buffer pixel component are undefined.
The operations are as follows: GL_ACCUM Obtains R, G, B, and A values from the buffer currently selected for
reading (see glReadBuffer).
Chapter 1
glAccum
Each component value is divided by 2n -1, where n is the number of bits allocated to each color component in the currently selected buffer. The result is a floating-point value in the range [0, 1], which is multiplied by value and added to the corresponding pixel component in the accumulation buffer, thereby updating the accumulation buffer.
GL_LOAD Similar to GL_ACCUM, except that the current value in the
accumulation buffer is not used in the calculation of the new value. That is, the R, G,B, and A values from the currently selected buffer are
divided by 2n - 1, multiplied by value, and then stored in the
corresponding accumulation buffer cell, overwriting the current value. GL_ADD Adds value to each R, G, B, and A in the accumulation buffer. GL_MULT Multiplies each R, G,B, and A in the accumulation buffer by value and
returns the scaled component to its corresponding accumulation buffer
location. GL_RETURN Transfers accumulation buffer values to the color buffer or buffers
currently selected for writing. Each R, G, B, and A component is
multiplied by value, then multiplied by 2n- 1, clamped to the range [0,
2n - 1], and stored in the corresponding display buffer cell. The only
fragment operations that are applied to this transfer are pixel
ownership, scissor, dithering, and color writemasks.
A
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

GL_INVALID_ENUM is generated if op is not an accepted value.
GL_INVALID_OPERATION is generated if there is no accumulation buffer.
GL_INVALID_OPERATION is generated if glAccum is executed between the
execution of glBegin and the corresponding execution of glEnd.

Associated Gets

glGet with argument GL_ACCUM_RED_BITS glGet with argument GL_ACCUM_GREEN_BITS glGet with argument GL_ACCUM_BLUE_BITS
glGet with argument GL_ACCUM_ALPHA_BITS

See Also

Chapter 1
glBlendFunc, glClear, glClearAccum, glCopyPixels, glGet,
11
A
glAccum
glLogicOp, glPixelStore, glPixelTransfer, glReadBuffer, glReadPixels, glScissor, glStencilOp
12
Chapter 1

glAlphaFunc

glAlphaFunc
glAlphaFunc: specify the alpha test function.
C Specification
void glAlphaFunc(
GLenum func, GLclampf ref)

Parameters

func Specifies the alpha comparison function. Symbolic constants
GL_NEVER, GL_LESS, GL_EQUAL, GL_LEQUAL, GL_GREATER,
GL_NOTEQUAL, GL_GEQUAL, and GL_ALWAYS are accepted. The
initial value is GL_ALWAYS. ref Specifies the reference value that incoming alpha values are compared
to. This value is clamped to the range 0 through 1, where 0 represents
the lowest possible alpha value and 1 the highest possible value. The
initial reference value is 0.
A

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. The comparison is performed only if alpha testing is enabled. By default, it is not enabled. (See glEnable and glDisable of GL_ALPHA_TEST.)
func and ref specify the conditions under which the pixel is drawn. The incoming alpha value is compared to ref using the function specified by func. If the value passes the comparison, the incoming fragment is drawn if it also passes subsequent stencil and depth buffer tests. If the value fails the comparison, no change is made to the frame buffer at that pixel location. The comparison functions are as follows:
GL_NEVER Never passes. GL_LESS Passes if the incoming alpha value is less than the reference value. GL_EQUAL Passes if the incoming alpha value is equal to the reference value. GL_LEQUAL Passesif the incoming alpha value is less than or equal to the reference
value. GL_GREATER Passes if the incoming alpha value is greater than the reference value. GL_NOTEQUAL Passes if the incoming alpha value is not equal to the reference value. GL_GEQUAL Passes if the incoming alpha value is greater than or equal to the
reference value.
Chapter 1
GL_ALWAYS Always passes (initial value).
13
A
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

GL_INVALID_ENUM is generated if func is not an accepted value.
GL_INVALID_OPERATION is generated if glAlphaFunc is executed between the
execution of glBegin and the corresponding execution of glEnd.

Associated Gets

glGet with argument GL_ALPHA_TEST_FUNC glGet with argument GL_ALPHA_TEST_REF
glIsEnabled with argument GL_ALPHA_TEST

See Also

glBlendFunc, glClear, glDepthFunc, glEnable, glStencilFunc
14
Chapter 1

glAreaTexturesResident

glAreaTexturesResident
glAreaTexturesResident: determine if textures are loaded in texture memory.
C Specification
GLboolean glAreTexturesResident(
GLsizei n, const GLuint *textures,
GLboolean *residences)

Parameters

n Specifies the number of textures to be queried. textures Specifies an array containing the names of the textures to be queried. residences Specifies an array in which the texture residence status is returned.
The residence status of a texture named by an element of textures is
returned in the corresponding element of residences.
A

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.
glAreTexturesResident queries the texture residence status of the n textures named by the elements of textures. If all the named textures are resident, glAreTexturesResident returns GL_TRUE, and the contents of residences are undisturbed. If not all the named textures are resident, glAreTexturesResident returns GL_FALSE, and detailed status is returned in the n elements of residences. If an element of residences is GL_TRUE, then the texture named by the corresponding element of textures is resident.
The residence status of a single bound texture may also be queried by calling glGetTexParameter with the target argument set to the target to which the texture is bound, and the p_name argument set to GL_TEXTURE_RESIDENT. This is the only
way that the residence status of a default texture can be queried.

Notes

glAreTexturesResident is available only if the GL version is 1.1 or greater. glAreTexturesResident returns the residency status of the textures at the time of
invocation. It does not guarantee that the textures will remain resident at any other time.
If textures reside in virtual memory (there is no texture memory), they are considered always resident.
Chapter 1
Some implementations may not load a texture until the first use of that texture.
15
A
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
GL_INVALID_OPERATION is generated if glAreTexturesResident is executed

Associated Gets

glGetTexParameter with parameter name GL_TEXTURE_RESIDENT retrieves the residence status of a currently bound texture.

See Also

glBindTexture, glGetTexParameter, glPrioritizeTextures, glTexImage1D, glTexImage2D,
glTexParameter
texture. In that case, the function returns GL_FALSE and the contents of residences is indeterminate.
between the execution of glBegin and the corresponding execution of glEnd.
16
Chapter 1

glArrayElement

glArrayElement
glArrayElement: render a vertex using the specified vertex array element.
C Specification
void glArrayElement(
GLint i)

Parameters

i 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. If GL_VERTEX_ARRAY is enabled when glArrayElement is called, a single vertex is drawn, using vertex and attribute data taken from location i of the enabled arrays. If GL_VERTEX_ARRAY is not enabled, no drawing occurs but the attributes corresponding to the enabled arrays are modified.
A
Use glArrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because each call specifies only a single vertex, it is possible to explicitly specify per-primitive attributes such as a single normal per individual triangle.
Changes made to array data between the execution of glBegin and the corresponding execution of glEnd may affect calls to glArrayElement that are made within the same glBegin/glEnd period in non-sequential ways. That is, a call to glArrayElement that precedes a change to array data may access the changed data, and a call that follows a
change to array data may access original data.

Notes

glArrayElement is available only if the GL version is 1.1 or greater. glArrayElement is included in display lists. If glArrayElement 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.

See Also

glColorPointer, glDrawArrays, glEdgeFlagPointer, glGetPointer, glIndexPointer, glInterleavedArrays,
Chapter 1
17
A
glArrayElement
glNormalPointer, glTexCoordPointer,
glVertexPointer
18
Chapter 1
2B
Chapter 2
19
B

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 Specifies the primitive or primitives that will be created from vertices
presented between glBegin and the subsequent glEnd. Ten symbolic
constants are accepted:
GL_POINTS, GL_LINES, GL_LINE_STRIP, GL_LINE_LOOP,
GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN,
GL_QUADS, GL_QUAD_STRIP, and GL_POLYGON.

Description

glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives. glBegin accepts a single argument that specifies in which of ten ways the vertices are interpreted. Taking n as an integer count starting at one, and n as the total number of vertices specified, the interpretations are as follows:
GL_POINTS Treats each vertex as a single point. Vertex n defines point n. n points
are drawn. GL_LINES Treats each pair of vertices as an independent line segment. Vertices
2n - 1 and 2n define line n. n/2 lines are drawn. GL_LINE_STRIP
Draws a connected group of line segments from the first vertex to the
last. n - 1 lines are drawn. GL_LINE_LOOP
Draws a connected group of line segments from the first vertex to the
last, then back to the first. Vertices n and n+1 define line n. The last
line, however, is defined by vertices n and 1. n lines are drawn. GL_TRIANGLES
Treats each triplet of vertices as an independent triangle. Vertices 3n-
2, 3n - 1, and 3n define triangle n. n/3 triangles are drawn. GL_TRIANGLE_STRIP
Draws a connected group of triangles. One triangle is defined for each
vertex presented after the first two vertices. For odd n, vertices n, n+1,
and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define
triangle n. n2 triangles are drawn.
20
Chapter 2
glBegin
GL_TRIANGLE_FAN
Draws a connected group of triangles. One triangle is defined for each
vertex presented after the first two vertices. Vertices 1, n+1, and n+2
define triangle n. n - 2 triangles are drawn. GL_QUADS
Treats each group of four vertices as an independent quadrilateral.
Vertices 4n - 3, 4n - 2, 4n - 1, and 4n define quadrilateral n. n/4
quadrilaterals are drawn. GL_QUAD_STRIP
Draws a connected group of quadrilaterals. One quadrilateral is
defined for each pair of vertices presented after the first pair. Vertices
2n -1, 2n, 2n+2, and 2n+1 define quadrilateral n. n/21 quadrilaterals
are drawn. Note that the order in which vertices are used to construct
a quadrilateral from strip data is different from that used with
independent data. GL_POLYGON
Draws a single, convex polygon. Vertices 1 through n define this
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.
B
Regardless of the value chosen for mode, there is no limit to the number of vertices that can be defined between glBegin and glEnd. Lines,triangles, quadrilaterals, and polygons that are incompletely specified are not drawn. Incomplete specification results when either too few vertices are provided to specify even a single primitive or when an incorrect multiple of vertices is specified. The incomplete primitive is ignored; the rest are drawn.
The minimum specification of vertices for each primitive is as follows: 1 for a point, 2 for a line, 3 for a triangle, 4 for a quadrilateral, and 3 for a polygon. Modes that require a certain multiple of vertices are GL_LINES (2), GL_TRIANGLES (3), GL_QUADS (4), and GL_QUAD_STRIP (2).

Errors

GL_INVALID_ENUM is generated if mode is set to an unaccepted value.
GL_INVALID_OPERATION is generated if glBegin is executed between a glBegin
and the corresponding execution of glEnd.
GL_INVALID_OPERATION is generated if glEnd is executed without being
preceded by a glBegin.
GL_INVALID_OPERATION is generated if a command other than glVertex, glColor,
glIndex, glNormal, glTexCoord, glEvalCoord, glEvalPoint, glArrayElement, glMaterial, glEdgeFlag, glCallList, or glCallLists is executed between the execution of glBegin and the corresponding execution glEnd.
Chapter 2
21
B
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, glColor, glEdgeFlag, glEvalCoord, glEvalPoint, glIndex, glMaterial, glNormal, glTexCoord,
glVertex
22
Chapter 2

gluBeginCurve

gluBeginCurve
gluBeginCurve, gluEndCurve: delimit a NURBS curve definition.
C Specification
void gluBeginCurve(
GLUnurbs* nurb)
void gluEndCurve(
GLUnurbs* nurb)

Parameters

nurb Specifies the NURBS object (created with gluNewNurbsRenderer).

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. Exactly one of the calls to gluNurbsCurve must have a curve type of GL_MAP1_VERTEX_3 or GL_MAP1_VERTEX_4. To mark the end of the NURBS curve definition, call gluEndCurve.
B
GL evaluators are used to render the NURBS curve as a series of line segments. Evaluator state is preserved during rendering with glPushAttrib(GL_EVAL_BIT) and glPopAttrib().See the glPushAttrib reference page for details on exactly what state these
calls preserve.

See Also

gluBeginSurface, gluBeginTrim, gluNewNurbsRenderer, gluNurbsCurve, glPopAttrib,
glPushAttrib
Chapter 2
23
B

gluBeginPolygon

gluBeginPolygon
gluBeginPolygon, gluEndPolygon: delimit a polygon description.
C Specification
void gluBeginPolygon(
GLUtesselator* tess)
void gluEndPolygon(
GLUtesselator* tess)

Parameters

tess Specifies the tessellation object (created with gluNewTess).

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. Finally, call gluEndPolygon to signal the end of the definition. See the gluTessVertex and gluNextContour reference pages for more details.
Once gluEndPolygon is called, the polygon is tessellated, and the resulting triangles are described through callbacks. See gluTessCallback for descriptions of the callback
functions.

Notes

This command is obsolete and is provided for backward compatibility only. Calls to gluBeginPolygon are mapped to gluTessBeginPolygon followed by gluTessBeginContour. Calls to gluEndPolygon are mapped to gluTessEndContour followed by
gluTessEndPolygon.

See Also

gluNewTess, gluNextContour, gluTessCallback, gluTessVertex, gluTessBeginPolygon,
gluTessBeginContour
24
Chapter 2

gluBeginSurface

gluBeginSurface
gluBeginSurface, gluEndSurface: delimit a NURBS surface definition.
C Specification
void gluBeginSurface(
GLUnurbs* nurb)
void gluEndSurface(
GLUnurbs* nurb)

Parameters

nurb Specifies the NURBS object (created with gluNewNurbsRenderer).

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. Exactly one of these calls to gluNurbsSurface must have a surface type of GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4. To mark the end of the NURBS surface definition, call gluEndSurface.
B
Trimming of NURBS surfaces is supported with gluBeginTrim, gluPwlCurve, gluNurbsCurve, andgluEndTrim. See the gluBeginTrim reference page for details.
GL evaluators are used to render the NURBS surface as a set of polygons. Evaluator state is preserved during rendering with glPushAttrib(GL_EVAL_BIT) and glPopAttrib().See the glPushAttrib reference page for details on exactly what state these
calls preserve.

See Also

gluBeginCurve, gluBeginTrim, gluNewNurbsRenderer, gluNurbsCurve, gluNurbsSurface,
gluPwlCurve
Chapter 2
25
B

gluBeginTrim

gluBeginTrim
gluBeginTrim, gluEndTrim: delimit a NURBS trimming loop definition.
C Specification
void gluBeginTrim(
GLUnurbs* nurb)
void gluEndTrim(
GLUnurbs* nurb)

Parameters

nurb Specifies the NURBS object (created with gluNewNurbsRenderer).

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. You include these trimming loops in the definition of a NURBS surface, between calls to gluBeginSurface and gluEndSurface.
The definition for a NURBS surface can contain many trimming loops. For example, if you wrote a definition for a NURBS surface that resembled a rectangle with a hole punched out, the definition would contain two trimming loops. One loop would define the outer edge of the rectangle; the other would define the hole punched out of the rectangle. The definitions of each of these trimming loops would be bracketed by a gluBeginTrim/gluEndTrim pair.
The definition of a single closed trimming loop can consist of multiple curve segments, each described as a piece wise linear curve (see gluPwlCurve) or as a single NURBS curve (see gluNurbsCurve), or as a combination of both in any order. The only library calls that can appear in a trimming loop definition (between the calls to gluBeginTrim and gluEndTrim) are gluPwlCurve and gluNurbsCurve.
The area of the NURBS surface that is displayed is the region in the domain to the left of the trimming curve as the curve parameter increases. Thus, the retained region of the NURBS surface is inside a counterclockwise trimming loop and outside a clockwise trimming loop. For the rectangle mentioned earlier, the trimming loop for the outer edge of the rectangle runs counterclockwise, while the trimming loop for the punched-out hole runs clockwise.
If you use more than one curve to define a single trimming loop, the curve segments must form a closed loop (that is, the endpoint of each curve must be the starting point of the next curve, and the endpoint of the final curve must be the starting point of the first curve). If the endpoints of the curve are sufficiently close together but not exactly coincident, they will be coerced to match. If the endpoints are not sufficiently close, an error results (see gluNurbsCallback).
26
Chapter 2
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.
If no trimming information is given for a NURBS surface, the entire surface is drawn.

See Also

gluBeginSurface, gluNewNurbsRenderer, gluNurbsCallback, gluNurbsCurve,
gluPwlCurve
B
Chapter 2
27
B

glBindTexture

glBindTexture
glBindTexture: bind a named texture to a texture target.
C Specification
void glBindTexture(
GLenum target, GLuint texture)

Parameters

target Specifies the target to which the texture is bound. Must be either
GL_TEXTURE_1D or GL_TEXTURE_2D. Initially, both
GL_TEXTURE_1D and GL_TEXTURE_2D are bound to texture 0. texture Specifies the name of a 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.
Texture names are unsigned integers. The value 0 is reserved to represent the default texture for each texture target. glGenTextures may be used to generate a set of new texture names.
When a texture is first bound, it assumes the dimensionality of its target: A texture first bound to GL_TEXTURE_1D becomes one-dimensional and a texture first bound to GL_TEXTURE_2D becomes two-dimensional. The state of a one-dimensional texture immediately after it is first bound is equivalent to the state of the default GL_TEXTURE_1D at GL initialization, and similarly for two-dimensional textures.
While a texture is bound, GL operations on the target to which it is bound affect the bound texture, and queries of the target to which it is bound return state from the bound texture. If texture mapping of the dimensionality of the target to which a texture is bound is active, the bound texture is used. In effect, the texture targets become aliases for the textures currently bound to them, and the texture name “0” refers to the default textures that were bound to them at initialization.
A texture binding created with glBindTexture remains active until a different texture is bound to the same target, or until the bound texture is deleted with glDeleteTextures. When a bound texture is deleted, the default texture is bound to that target.
28
Once created, a named texture may be re-bound to the target of the matching dimensionality as often as needed. It is usually much faster to use glBindTexture to bind an existing named texture to one of the texture targets than it is to reload the texture image using glTexImage1D or glTexImage2D. For additional control over performance, use glPrioritizeTextures.
Chapter 2
glBindTexture

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.
GL_INVALID_OPERATION is generated if glBindTexture is executed between the
execution of glBegin and the corresponding execution of glEnd.

Associated Gets

glGet with argument GL_TEXTURE_1D_BINDING glGet with argument GL_TEXTURE_2D_BINDING

See Also

B
glAreTexturesResident, glDeleteTextures, glGenTextures, glGet, glGetTexParameter, glIsTexture, glPrioritizeTextures, glTexImage1D, glTexImage2D,
glTexParameter
Chapter 2
29
B

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 Specify the pixel width and height of the bitmap image. xorig, yorig Specify the location of the origin in the bitmap image. The origin is
measured from the lower left corner of the bitmap, with right and up
being the positive axes. xmove, ymove Specify the x and y offsets to be added to the current raster position
after the bitmap is drawn. bitmap Specifies the address of the bitmap image.

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. Frame buffer pixels corresponding to 0s in the bitmap are not modified.
glBitmap takes seven arguments. The first pair specifies the width and height of the bitmap image. The second pair specifies the location of the bitmap origin relative to the lower left corner of the bitmap image. The third pair of arguments specifies x and y offsets to be added to the current raster position after the bitmap has been drawn. The final argument is a pointer to the bitmap image itself.
The bitmap image is interpreted like image data for the glDrawPixels command, with width and height corresponding to the width and height arguments of that command, and with type set to GL_BITMAP and format set to GL_COLOR_INDEX.
Modes specified using glPixelStore affect the interpretation of bitmap image data; modes specified using glPixelTransfer do not.
30
If the current raster position is invalid, glBitmap is ignored. Otherwise, the lower left corner of the bitmap image is positioned at the window coordinates
xw =xr - x yw = yr - y
o
o
Chapter 2
Loading...
+ 456 hidden pages