Module BGL

Source Code for Module BGL

   1  # Blender.BGL module (OpenGL wrapper) 
   2   
   3  """ 
   4  The Blender.BGL submodule (the OpenGL wrapper). 
   5   
   6  B{New}: some GLU functions: L{gluLookAt}, etc. 
   7   
   8  The Blender.BGL submodule 
   9  ========================= 
  10   
  11  This module wraps OpenGL constants and functions, making them available from 
  12  within Blender Python. 
  13   
  14  The complete list can be retrieved from the module itself, by listing its 
  15  contents: dir(Blender.BGL).  A simple search on the net can point to more  
  16  than enough material to teach OpenGL programming, from books to many  
  17  collections of tutorials. 
  18   
  19  The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning 
  20  OpenGL}" and the online NeHe tutorials are two of the best resources. 
  21   
  22  Example:: 
  23    import Blender 
  24    from Blender.BGL import * 
  25    from Blender import Draw 
  26    R = G = B = 0 
  27    A = 1 
  28    title = "Testing BGL  + Draw" 
  29    instructions = "Use mouse buttons or wheel to change the background color." 
  30    quitting = " Press ESC or q to quit." 
  31    len1 = Draw.GetStringWidth(title) 
  32    len2 = Draw.GetStringWidth(instructions + quitting) 
  33    # 
  34    def show_win(): 
  35      glClearColor(R,G,B,A)                # define color used to clear buffers  
  36      glClear(GL_COLOR_BUFFER_BIT)         # use it to clear the color buffer 
  37      glColor3f(0.35,0.18,0.92)            # define default color 
  38      glBegin(GL_POLYGON)                  # begin a vertex data list 
  39      glVertex2i(165, 158) 
  40      glVertex2i(252, 55) 
  41      glVertex2i(104, 128) 
  42      glEnd() 
  43      glColor3f(0.4,0.4,0.4)               # change default color 
  44      glRecti(40, 96, 60+len1, 113) 
  45      glColor3f(1,1,1) 
  46      glRasterPos2i(50,100)                # move cursor to x = 50, y = 100 
  47      Draw.Text(title)                     # draw this text there 
  48      glRasterPos2i(350,40)                # move cursor again 
  49      Draw.Text(instructions + quitting)   # draw another msg 
  50      glBegin(GL_LINE_LOOP)                # begin a vertex-data list 
  51      glVertex2i(46,92) 
  52      glVertex2i(120,92) 
  53      glVertex2i(120,115) 
  54      glVertex2i(46,115) 
  55      glEnd()                              # close this list 
  56    # 
  57    def ev(evt, val):                      # event callback for Draw.Register() 
  58      global R,G,B,A                       # ... it handles input events 
  59      if evt == Draw.ESCKEY or evt == Draw.QKEY: 
  60        Draw.Exit()                        # this quits the script 
  61      elif not val: return 
  62      elif evt == Draw.LEFTMOUSE: R = 1 - R 
  63      elif evt == Draw.MIDDLEMOUSE: G = 1 - G 
  64      elif evt == Draw.RIGHTMOUSE: B = 1 - B 
  65      elif evt == Draw.WHEELUPMOUSE: 
  66        R += 0.1 
  67        if R > 1: R = 1 
  68      elif evt == Draw.WHEELDOWNMOUSE: 
  69        R -= 0.1 
  70        if R < 0: R = 0 
  71      else: 
  72        return                             # don't redraw if nothing changed 
  73      Draw.Redraw(1)                       # make changes visible. 
  74    # 
  75    Draw.Register(show_win, ev, None)      # start the main loop 
  76   
  77  @note: you can use the L{Image} module and L{Image.Image} BPy object to load 
  78      and set textures.  See L{Image.Image.glLoad} and L{Image.Image.glFree}, 
  79      for example. 
  80  @see: U{www.opengl.org} 
  81  @see: U{nehe.gamedev.net} 
  82  """ 
  83   
