[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26227] trunk/blender/source/blender/ python/doc/epy: copy of docs from 2. 4x for python modules that have been kept

Campbell Barton ideasman42 at gmail.com
Sun Jan 24 13:58:38 CET 2010


Revision: 26227
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26227
Author:   campbellbarton
Date:     2010-01-24 13:58:38 +0100 (Sun, 24 Jan 2010)

Log Message:
-----------
copy of docs from 2.4x for python modules that have been kept

Added Paths:
-----------
    trunk/blender/source/blender/python/doc/epy/BGL.py
    trunk/blender/source/blender/python/doc/epy/Geometry.py
    trunk/blender/source/blender/python/doc/epy/IDProp.py
    trunk/blender/source/blender/python/doc/epy/Mathutils.py
    trunk/blender/source/blender/python/doc/epy/testbgl.py

Copied: trunk/blender/source/blender/python/doc/epy/BGL.py (from rev 26226, branches/blender2.4/source/blender/python/api2_2x/doc/BGL.py)
===================================================================
--- trunk/blender/source/blender/python/doc/epy/BGL.py	                        (rev 0)
+++ trunk/blender/source/blender/python/doc/epy/BGL.py	2010-01-24 12:58:38 UTC (rev 26227)
@@ -0,0 +1,1779 @@
+# Blender.BGL module (OpenGL wrapper)
+
+"""
+The Blender.BGL submodule (the OpenGL wrapper).
+
+B{New}: some GLU functions: L{gluLookAt}, etc.
+
+The Blender.BGL submodule
+=========================
+(when accessing it from the Game Engine use BGL instead of Blender.BGL)
+
+This module wraps OpenGL constants and functions, making them available from
+within Blender Python.
+
+The complete list can be retrieved from the module itself, by listing its
+contents: dir(Blender.BGL).  A simple search on the net can point to more 
+than enough material to teach OpenGL programming, from books to many 
+collections of tutorials.
+
+The "red book": "I{OpenGL Programming Guide: The Official Guide to Learning
+OpenGL}" and the online NeHe tutorials are two of the best resources.
+
+Example::
+  import Blender
+  from Blender.BGL import *
+  from Blender import Draw
+  R = G = B = 0
+  A = 1
+  title = "Testing BGL  + Draw"
+  instructions = "Use mouse buttons or wheel to change the background color."
+  quitting = " Press ESC or q to quit."
+  len1 = Draw.GetStringWidth(title)
+  len2 = Draw.GetStringWidth(instructions + quitting)
+  #
+  def show_win():
+    glClearColor(R,G,B,A)                # define color used to clear buffers 
+    glClear(GL_COLOR_BUFFER_BIT)         # use it to clear the color buffer
+    glColor3f(0.35,0.18,0.92)            # define default color
+    glBegin(GL_POLYGON)                  # begin a vertex data list
+    glVertex2i(165, 158)
+    glVertex2i(252, 55)
+    glVertex2i(104, 128)
+    glEnd()
+    glColor3f(0.4,0.4,0.4)               # change default color
+    glRecti(40, 96, 60+len1, 113)
+    glColor3f(1,1,1)
+    glRasterPos2i(50,100)                # move cursor to x = 50, y = 100
+    Draw.Text(title)                     # draw this text there
+    glRasterPos2i(350,40)                # move cursor again
+    Draw.Text(instructions + quitting)   # draw another msg
+    glBegin(GL_LINE_LOOP)                # begin a vertex-data list
+    glVertex2i(46,92)
+    glVertex2i(120,92)
+    glVertex2i(120,115)
+    glVertex2i(46,115)
+    glEnd()                              # close this list
+  #
+  def ev(evt, val):                      # event callback for Draw.Register()
+    global R,G,B,A                       # ... it handles input events
+    if evt == Draw.ESCKEY or evt == Draw.QKEY:
+      Draw.Exit()                        # this quits the script
+    elif not val: return
+    elif evt == Draw.LEFTMOUSE: R = 1 - R
+    elif evt == Draw.MIDDLEMOUSE: G = 1 - G
+    elif evt == Draw.RIGHTMOUSE: B = 1 - B
+    elif evt == Draw.WHEELUPMOUSE:
+      R += 0.1
+      if R > 1: R = 1
+    elif evt == Draw.WHEELDOWNMOUSE:
+      R -= 0.1
+      if R < 0: R = 0
+    else:
+      return                             # don't redraw if nothing changed
+    Draw.Redraw(1)                       # make changes visible.
+  #
+  Draw.Register(show_win, ev, None)      # start the main loop
+
+ at note: you can use the L{Image} module and L{Image.Image} BPy object to load
+    and set textures.  See L{Image.Image.glLoad} and L{Image.Image.glFree},
+    for example.
+ at see: U{www.opengl.org}
+ at see: U{nehe.gamedev.net}
+"""
+
+def glAccum(op, value):
+  """
+  Operate on the accumulation buffer
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html}
+
+  @type op: Enumerated constant
+  @param op: The accumulation buffer operation. 
+  @type value: float
+  @param value: a value used in the accumulation buffer operation.
+  """
+
+def glAlphaFunc(func, ref):
+  """
+  Specify the alpha test function
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html}
+  
+  @type func: Enumerated constant
+  @param func: Specifies the alpha comparison function. 
+  @type ref: float
+  @param ref: The reference value that incoming alpha values are compared to. 
+  Clamped between 0 and 1.
+  """
+
+def glAreTexturesResident(n, textures, residences):
+  """
+  Determine if textures are loaded in texture memory
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html}
+
+  @type n: int
+  @param n: Specifies the number of textures to be queried.
+  @type textures: Buffer object I{type GL_INT}
+  @param textures: Specifies an array containing the names of the textures to be queried 
+  @type residences: Buffer object I{type GL_INT}(boolean)
+  @param residences: An array in which the texture residence status in returned.The residence status of a
+  texture named by an element of textures is returned in the corresponding element of residences.
+  """
+
+def glBegin(mode):
+  """
+  Delimit the vertices of a primitive or a group of like primatives
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html}
+
+  @type mode: Enumerated constant
+  @param mode: Specifies the primitive that will be create from vertices between glBegin and
+  glEnd. 
+  """
+
+def glBindTexture(target, texture):
+  """
+  Bind a named texture to a texturing target
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html}
+
+  @type target: Enumerated constant
+  @param target: Specifies the target to which the texture is bound. 
+  @type texture: unsigned int
+  @param texture: Specifies the name of a texture.
+  """
+
+def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap):
+  """
+  Draw a bitmap
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html}
+
+  @type width, height: int
+  @param width, height: Specify the pixel width and height of the bitmap image.
+  @type xorig, yorig: float
+  @param 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.
+  @type xmove, ymove: float
+  @param xmove, ymove: Specify the x and y offsets to be added to the current raster position after 
+  the bitmap is drawn. 
+  @type bitmap: Buffer object I{type GL_BYTE}
+  @param bitmap: Specifies the address of the bitmap image. 
+  """
+
+def glBlendFunc(sfactor, dfactor):
+  """
+  Specify pixel arithmetic
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html}
+
+  @type sfactor: Enumerated constant
+  @param sfactor: Specifies how the red, green, blue, and alpha source blending factors are 
+  computed. 
+  @type dfactor: Enumerated constant
+  @param dfactor: Specifies how the red, green, blue, and alpha destination blending factors are 
+  computed. 
+  """
+
+def glCallList(list):
+  """
+  Execute a display list
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html}
+
+  @type list: unsigned int
+  @param list: Specifies the integer name of the display list to be executed.
+  """
+
+def glCallLists(n, type, lists):
+  """
+  Execute a list of display lists
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html}
+
+  @type n: int
+  @param n: Specifies the number of display lists to be executed. 
+  @type type: Enumerated constant
+  @param type: Specifies the type of values in lists. 
+  @type lists: Buffer object
+  @param lists: Specifies the address of an array of name offsets in the display list. 
+  The pointer type is void because the offsets can be bytes, shorts, ints, or floats, 
+  depending on the value of type.
+  """
+
+def glClear(mask):
+  """
+  Clear buffers to preset values
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html}
+
+  @type mask: Enumerated constant(s)
+  @param mask: Bitwise OR of masks that indicate the buffers to be cleared. 
+  """
+
+def glClearAccum(red, green, blue, alpha):
+  """
+  Specify clear values for the accumulation buffer
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html}
+
+  @type red, green, blue, alpha: float
+  @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the 
+  accumulation buffer is cleared. The initial values are all 0. 
+  """
+
+def glClearColor(red, green, blue, alpha):
+  """
+  Specify clear values for the color buffers
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html}
+
+  @type red, green, blue, alpha: float
+  @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the 
+  color buffers are cleared. The initial values are all 0. 
+  """
+
+def glClearDepth(depth):
+  """
+  Specify the clear value for the depth buffer
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html}
+
+  @type depth: int
+  @param depth: Specifies the depth value used when the depth buffer is cleared. 
+  The initial value is 1.  
+  """
+
+def glClearIndex(c):
+  """
+  Specify the clear value for the color index buffers
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html}
+
+  @type c: float
+  @param c: Specifies the index used when the color index buffers are cleared. 
+  The initial value is 0. 
+  """
+
+def glClearStencil(s):
+  """
+  Specify the clear value for the stencil buffer
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html}
+
+  @type s: int
+  @param s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. 
+  """
+
+def glClipPlane (plane, equation):
+  """
+  Specify a plane against which all geometry is clipped
+  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html}
+
+  @type plane: Enumerated constant
+  @param plane: Specifies which clipping plane is being positioned. 
+  @type equation: Buffer object I{type GL_FLOAT}(double)
+  @param equation: Specifies the address of an array of four double- precision floating-point 
+  values. These values are interpreted as a plane equation.
+  """
+
+def glColor (red, green, blue, alpha):
+  """

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list