[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38011] trunk/blender/doc/python_api: add 'bgl' OpenGL doc to sphinx

Campbell Barton ideasman42 at gmail.com
Fri Jul 1 13:16:43 CEST 2011


Revision: 38011
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38011
Author:   campbellbarton
Date:     2011-07-01 11:16:42 +0000 (Fri, 01 Jul 2011)
Log Message:
-----------
add 'bgl' OpenGL doc to sphinx

Modified Paths:
--------------
    trunk/blender/doc/python_api/rst/bgl.rst
    trunk/blender/doc/python_api/sphinx_doc_gen.py

Modified: trunk/blender/doc/python_api/rst/bgl.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bgl.rst	2011-07-01 11:13:26 UTC (rev 38010)
+++ trunk/blender/doc/python_api/rst/bgl.rst	2011-07-01 11:16:42 UTC (rev 38011)
@@ -1,1807 +1,1888 @@
-# Blender.BGL module (OpenGL wrapper)
 
-"""
-The Blender.BGL submodule (the OpenGL wrapper).
+bgl module (OpenGL wrapper)
+===========================
 
-B{New}: some GLU functions: L{gluLookAt}, etc.
+.. module:: bgl
 
-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 
+contents: dir(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
+..note::
+   You can use the :class:`Image` type to load and set textures.
+   See :class:`Image.gl_load` and :class:`Image.gl_load`,
+   for example.
+   `OpenGL.org <http://www.opengl.org>`_
+   `NeHe GameDev <nehe.gamedev.net>`_
 
- 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}
+.. function:: glAccum(op, value):
 
-  @type op: Enumerated constant
-  @param op: The accumulation buffer operation. 
-  @type value: float
-  @param value: a value used in the accumulation buffer operation.
-  """
+   Operate on the accumulation buffer.
 
-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.
-  """
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html>`_
 
-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 op: Enumerated constant
+   :arg op: The accumulation buffer operation.
+   :type value: float
+   :arg value: a value used in the accumulation buffer operation.
 
-  @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}
+.. function:: glAlphaFunc(func, ref):
 
-  @type mode: Enumerated constant
-  @param mode: Specifies the primitive that will be create from vertices between glBegin and
-  glEnd. 
-  """
+   Specify the alpha test function.
 
-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}
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.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.
-  """
+   :type func: Enumerated constant
+   :arg func: Specifies the alpha comparison function.
+   :type ref: float
+   :arg ref: The reference value that incoming alpha values are compared to.
+      Clamped between 0 and 1.
 
-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. 
-  """
+.. function:: glAreTexturesResident(n, textures, residences):
 
-def glBlendFunc(sfactor, dfactor):
-  """
-  Specify pixel arithmetic
-  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html}
+   Determine if textures are loaded in texture memory
 
-  @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. 
-  """
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.html>`_
 
-def glCallList(list):
-  """
-  Execute a display list
-  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html}
+   :type n: int
+   :arg n: Specifies the number of textures to be queried.
+   :type textures: :class:`Buffer` object I{type GL_INT}
+   :arg textures: Specifies an array containing the names of the textures to be queried
+   :type residences: :class:`Buffer` object I{type GL_INT}(boolean)
+   :arg 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.
 
-  @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}
+.. function:: glBegin(mode):
 
-  @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.
-  """
+   Delimit the vertices of a primitive or a group of like primatives
 
-def glClear(mask):
-  """
-  Clear buffers to preset values
-  @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html}
+   .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html>`_
 
-  @type mask: Enumerated constant(s)
-  @param mask: Bitwise OR of masks that indicate the buffers to be cleared. 
-  """
+   :type mode: Enumerated constant
+   :arg mode: Specifies the primitive that will be create from vertices between glBegin and
+      glEnd.
 
-def glClearAccum(red, green, blue, alpha):
-  """

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list