84 -def glAccum(op, value):
85 """ 86 Operate on the accumulation buffer 87 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html} 88 89 @type op: Enumerated constant 90 @param op: The accumulation buffer operation. 91 @type value: float 92 @param value: a value used in the accumulation buffer operation. 93 """
94
95 -def glAlphaFunc(func, ref):
96 """ 97 Specify the alpha test function 98 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html} 99 100 @type func: Enumerated constant 101 @param func: Specifies the alpha comparison function. 102 @type ref: float 103 @param ref: The reference value that incoming alpha values are compared to. 104 Clamped between 0 and 1. 105 """
106
107 -def glAreTexturesResident(n, textures, residences):
108 """ 109 Determine if textures are loaded in texture memory 110 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html} 111 112 @type n: int 113 @param n: Specifies the number of textures to be queried. 114 @type textures: Buffer object I{type GL_INT} 115 @param textures: Specifies an array containing the names of the textures to be queried 116 @type residences: Buffer object I{type GL_INT}(boolean) 117 @param residences: An array in which the texture residence status in returned.The residence status of a 118 texture named by an element of textures is returned in the corresponding element of residences. 119 """
120
121 -def glBegin(mode):
122 """ 123 Delimit the vertices of a primitive or a group of like primatives 124 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} 125 126 @type mode: Enumerated constant 127 @param mode: Specifies the primitive that will be create from vertices between glBegin and 128 glEnd. 129 """
130
131 -def glBindTexture(target, texture):
132 """ 133 Bind a named texture to a texturing target 134 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html} 135 136 @type target: Enumerated constant 137 @param target: Specifies the target to which the texture is bound. 138 @type texture: unsigned int 139 @param texture: Specifies the name of a texture. 140 """
141
142 -def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap):
143 """ 144 Draw a bitmap 145 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html} 146 147 @type width, height: int 148 @param width, height: Specify the pixel width and height of the bitmap image. 149 @type xorig,yorig: float 150 @param xorig,yorig: Specify the location of the origin in the bitmap image. The origin is measured 151 from the lower left corner of the bitmap, with right and up being the positive axes. 152 @type xmove,ymove: float 153 @param xmove,ymove: Specify the x and y offsets to be added to the current raster position after 154 the bitmap is drawn. 155 @type bitmap: Buffer object I{type GL_BYTE} 156 @param bitmap: Specifies the address of the bitmap image. 157 """
158
159 -def glBlendFunc(sfactor, dfactor):
160 """ 161 Specify pixel arithmetic 162 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html} 163 164 @type sfactor: Enumerated constant 165 @param sfactor: Specifies how the red, green, blue, and alpha source blending factors are 166 computed. 167 @type dfactor: Enumerated constant 168 @param dfactor: Specifies how the red, green, blue, and alpha destination blending factors are 169 computed. 170 """
171
172 -def glCallList(list):
173 """ 174 Execute a display list 175 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html} 176 177 @type list: unsigned int 178 @param list: Specifies the integer name of the display list to be executed. 179 """
180
181 -def glCallLists(n, type, lists):
182 """ 183 Execute a list of display lists 184 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html} 185 186 @type n: int 187 @param n: Specifies the number of display lists to be executed. 188 @type type: Enumerated constant 189 @param type: Specifies the type of values in lists. 190 @type lists: Buffer object 191 @param lists: Specifies the address of an array of name offsets in the display list. 192 The pointer type is void because the offsets can be bytes, shorts, ints, or floats, 193 depending on the value of type. 194 """
195
196 -def glClear(mask):
197 """ 198 Clear buffers to preset values 199 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html} 200 201 @type mask: Enumerated constant(s) 202 @param mask: Bitwise OR of masks that indicate the buffers to be cleared. 203 """
204
205 -def glClearAccum(red, green, blue, alpha):
206 """ 207 Specify clear values for the accumulation buffer 208 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html} 209 210 @type red,green,blue,alpha: float 211 @param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the 212 accumulation buffer is cleared. The initial values are all 0. 213 """
214
215 -def glClearColor(red, green, blue, alpha):
216 """ 217 Specify clear values for the color buffers 218 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html} 219 220 @type red,green,blue,alpha: float 221 @param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the 222 color buffers are cleared. The initial values are all 0. 223 """
224
225 -def glClearDepth(depth):
226 """ 227 Specify the clear value for the depth buffer 228 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html} 229 230 @type depth: int 231 @param depth: Specifies the depth value used when the depth buffer is cleared. 232 The initial value is 1. 233 """
234
235 -def glClearIndex(c):
236 """ 237 Specify the clear value for the color index buffers 238 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html} 239 240 @type c: float 241 @param c: Specifies the index used when the color index buffers are cleared. 242 The initial value is 0. 243 """
244
245 -def glClearStencil(s):
246 """ 247 Specify the clear value for the stencil buffer 248 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html} 249 250 @type s: int 251 @param s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. 252 """
253
254 -def glClipPlane (plane, equation):
255 """ 256 Specify a plane against which all geometry is clipped 257 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html} 258 259 @type plane: Enumerated constant 260 @param plane: Specifies which clipping plane is being positioned. 261 @type equation: Buffer object I{type GL_FLOAT}(double) 262 @param equation: Specifies the address of an array of four double- precision floating-point 263 values. These values are interpreted as a plane equation. 264 """
265
266 -def glColor (red, green, blue, alpha):
267 """ 268 B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, 269 glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, 270 glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, 271 glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, 272 glColor4uiv, glColor4usv} 273 274 Set a new color. 275 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html} 276 277 @type red,green,blue,alpha: Depends on function prototype. 278 @param red,green,blue: Specify new red, green, and blue values for the current color. 279 @param alpha: Specifies a new alpha value for the current color. Included only in the 280 four-argument glColor4 commands. (With '4' colors only) 281 """
282
283 -def glColorMask(red, green, blue, alpha):
284 """ 285 Enable and disable writing of frame buffer color components 286 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html} 287 288 @type red,green,blue,alpha: int (boolean) 289 @param red,green,blue,alpha: Specify whether red, green, blue, and alpha can or cannot be 290 written into the frame buffer. The initial values are all GL_TRUE, indicating that the 291 color components can be written. 292 """
293
294 -def glColorMaterial(face, mode):
295 """ 296 Cause a material color to track the current color 297 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html} 298 299 @type face: Enumerated constant 300 @param face: Specifies whether front, back, or both front and back material parameters should 301 track the current color. 302 @type mode: Enumerated constant 303 @param mode: Specifies which of several material parameters track the current color. 304 """
305
306 -def glCopyPixels(x, y, width, height, type):
307 """ 308 Copy pixels in the frame buffer 309 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html} 310 311 @type x,y: int 312 @param x,y: Specify the window coordinates of the lower left corner of the rectangular 313 region of pixels to be copied. 314 @type width, height: int 315 @param width,height: Specify the dimensions of the rectangular region of pixels to be copied. 316 Both must be non-negative. 317 @type type: Enumerated constant 318 @param type: Specifies whether color values, depth values, or stencil values are to be copied. 319 """
320
321 -def glCullFace(mode):
322 """ 323 Specify whether front- or back-facing facets can be culled 324 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html} 325 326 @type mode: Enumerated constant 327 @param mode: Specifies whether front- or back-facing facets are candidates for culling. 328 """
329
330 -def glDeleteLists(list, range):
331 """ 332 Delete a contiguous group of display lists 333 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html} 334 335 @type list: unsigned int 336 @param list: Specifies the integer name of the first display list to delete 337 @type range: int 338 @param range: Specifies the number of display lists to delete 339 """
340
341 -def glDeleteTextures(n, textures):
342 """ 343 Delete named textures 344 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html} 345 346 @type n: int 347 @param n: Specifies the number of textures to be deleted 348 @type textures: Buffer I{GL_INT} 349 @param textures: Specifies an array of textures to be deleted 350 """
351
352 -def glDepthFunc(func):
353 """ 354 Specify the value used for depth buffer comparisons 355 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html} 356 357 @type func: Enumerated constant 358 @param func: Specifies the depth comparison function. 359 """
360
361 -def glDepthMask(flag):
362 """ 363 Enable or disable writing into the depth buffer 364 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html} 365 366 @type flag: int (boolean) 367 @param flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, 368 depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer 369 writing is enabled. 370 """
371
372 -def glDepthRange(zNear, zFar):
373 """ 374 Specify mapping of depth values from normalized device coordinates to window coordinates 375 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html} 376 377 @type zNear: int 378 @param zNear: Specifies the mapping of the near clipping plane to window coordinates. 379 The initial value is 0. 380 @type zFar: int 381 @param zFar: Specifies the mapping of the far clipping plane to window coordinates. 382 The initial value is 1. 383 """
384
385 -def glDisable(cap):
386 """ 387 Disable server-side GL capabilities 388 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} 389 390 @type cap: Enumerated constant 391 @param cap: Specifies a symbolic constant indicating a GL capability. 392 """
393
394 -def glDrawBuffer(mode):
395 """ 396 Specify which color buffers are to be drawn into 397 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html} 398 399 @type mode: Enumerated constant 400 @param mode: Specifies up to four color buffers to be drawn into. 401 """
402
403 -def glDrawPixels(width, height, format, type, pixels):
404 """ 405 Write a block of pixels to the frame buffer 406 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html} 407 408 @type width, height: int 409 @param width, height: Specify the dimensions of the pixel rectangle to be 410 written into the frame buffer. 411 @type format: Enumerated constant 412 @param format: Specifies the format of the pixel data. 413 @type type: Enumerated constant 414 @param type: Specifies the data type for pixels. 415 @type pixels: Buffer object 416 @param pixels: Specifies a pointer to the pixel data. 417 """
418
419 -def glEdgeFlag (flag):
420 """ 421 B{glEdgeFlag, glEdgeFlagv} 422 423 Flag edges as either boundary or non-boundary 424 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html} 425 426 @type flag: Depends of function prototype 427 @param flag: Specifies the current edge flag value.The initial value is GL_TRUE. 428 """
429
430 -def glEnable(cap):
431 """ 432 Enable server-side GL capabilities 433 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} 434 435 @type cap: Enumerated constant 436 @param cap: Specifies a symbolic constant indicating a GL capability. 437 """
438
439 -def glEnd():
440 """ 441 Delimit the vertices of a primitive or group of like primitives 442 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} 443 """
444
445 -def glEndList():
446 """ 447 Create or replace a display list 448 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} 449 """
450
451 -def glEvalCoord (u,v):
452 """ 453 B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, 454 glEvalCoord2dv, glEvalCoord2fv} 455 456 Evaluate enabled one- and two-dimensional maps 457 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html} 458 459 @type u: Depends on function prototype. 460 @param u: Specifies a value that is the domain coordinate u to the basis function defined 461 in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then 462 u specifies a pointer to an array containing either one or two domain coordinates. The first 463 coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. 464 @type v: Depends on function prototype. (only with '2' prototypes) 465 @param v: Specifies a value that is the domain coordinate v to the basis function defined 466 in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. 467 """
468
469 -def glEvalMesh (mode, i1, i2):
470 """ 471 B{glEvalMesh1 or glEvalMesh2} 472 473 Compute a one- or two-dimensional grid of points or lines 474 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html} 475 476 @type mode: Enumerated constant 477 @param mode: In glEvalMesh1, specifies whether to compute a one-dimensional 478 mesh of points or lines. 479 @type i1, i2: int 480 @param i1, i2: Specify the first and last integer values for the grid domain variable i. 481 """
482
483 -def glEvalPoint (i, j):
484 """ 485 B{glEvalPoint1 and glEvalPoint2} 486 487 Generate and evaluate a single point in a mesh 488 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html} 489 490 @type i: int 491 @param i: Specifies the integer value for grid domain variable i. 492 @type j: int (only with '2' prototypes) 493 @param j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). 494 """
495
496 -def glFeedbackBuffer (size, type, buffer):
497 """ 498 Controls feedback mode 499 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html} 500 501 @type size: int 502 @param size:Specifies the maximum number of values that can be written into buffer. 503 @type type: Enumerated constant 504 @param type:Specifies a symbolic constant that describes the information that 505 will be returned for each vertex. 506 @type buffer: Buffer object I{GL_FLOAT} 507 @param buffer: Returns the feedback data. 508 """
509
510 -def glFinish():
511 """ 512 Block until all GL execution is complete 513 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html} 514 """
515
516 -def glFlush():
517 """ 518 Force Execution of GL commands in finite time 519 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html} 520 """
521
522 -def glFog (pname, param):
523 """ 524 B{glFogf, glFogi, glFogfv, glFogiv} 525 526 Specify fog parameters 527 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html} 528 529 @type pname: Enumerated constant 530 @param pname: Specifies a single-valued fog parameter. If the function prototype 531 ends in 'v' specifies a fog parameter. 532 @type param: Depends on function prototype. 533 @param param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR 534 requires an array of four values. All other parameters accept an array containing 535 only a single value. 536 """
537
538 -def glFrontFace(mode):
539 """ 540 Define front- and back-facing polygons 541 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html} 542 543 @type mode: Enumerated constant 544 @param mode: Specifies the orientation of front-facing polygons. 545 """
546
547 -def glFrustum(left, right, bottom, top, zNear, zFar):
548 """ 549 Multiply the current matrix by a perspective matrix 550 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html} 551 552 @type left, right: double (float) 553 @param left, right: Specify the coordinates for the left and right vertical 554 clipping planes. 555 @type top, bottom: double (float) 556 @param top, bottom: Specify the coordinates for the bottom and top horizontal 557 clipping planes. 558 @type zNear, zFar: double (float) 559 @param zNear, zFar: Specify the distances to the near and far depth clipping planes. 560 Both distances must be positive. 561 """
562
563 -def glGenLists(range):
564 """ 565 Generate a contiguous set of empty display lists 566 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html} 567 568 @type range: int 569 @param range: Specifies the number of contiguous empty display lists to be generated. 570 """
571
572 -def glGenTextures(n, textures):
573 """ 574 Generate texture names 575 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html} 576 577 @type n: int 578 @param n: Specifies the number of textures name to be generated. 579 @type textures: Buffer object I{type GL_INT} 580 @param textures: Specifies an array in which the generated textures names are stored. 581 """
582
583 -def glGet (pname, param):
584 """ 585 B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} 586 587 Return the value or values of a selected parameter 588 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html} 589 590 @type pname: Enumerated constant 591 @param pname: Specifies the parameter value to be returned. 592 @type param: Depends on function prototype. 593 @param param: Returns the value or values of the specified parameter. 594 """
595
596 -def glGetClipPlane(plane, equation):
597 """ 598 Return the coefficients of the specified clipping plane 599 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html} 600 601 @type plane: Enumerated constant 602 @param plane: Specifies a clipping plane. The number of clipping planes depends on the 603 implementation, but at least six clipping planes are supported. They are identified by 604 symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. 605 @type equation: Buffer object I{type GL_FLOAT} 606 @param equation: Returns four float (double)-precision values that are the coefficients of the 607 plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). 608 """
609
610 -def glGetError():
611 """ 612 Return error information 613 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html} 614 """
615
616 -def glGetLight (light, pname, params):
617 """ 618 B{glGetLightfv and glGetLightiv} 619 620 Return light source parameter values 621 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html} 622 623 @type light: Enumerated constant 624 @param light: Specifies a light source. The number of possible lights depends on the 625 implementation, but at least eight lights are supported. They are identified by symbolic 626 names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. 627 @type pname: Enumerated constant 628 @param pname: Specifies a light source parameter for light. 629 @type params: Buffer object. Depends on function prototype. 630 @param params: Returns the requested data. 631 """
632
633 -def glGetMap (target, query, v):
634 """ 635 B{glGetMapdv, glGetMapfv, glGetMapiv} 636 637 Return evaluator parameters 638 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html} 639 640 @type target: Enumerated constant 641 @param target: Specifies the symbolic name of a map. 642 @type query: Enumerated constant 643 @param query: Specifies which parameter to return. 644 @type v: Buffer object. Depends on function prototype. 645 @param v: Returns the requested data. 646 """
647
648 -def glGetMaterial (face, pname, params):
649 """ 650 B{glGetMaterialfv, glGetMaterialiv} 651 652 Return material parameters 653 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html} 654 655 @type face: Enumerated constant 656 @param face: Specifies which of the two materials is being queried. 657 representing the front and back materials, respectively. 658 @type pname: Enumerated constant 659 @param pname: Specifies the material parameter to return. 660 @type params: Buffer object. Depends on function prototype. 661 @param params: Returns the requested data. 662 """
663
664 -def glGetPixelMap (map, values):
665 """ 666 B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} 667 668 Return the specified pixel map 669 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html} 670 671 @type map: Enumerated constant 672 @param map: Specifies the name of the pixel map to return. 673 @type values: Buffer object. Depends on function prototype. 674 @param values: Returns the pixel map contents. 675 """
676
677 -def glGetPolygonStipple(mask):
678 """ 679 Return the polygon stipple pattern 680 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html} 681 682 @type mask: Buffer object I{type GL_BYTE} 683 @param mask: Returns the stipple pattern. The initial value is all 1's. 684 """
685
686 -def glGetString(name):
687 """ 688 Return a string describing the current GL connection 689 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html} 690 691 @type name: Enumerated constant 692 @param name: Specifies a symbolic constant. 693 694 """
695
696 -def glGetTexEnv (target, pname, params):
697 """ 698 B{glGetTexEnvfv, glGetTexEnviv} 699 700 Return texture environment parameters 701 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html} 702 703 @type target: Enumerated constant 704 @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. 705 @type pname: Enumerated constant 706 @param pname: Specifies the symbolic name of a texture environment parameter. 707 @type params: Buffer object. Depends on function prototype. 708 @param params: Returns the requested data. 709 """
710
711 -def glGetTexGen (coord, pname, params):
712 """ 713 B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} 714 715 Return texture coordinate generation parameters 716 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html} 717 718 @type coord: Enumerated constant 719 @param coord: Specifies a texture coordinate. 720 @type pname: Enumerated constant 721 @param pname: Specifies the symbolic name of the value(s) to be returned. 722 @type params: Buffer object. Depends on function prototype. 723 @param params: Returns the requested data. 724 """
725
726 -def glGetTexImage(target, level, format, type, pixels):
727 """ 728 Return a texture image 729 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html} 730 731 @type target: Enumerated constant 732 @param target: Specifies which texture is to be obtained. 733 @type level: int 734 @param level: Specifies the level-of-detail number of the desired image. 735 Level 0 is the base image level. Level n is the nth mipmap reduction image. 736 @type format: Enumerated constant 737 @param format: Specifies a pixel format for the returned data. 738 @type type: Enumerated constant 739 @param type: Specifies a pixel type for the returned data. 740 @type pixels: Buffer object. 741 @param pixels: Returns the texture image. Should be a pointer to an array of the 742 type specified by type 743 """
744
745 -def glGetTexLevelParameter (target, level, pname, params):
746 """ 747 B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} 748 749 return texture parameter values for a specific level of detail 750 @see: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html} 751 752 @type target: Enumerated constant 753 @param target: Specifies the symbolic name of the target texture. 754 @type level: int 755 @param level: Specifies the level-of-detail number of the desired image. 756 Level 0 is the base image level. Level n is the nth mipmap reduction image. 757 @type pname: Enumerated constant 758 @param pname: Specifies the symbolic name of a texture parameter. 759 @type params: Buffer object. Depends on function prototype. 760 @param params: Returns the requested data. 761 """
762
763 -def glGetTexParameter (target, pname, params):
764 """ 765 B{glGetTexParameterfv, glGetTexParameteriv} 766 767 Return texture parameter values 768 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html} 769 770 @type target: Enumerated constant 771 @param target: Specifies the symbolic name of the target texture. 772 @type pname: Enumerated constant 773 @param pname: Specifies the symbolic name the target texture. 774 @type params: Buffer object. Depends on function prototype. 775 @param params: Returns the texture parameters. 776 """
777
778 -def glHint(target, mode):
779 """ 780 Specify implementation-specific hints 781 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html} 782 783 @type target: Enumerated constant 784 @param target: Specifies a symbolic constant indicating the behavior to be 785 controlled. 786 @type mode: Enumerated constant 787 @param mode: Specifies a symbolic constant indicating the desired behavior. 788 """
789
790 -def glIndex (c):
791 """ 792 B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} 793 794 Set the current color index 795 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html} 796 797 @type c: Buffer object. Depends on function prototype. 798 @param c: Specifies a pointer to a one element array that contains the new value for 799 the current color index. 800 """
801
802 -def glInitNames():
803 """ 804 Initialize the name stack 805 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html} 806 """
807
808 -def glIsEnabled(cap):
809 """ 810 Test whether a capability is enabled 811 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html} 812 813 @type cap: Enumerated constant 814 @param cap: Specifies a constant representing a GL capability. 815 """
816
817 -def glIsList(list):
818 """ 819 Determine if a name corresponds to a display-list 820 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html} 821 822 @type list: unsigned int 823 @param list: Specifies a potential display-list name. 824 """
825
826 -def glIsTexture(texture):
827 """ 828 Determine if a name corresponds to a texture 829 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html} 830 831 @type texture: unsigned int 832 @param texture: Specifies a value that may be the name of a texture. 833 """
834
835 -def glLight (light, pname, param):
836 """ 837 B{glLightf,glLighti, glLightfv, glLightiv} 838 839 Set the light source parameters 840 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html} 841 842 @type light: Enumerated constant 843 @param light: Specifies a light. The number of lights depends on the implementation, 844 but at least eight lights are supported. They are identified by symbolic names of the 845 form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. 846 @type pname: Enumerated constant 847 @param pname: Specifies a single-valued light source parameter for light. 848 @type param: Depends on function prototype. 849 @param param: Specifies the value that parameter pname of light source light will be set to. 850 If function prototype ends in 'v' specifies a pointer to the value or values that 851 parameter pname of light source light will be set to. 852 """
853
854 -def glLightModel (pname, param):
855 """ 856 B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} 857 858 Set the lighting model parameters 859 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html} 860 861 @type pname: Enumerated constant 862 @param pname: Specifies a single-value light model parameter. 863 @type param: Depends on function prototype. 864 @param param: Specifies the value that param will be set to. If function prototype ends in 'v' 865 specifies a pointer to the value or values that param will be set to. 866 """
867
868 -def glLineStipple(factor, pattern):
869 """ 870 Specify the line stipple pattern 871 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html} 872 873 @type factor: int 874 @param factor: Specifies a multiplier for each bit in the line stipple pattern. 875 If factor is 3, for example, each bit in the pattern is used three times before 876 the next bit in the pattern is used. factor is clamped to the range [1, 256] and 877 defaults to 1. 878 @type pattern: unsigned short int 879 @param pattern: Specifies a 16-bit integer whose bit pattern determines which fragments 880 of a line will be drawn when the line is rasterized. Bit zero is used first; the default 881 pattern is all 1's. 882 """
883
884 -def glLineWidth(width):
885 """ 886 Specify the width of rasterized lines. 887 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html} 888 889 @type width: float 890 @param width: Specifies the width of rasterized lines. The initial value is 1. 891 """
892
893 -def glListBase(base):
894 """ 895 Set the display-list base for glCallLists 896 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html} 897 898 @type base: unsigned int 899 @param base: Specifies an integer offset that will be added to glCallLists 900 offsets to generate display-list names. The initial value is 0. 901 """
902
903 -def glLoadIdentity():
904 """ 905 Replace the current matrix with the identity matrix 906 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html} 907 """
908
909 -def glLoadMatrix (m):
910 """ 911 B{glLoadMatrixd, glLoadMatixf} 912 913 Replace the current matrix with the specified matrix 914 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html} 915 916 @type m: Buffer object. Depends on function prototype. 917 @param m: Specifies a pointer to 16 consecutive values, which are used as the elements 918 of a 4x4 column-major matrix. 919 """
920
921 -def glLoadName(name):
922 """ 923 Load a name onto the name stack. 924 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html} 925 926 @type name: unsigned int 927 @param name: Specifies a name that will replace the top value on the name stack. 928 """
929
930 -def glLogicOp(opcode):
931 """ 932 Specify a logical pixel operation for color index rendering 933 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html} 934 935 @type opcode: Enumerated constant 936 @param opcode: Specifies a symbolic constant that selects a logical operation. 937 """
938
939 -def glMap1 (target, u1, u2, stride, order, points):
940 """ 941 B{glMap1d, glMap1f} 942 943 Define a one-dimensional evaluator 944 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html} 945 946 @type target: Enumerated constant 947 @param target: Specifies the kind of values that are generated by the evaluator. 948 @type u1, u2: Depends on function prototype. 949 @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t 950 he variable that is evaluated by the equations specified by this command. 951 @type stride: int 952 @param stride: Specifies the number of floats or float (double)s between the beginning 953 of one control point and the beginning of the next one in the data structure 954 referenced in points. This allows control points to be embedded in arbitrary data 955 structures. The only constraint is that the values for a particular control point must 956 occupy contiguous memory locations. 957 @type order: int 958 @param order: Specifies the number of control points. Must be positive. 959 @type points: Buffer object. Depends on function prototype. 960 @param points: Specifies a pointer to the array of control points. 961 """
962
963 -def glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points):
964 """ 965 B{glMap2d, glMap2f} 966 967 Define a two-dimensional evaluator 968 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html} 969 970 @type target: Enumerated constant 971 @param target: Specifies the kind of values that are generated by the evaluator. 972 @type u1, u2: Depends on function prototype. 973 @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t 974 he variable that is evaluated by the equations specified by this command. Initially 975 u1 is 0 and u2 is 1. 976 @type ustride: int 977 @param ustride: Specifies the number of floats or float (double)s between the beginning 978 of control point R and the beginning of control point R ij, where i and j are the u 979 and v control point indices, respectively. This allows control points to be embedded 980 in arbitrary data structures. The only constraint is that the values for a particular 981 control point must occupy contiguous memory locations. The initial value of ustride is 0. 982 @type uorder: int 983 @param uorder: Specifies the dimension of the control point array in the u axis. 984 Must be positive. The initial value is 1. 985 @type v1, v2: Depends on function prototype. 986 @param v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, to ^, 987 one of the two variables that are evaluated by the equations specified by this command. 988 Initially, v1 is 0 and v2 is 1. 989 @type vstride: int 990 @param vstride: Specifies the number of floats or float (double)s between the beginning of control 991 point R and the beginning of control point R ij, where i and j are the u and v control 992 point(indices, respectively. This allows control points to be embedded in arbitrary data 993 structures. The only constraint is that the values for a particular control point must 994 occupy contiguous memory locations. The initial value of vstride is 0. 995 @type vorder: int 996 @param vorder: Specifies the dimension of the control point array in the v axis. 997 Must be positive. The initial value is 1. 998 @type points: Buffer object. Depends on function prototype. 999 @param points: Specifies a pointer to the array of control points. 1000 """
1001
1002 -def glMapGrid (un, u1,u2 ,vn, v1, v2):
1003 """ 1004 B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} 1005 1006 Define a one- or two-dimensional mesh 1007 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html} 1008 1009 @type un: int 1010 @param un: Specifies the number of partitions in the grid range interval 1011 [u1, u2]. Must be positive. 1012 @type u1, u2: Depends on function prototype. 1013 @param u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. 1014 @type vn: int 1015 @param vn: Specifies the number of partitions in the grid range interval [v1, v2] 1016 (glMapGrid2 only). 1017 @type v1, v2: Depends on function prototype. 1018 @param v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn 1019 (glMapGrid2 only). 1020 """
1021
1022 -def glMaterial (face, pname, params):
1023 """ 1024 Specify material parameters for the lighting model. 1025 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html} 1026 1027 @type face: Enumerated constant 1028 @param face: Specifies which face or faces are being updated. Must be one of: 1029 @type pname: Enumerated constant 1030 @param pname: Specifies the single-valued material parameter of the face 1031 or faces that is being updated. Must be GL_SHININESS. 1032 @type params: int 1033 @param params: Specifies the value that parameter GL_SHININESS will be set to. 1034 If function prototype ends in 'v' specifies a pointer to the value or values that 1035 pname will be set to. 1036 """
1037
1038 -def glMatrixMode(mode):
1039 """ 1040 Specify which matrix is the current matrix. 1041 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html} 1042 1043 @type mode: Enumerated constant 1044 @param mode: Specifies which matrix stack is the target for subsequent matrix operations. 1045 """
1046
1047 -def glMultMatrix (m):
1048 """ 1049 B{glMultMatrixd, glMultMatrixf} 1050 1051 Multiply the current matrix with the specified matrix 1052 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html} 1053 1054 @type m: Buffer object. Depends on function prototype. 1055 @param m: Points to 16 consecutive values that are used as the elements of a 4x4 column 1056 major matrix. 1057 """
1058
1059 -def glNewList(list, mode):
1060 """ 1061 Create or replace a display list 1062 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} 1063 1064 @type list: unsigned int 1065 @param list: Specifies the display list name 1066 @type mode: Enumerated constant 1067 @param mode: Specifies the compilation mode. 1068 """
1069
1070 -def glNormal3 (nx, ny, nz, v):
1071 """ 1072 B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, 1073 Normal3s, Normal3sv} 1074 1075 Set the current normal vector 1076 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html} 1077 1078 @type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) 1079 @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. 1080 The initial value of the current normal is the unit vector, (0, 0, 1). 1081 @type v: Buffer object. Depends on function prototype. ('v' prototypes) 1082 @param v: Specifies a pointer to an array of three elements: the x,y, and z coordinates 1083 of the new current normal. 1084 """
1085
1086 -def glOrtho(left, right, bottom, top, zNear, zFar):
1087 """ 1088 Multiply the current matrix with an orthographic matrix 1089 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html} 1090 1091 @type left, right: double (float) 1092 @param left, right: Specify the coordinates for the left and 1093 right vertical clipping planes. 1094 @type bottom, top: double (float) 1095 @param bottom, top: Specify the coordinates for the bottom and top 1096 horizontal clipping planes. 1097 @type zNear, zFar: double (float) 1098 @param zNear, zFar: Specify the distances to the nearer and farther 1099 depth clipping planes. These values are negative if the plane is to be behind the viewer. 1100 """
1101
1102 -def glPassThrough(token):
1103 """ 1104 Place a marker in the feedback buffer 1105 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html} 1106 1107 @type token: float 1108 @param token: Specifies a marker value to be placed in the feedback 1109 buffer following a GL_PASS_THROUGH_TOKEN. 1110 """
1111
1112 -def glPixelMap (map, mapsize, values):
1113 """ 1114 B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} 1115 1116 Set up pixel transfer maps 1117 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html} 1118 1119 @type map: Enumerated constant 1120 @param map: Specifies a symbolic map name. 1121 @type mapsize: int 1122 @param mapsize: Specifies the size of the map being defined. 1123 @type values: Buffer object. Depends on function prototype. 1124 @param values: Specifies an array of mapsize values. 1125 """
1126
1127 -def glPixelStore (pname, param):
1128 """ 1129 B{glPixelStoref, glPixelStorei} 1130 1131 Set pixel storage modes 1132 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html} 1133 1134 @type pname: Enumerated constant 1135 @param pname: Specifies the symbolic name of the parameter to be set. 1136 Six values affect the packing of pixel data into memory. 1137 Six more affect the unpacking of pixel data from memory. 1138 @type param: Depends on function prototype. 1139 @param param: Specifies the value that pname is set to. 1140 """
1141
1142 -def glPixelTransfer (pname, param):
1143 """ 1144 B{glPixelTransferf, glPixelTransferi} 1145 1146 Set pixel transfer modes 1147 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html} 1148 1149 @type pname: Enumerated constant 1150 @param pname: Specifies the symbolic name of the pixel transfer parameter to be set. 1151 @type param: Depends on function prototype. 1152 @param param: Specifies the value that pname is set to. 1153 """
1154
1155 -def glPixelZoom(xfactor, yfactor):
1156 """ 1157 Specify the pixel zoom factors 1158 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html} 1159 1160 @type xfactor, yfactor: float 1161 @param xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. 1162 """
1163
1164 -def glPointSize(size):
1165 """ 1166 Specify the diameter of rasterized points 1167 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html} 1168 1169 @type size: float 1170 @param size: Specifies the diameter of rasterized points. The initial value is 1. 1171 """
1172
1173 -def glPolygonMode(face, mode):
1174 """ 1175 Select a polygon rasterization mode 1176 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html} 1177 1178 @type face: Enumerated constant 1179 @param face: Specifies the polygons that mode applies to. 1180 Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing polygons, 1181 or GL_FRONT_AND_BACK for front- and back-facing polygons. 1182 @type mode: Enumerated constant 1183 @param mode: Specifies how polygons will be rasterized. 1184 The initial value is GL_FILL for both front- and back- facing polygons. 1185 """
1186
1187 -def glPolygonOffset(factor, units):
1188 """ 1189 Set the scale and units used to calculate depth values 1190 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html} 1191 1192 @type factor: float 1193 @param factor: Specifies a scale factor that is used to create a variable depth 1194 offset for each polygon. The initial value is 0. 1195 @type units: float 1196 @param units: Is multiplied by an implementation-specific value to create a constant 1197 depth offset. The initial value is 0. 1198 """
1199
1200 -def glPolygonStipple(mask):
1201 """ 1202 Set the polygon stippling pattern 1203 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html} 1204 1205 @type mask: Buffer object I{type GL_BYTE} 1206 @param mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked 1207 from memory in the same way that glDrawPixels unpacks pixels. 1208 """
1209
1210 -def glPopAttrib():
1211 """ 1212 Pop the server attribute stack 1213 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} 1214 """
1215
1216 -def glPopClientAttrib():
1217 """ 1218 Pop the client attribute stack 1219 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} 1220 """
1221
1222 -def glPopMatrix():
1223 """ 1224 Pop the current matrix stack 1225 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} 1226 """
1227
1228 -def glPopName():
1229 """ 1230 Pop the name stack 1231 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} 1232 """
1233
1234 -def glPrioritizeTextures(n, textures, priorities):
1235 """ 1236 Set texture residence priority 1237 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html} 1238 1239 @type n: int 1240 @param n:Specifies the number of textures to be prioritized. 1241 @type textures: Buffer I{type GL_INT} 1242 @param textures: Specifies an array containing the names of the textures to be prioritized. 1243 @type priorities: Buffer I{type GL_FLOAT} 1244 @param priorities: Specifies an array containing the texture priorities. A priority given 1245 in an element of priorities applies to the texture named by the corresponding element of textures. 1246 """
1247
1248 -def glPushAttrib(mask):
1249 """ 1250 Push the server attribute stack 1251 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} 1252 1253 @type mask: Enumerated constant(s) 1254 @param mask: Specifies a mask that indicates which attributes to save. 1255 """
1256
1257 -def glPushClientAttrib(mask):
1258 """ 1259 Push the client attribute stack 1260 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} 1261 1262 @type mask: Enumerated constant(s) 1263 @param mask: Specifies a mask that indicates which attributes to save. 1264 """
1265
1266 -def glPushMatrix():
1267 """ 1268 Push the current matrix stack 1269 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} 1270 """
1271
1272 -def glPushName(name):
1273 """ 1274 Push the name stack 1275 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} 1276 1277 @type name: unsigned int 1278 @param name: Specifies a name that will be pushed onto the name stack. 1279 """
1280
1281 -def glRasterPos (x,y,z,w):
1282 """ 1283 B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, 1284 glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, 1285 glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, 1286 glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, 1287 glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} 1288 1289 Specify the raster position for pixel operations 1290 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html} 1291 1292 @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) 1293 @param x,y,z,w: Specify the x,y,z, and w object coordinates (if present) for the 1294 raster position. If function prototype ends in 'v' specifies a pointer to an array of two, 1295 three, or four elements, specifying x, y, z, and w coordinates, respectively. 1296 @note: 1297 If you are drawing to the 3d view with a Scriptlink of a space handler 1298 the zoom level of the panels will scale the glRasterPos by the view matrix. 1299 so a X of 10 will not always offset 10 pixels as you would expect. 1300 1301 To work around this get the scale value of the view matrix and use it to scale your pixel values. 1302 1303 Workaround:: 1304 1305 import Blender 1306 from Blender.BGL import * 1307 xval, yval= 100, 40 1308 # Get the scale of the view matrix 1309 viewMatrix = Buffer(GL_FLOAT, 16) 1310 glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix) 1311 f = 1/viewMatrix[0] 1312 glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval) 1313 """
1314
1315 -def glReadBuffer(mode):
1316 """ 1317 Select a color buffer source for pixels. 1318 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html} 1319 1320 @type mode: Enumerated constant 1321 @param mode: Specifies a color buffer. 1322 """
1323
1324 -def glReadPixels(x, y, width, height, format, type, pixels):
1325 """ 1326 Read a block of pixels from the frame buffer 1327 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html} 1328 1329 @type x,y: int 1330 @param x,y:Specify the window coordinates of the first pixel that is read 1331 from the frame buffer. This location is the lower left corner of a rectangular 1332 block of pixels. 1333 @type width, height: int 1334 @param width, height: Specify the dimensions of the pixel rectangle. width and 1335 height of one correspond to a single pixel. 1336 @type format: Enumerated constant 1337 @param format: Specifies the format of the pixel data. 1338 @type type: Enumerated constant 1339 @param type: Specifies the data type of the pixel data. 1340 @type pixels: Buffer object 1341 @param pixels: Returns the pixel data. 1342 """
1343
1344 -def glRect (x1,y1,x2,y2,v1,v2):
1345 """ 1346 B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} 1347 1348 Draw a rectangle 1349 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html} 1350 1351 @type x1, y1: Depends on function prototype. (for non 'v' prototypes only) 1352 @param x1, y1: Specify one vertex of a rectangle 1353 @type x2, y2: Depends on function prototype. (for non 'v' prototypes only) 1354 @param x2, y2: Specify the opposite vertex of the rectangle 1355 @type v1, v2: Depends on function prototype. (for 'v' prototypes only) 1356 @param v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer 1357 to the opposite vertex of the rectangle 1358 """
1359
1360 -def glRenderMode(mode):
1361 """ 1362 Set rasterization mode 1363 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html} 1364 1365 @type mode: Enumerated constant 1366 @param mode: Specifies the rasterization mode. 1367 """
1368
1369 -def glRotate (angle, x, y, z):
1370 """ 1371 B{glRotated, glRotatef} 1372 1373 Multiply the current matrix by a rotation matrix 1374 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html} 1375 1376 @type angle: Depends on function prototype. 1377 @param angle: Specifies the angle of rotation in degrees. 1378 @type x,y,z: Depends on function prototype. 1379 @param x,y,z: Specify the x,y, and z coordinates of a vector respectively. 1380 """
1381
1382 -def glScale (x,y,z):
1383 """ 1384 B{glScaled, glScalef} 1385 1386 Multiply the current matrix by a general scaling matrix 1387 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html} 1388 1389 @type x,y,z: Depends on function prototype. 1390 @param x,y,z: Specify scale factors along the x,y, and z axes, respectively. 1391 """
1392
1393 -def glScissor(x,y,width,height):
1394 """ 1395 Define the scissor box 1396 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html} 1397 1398 @type x,y: int 1399 @param x,y: Specify the lower left corner of the scissor box. Initially (0, 0). 1400 @type width, height: int 1401 @param width height: Specify the width and height of the scissor box. When a 1402 GL context is first attached to a window, width and height are set to the 1403 dimensions of that window. 1404 """
1405
1406 -def glSelectBuffer(size, buffer):
1407 """ 1408 Establish a buffer for selection mode values 1409 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html} 1410 1411 @type size: int 1412 @param size: Specifies the size of buffer 1413 @type buffer: Buffer I{type GL_INT} 1414 @param buffer: Returns the selection data 1415 """
1416
1417 -def glShadeModel(mode):
1418 """ 1419 Select flat or smooth shading 1420 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html} 1421 1422 @type mode: Enumerated constant 1423 @param mode: Specifies a symbolic value representing a shading technique. 1424 """
1425
1426 -def glStencilFuc(func, ref, mask):
1427 """ 1428 Set function and reference value for stencil testing 1429 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html} 1430 1431 @type func: Enumerated constant 1432 @param func:Specifies the test function. 1433 @type ref: int 1434 @param ref:Specifies the reference value for the stencil test. ref is clamped to 1435 the range [0,2n-1], where n is the number of bitplanes in the stencil buffer. 1436 The initial value is 0. 1437 @type mask: unsigned int 1438 @param mask:Specifies a mask that is ANDed with both the reference value and 1439 the stored stencil value when the test is done. The initial value is all 1's. 1440 """
1441
1442 -def glStencilMask(mask):
1443 """ 1444 Control the writing of individual bits in the stencil planes 1445 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html} 1446 1447 @type mask: unsigned int 1448 @param mask: Specifies a bit mask to enable and disable writing of individual bits 1449 in the stencil planes. Initially, the mask is all 1's. 1450 """
1451
1452 -def glStencilOp(fail, zfail, zpass):
1453 """ 1454 Set stencil test actions 1455 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html} 1456 1457 @type fail: Enumerated constant 1458 @param fail: Specifies the action to take when the stencil test fails. 1459 The initial value is GL_KEEP. 1460 @type zfail: Enumerated constant 1461 @param zfail: Specifies the stencil action when the stencil test passes, but the 1462 depth test fails. zfail accepts the same symbolic constants as fail. 1463 The initial value is GL_KEEP. 1464 @type zpass: Enumerated constant 1465 @param zpass: Specifies the stencil action when both the stencil test and the 1466 depth test pass, or when the stencil test passes and either there is no depth 1467 buffer or depth testing is not enabled. zpass accepts the same symbolic constants 1468 as fail. The initial value is GL_KEEP. 1469 """
1470
1471 -def glTexCoord (s,t,r,q,v):
1472 """ 1473 B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, 1474 glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, 1475 glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, 1476 glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, 1477 glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, 1478 glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} 1479 1480 Set the current texture coordinates 1481 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html} 1482 1483 @type s,t,r,q: Depends on function prototype. (r and q for '3' and '4' prototypes only) 1484 @param s,t,r,q: Specify s, t, r, and q texture coordinates. Not all parameters are 1485 present in all forms of the command. 1486 @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only) 1487 @param v: Specifies a pointer to an array of one, two, three, or four elements, 1488 which in turn specify the s, t, r, and q texture coordinates. 1489 """ 1490
1491 -def glTexEnv (target, pname, param):
1492 """ 1493 B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} 1494 1495 Set texture environment parameters 1496 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html} 1497 1498 @type target: Enumerated constant 1499 @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. 1500 @type pname: Enumerated constant 1501 @param pname: Specifies the symbolic name of a single-valued texture environment 1502 parameter. Must be GL_TEXTURE_ENV_MODE. 1503 @type param: Depends on function prototype. 1504 @param param: Specifies a single symbolic constant. If function prototype ends in 'v' 1505 specifies a pointer to a parameter array that contains either a single symbolic 1506 constant or an RGBA color 1507 """
1508
1509 -def glTexGen (coord, pname, param):
1510 """ 1511 B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} 1512 1513 Control the generation of texture coordinates 1514 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html} 1515 1516 @type coord: Enumerated constant 1517 @param coord: Specifies a texture coordinate. 1518 @type pname: Enumerated constant 1519 @param pname: Specifies the symbolic name of the texture- coordinate generation function. 1520 @type param: Depends on function prototype. 1521 @param param: Specifies a single-valued texture generation parameter. 1522 If function prototype ends in 'v' specifies a pointer to an array of texture 1523 generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must 1524 contain a single symbolic constant. Otherwise, params holds the coefficients 1525 for the texture-coordinate generation function specified by pname. 1526 """
1527
1528 -def glTexImage1D(target, level, internalformat, width, border, format, type, pixels):
1529 """ 1530 Specify a one-dimensional texture image 1531 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html} 1532 1533 @type target: Enumerated constant 1534 @param target: Specifies the target texture. 1535 @type level: int 1536 @param level: Specifies the level-of-detail number. Level 0 is the base image level. 1537 Level n is the nth mipmap reduction image. 1538 @type internalformat: int 1539 @param internalformat: Specifies the number of color components in the texture. 1540 @type width: int 1541 @param width: Specifies the width of the texture image. Must be 2n+2(border) for 1542 some integer n. All implementations support texture images that are at least 64 1543 texels wide. The height of the 1D texture image is 1. 1544 @type border: int 1545 @param border: Specifies the width of the border. Must be either 0 or 1. 1546 @type format: Enumerated constant 1547 @param format: Specifies the format of the pixel data. 1548 @type type: Enumerated constant 1549 @param type: Specifies the data type of the pixel data. 1550 @type pixels: Buffer object. 1551 @param pixels: Specifies a pointer to the image data in memory. 1552 """
1553
1554 -def glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels):
1555 """ 1556 Specify a two-dimensional texture image 1557 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html} 1558 1559 @type target: Enumerated constant 1560 @param target: Specifies the target texture. 1561 @type level: int 1562 @param level: Specifies the level-of-detail number. Level 0 is the base image level. 1563 Level n is the nth mipmap reduction image. 1564 @type internalformat: int 1565 @param internalformat: Specifies the number of color components in the texture. 1566 @type width: int 1567 @param width: Specifies the width of the texture image. Must be 2n+2(border) for 1568 some integer n. All implementations support texture images that are at least 64 1569 texels wide. 1570 @type height: int 1571 @param height: Specifies the height of the texture image. Must be 2m+2(border) for 1572 some integer m. All implementations support texture images that are at least 64 1573 texels high. 1574 @type border: int 1575 @param border: Specifies the width of the border. Must be either 0 or 1. 1576 @type format: Enumerated constant 1577 @param format: Specifies the format of the pixel data. 1578 @type type: Enumerated constant 1579 @param type: Specifies the data type of the pixel data. 1580 @type pixels: Buffer object. 1581 @param pixels: Specifies a pointer to the image data in memory. 1582 """
1583
1584 -def glTexParameter (target, pname, param):
1585 """ 1586 B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} 1587 1588 Set texture parameters 1589 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html} 1590 1591 @type target: Enumerated constant 1592 @param target: Specifies the target texture. 1593 @type pname: Enumerated constant 1594 @param pname: Specifies the symbolic name of a single-valued texture parameter. 1595 @type param: Depends on function prototype. 1596 @param param: Specifies the value of pname. If function prototype ends in 'v' specifies 1597 a pointer to an array where the value or values of pname are stored. 1598 """
1599
1600 -def glTranslate (x, y, z):
1601 """ 1602 B{glTranslatef, glTranslated} 1603 1604 Multiply the current matrix by a translation matrix 1605 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html} 1606 1607 @type x,y,z: Depends on function prototype. 1608 @param x,y,z: Specify the x, y, and z coordinates of a translation vector. 1609 """
1610
1611 -def glVertex (x,y,z,w,v):
1612 """ 1613 B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, 1614 glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, 1615 glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, 1616 glVertex4fv, glVertex4iv, glVertex4sv} 1617 1618 Specify a vertex 1619 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html} 1620 1621 @type x,y,z,w: Depends on function prototype (z and w for '3' and '4' prototypes only) 1622 @param x,y,z,w: Specify x, y, z, and w coordinates of a vertex. Not all parameters 1623 are present in all forms of the command. 1624 @type v: Buffer object. Depends of function prototype (for 'v' prototypes only) 1625 @param v: Specifies a pointer to an array of two, three, or four elements. The 1626 elements of a two-element array are x and y; of a three-element array, x, y, and z; 1627 and of a four-element array, x, y, z, and w. 1628 """
1629
1630 -def glViewport(x,y,width,height):
1631 """ 1632 Set the viewport 1633 @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html} 1634 1635 @type x,y: int 1636 @param x,y: Specify the lower left corner of the viewport rectangle, 1637 in pixels. The initial value is (0,0). 1638 @type width,height: int 1639 @param width,height: Specify the width and height of the viewport. When a GL context 1640 is first attached to a window, width and height are set to the dimensions of that window. 1641 """
1642
1643 -def gluPerspective(fovY, aspect, zNear, zFar):
1644 """ 1645 Set up a perspective projection matrix. 1646 @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288} 1647 1648 @type fovY: double 1649 @param fovY: Specifies the field of view angle, in degrees, in the y direction. 1650 @type aspect: double 1651 @param aspect: Specifies the aspect ratio that determines the field of view in the x direction. 1652 The aspect ratio is the ratio of x (width) to y (height). 1653 @type zNear: double 1654 @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive). 1655 @type zFar: double 1656 @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive). 1657 """
1658
1659 -def gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz):
1660 """ 1661 Define a viewing transformation 1662 @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042} 1663 1664 @type eyex, eyey, eyez: double 1665 @param eyex, eyey, eyez: Specifies the position of the eye point. 1666 @type centerx, centery, centerz: double 1667 @param centerx, centery, centerz: Specifies the position of the reference point. 1668 @type upx, upy, upz: double 1669 @param upx, upy, upz: Specifies the direction of the up vector. 1670 """
1671
1672 -def gluOrtho2D(left, right, bottom, top):
1673 """ 1674 Define a 2-D orthographic projection matrix 1675 @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} 1676 1677 @type left, right: double 1678 @param left, right: Specify the coordinates for the left and right vertical clipping planes. 1679 @type bottom, top: double 1680 @param bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. 1681 """
1682
1683 -def gluPickMatrix(x, y, width, height, viewport):
1684 """ 1685 Define a picking region 1686 @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} 1687 1688 @type x, y: double 1689 @param x, y: Specify the center of a picking region in window coordinates. 1690 @type width, height: double 1691 @param width, height: Specify the width and height, respectively, of the picking region in window coordinates. 1692 @type viewport: Buffer object. [int] 1693 @param viewport: Specifies the current viewport. 1694 """
1695
1696 -def gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz):
1697 """ 1698 Map object coordinates to window coordinates. 1699 @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} 1700 1701 @type objx, objy, objz: double 1702 @param objx, objy, objz: Specify the object coordinates. 1703 @type modelMatrix: Buffer object. [double] 1704 @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). 1705 @type projMatrix: Buffer object. [double] 1706 @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). 1707 @type viewport: Buffer object. [int] 1708 @param viewport: Specifies the current viewport (as from a glGetIntegerv call). 1709 @type winx, winy, winz: Buffer object. [double] 1710 @param winx, winy, winz: Return the computed window coordinates. 1711 """
1712
1713 -def gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz):
1714 """ 1715 Map object coordinates to window 1716 coordinates. 1717 @see: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204} 1718 1719 @type winx, winy, winz: double 1720 @param winx, winy, winz: Specify the window coordinates to be mapped. 1721 @type modelMatrix: Buffer object. [double] 1722 @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). 1723 @type projMatrix: Buffer object. [double] 1724 @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). 1725 @type viewport: Buffer object. [int] 1726 @param viewport: Specifies the current viewport (as from a glGetIntegerv call). 1727 @type objx, objy, objz: Buffer object. [double] 1728 @param objx, objy, objz: Return the computed object coordinates. 1729 """
1730
1731 -class Buffer:
1732 """ 1733 The Buffer object is simply a block of memory that is delineated and initialized by the 1734 user. Many OpenGL functions return data to a C-style pointer, however, because this 1735 is not possible in python the Buffer object can be used to this end. Wherever pointer 1736 notation is used in the OpenGL functions the Buffer object can be used in it's BGL 1737 wrapper. In some instances the Buffer object will need to be initialized with the template 1738 parameter, while in other instances the user will want to create just a blank buffer 1739 which will be zeroed by default. 1740 1741 Example with Buffer:: 1742 import Blender 1743 from Blender import BGL 1744 myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32]) 1745 BGL.glGetPolygonStipple(myByteBuffer) 1746 print myByteBuffer.dimensions 1747 print myByteBuffer.list 1748 sliceBuffer = myByteBuffer[0:16] 1749 print sliceBuffer 1750 1751 @ivar list: The contents of the Buffer. 1752 @ivar dimensions: The size of the Buffer. 1753 """ 1754
1755 - def __init__(type, dimensions, template = None):
1756 """ 1757 This will create a new Buffer object for use with other BGL OpenGL commands. 1758 Only the type of argument to store in the buffer and the dimensions of the buffer 1759 are necessary. Buffers are zeroed by default unless a template is supplied, in 1760 which case the buffer is initialized to the template. 1761 1762 @type type: int 1763 @param type: The format to store data in. The type should be one of 1764 GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. 1765 @type dimensions: An int or sequence object specifying the dimensions of the buffer. 1766 @param dimensions: If the dimensions are specified as an int a linear array will 1767 be created for the buffer. If a sequence is passed for the dimensions, the buffer 1768 becomes n-Dimensional, where n is equal to the number of parameters passed in the 1769 sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates 1770 a three- dimensional buffer. You can think of each additional dimension as a sub-item 1771 of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. 1772 [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. 1773 @type template: A python sequence object (optional) 1774 @param template: A sequence of matching dimensions which will be used to initialize 1775 the Buffer. If a template is not passed in all fields will be initialized to 0. 1776 @rtype: Buffer object 1777 @return: The newly created buffer as a PyObject. 1778 """
1779