diff options
Diffstat (limited to 'doc')
26 files changed, 3267 insertions, 1939 deletions
diff --git a/doc/blender_file_format/BlendFileDnaExporter_25.py b/doc/blender_file_format/BlendFileDnaExporter_25.py index afc58ce6730..988c992fd78 100755 --- a/doc/blender_file_format/BlendFileDnaExporter_25.py +++ b/doc/blender_file_format/BlendFileDnaExporter_25.py @@ -13,8 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ***** END GPL LICENCE BLOCK ***** diff --git a/doc/blender_file_format/BlendFileReader.py b/doc/blender_file_format/BlendFileReader.py index 7003af10ac7..313c8c7ff5d 100644 --- a/doc/blender_file_format/BlendFileReader.py +++ b/doc/blender_file_format/BlendFileReader.py @@ -13,8 +13,8 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # ***** END GPL LICENCE BLOCK ***** diff --git a/doc/doxygen/Doxyfile b/doc/doxygen/Doxyfile index 89dcf834227..79b3f1a4160 100644 --- a/doc/doxygen/Doxyfile +++ b/doc/doxygen/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = Blender # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = "V2.57" +PROJECT_NUMBER = "V2.58" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer diff --git a/doc/doxygen/doxygen.source b/doc/doxygen/doxygen.source index ccdf3448f18..375234d26a3 100644 --- a/doc/doxygen/doxygen.source +++ b/doc/doxygen/doxygen.source @@ -145,10 +145,6 @@ * merged in docs. */ -/** \defgroup blo readblenfile - * \ingroup blender data - */ - /** \defgroup quicktime quicktime * \ingroup blender diff --git a/doc/manpage/blender.1 b/doc/manpage/blender.1 index c27cc98f08b..ddf3a79b104 100644 --- a/doc/manpage/blender.1 +++ b/doc/manpage/blender.1 @@ -1,4 +1,4 @@ -.TH "BLENDER" "1" "April 05, 2011" "Blender Blender 2\&.56 (sub 6)" +.TH "BLENDER" "1" "June 03, 2011" "Blender Blender 2\&.57 (sub 1)" .SH NAME blender \- a 3D modelling and rendering package @@ -15,7 +15,7 @@ Use Blender to create TV commercials, to make technical visualizations, business http://www.blender.org .SH OPTIONS -Blender 2.56 (sub 6) +Blender 2.57 (sub 1) Usage: blender [args ...] [file] [args ...] .br .SS "Render Options:" @@ -160,6 +160,12 @@ Force opening without borders Open with lower left corner at <sx>, <sy> and width and height as <w>, <h> .br +.TP +.B \-con or \-\-start\-console +.br +Start with the console window open (ignored if \-b is set) +.br + .IP .SS "Game Engine Specific Options:" @@ -191,7 +197,7 @@ Turn debugging on .br * Disables mouse grab (to interact with a debugger in some cases) .br -* Keeps python sys.stdin rather then setting it to None +* Keeps python sys.stdin rather than setting it to None .br .TP @@ -211,12 +217,6 @@ Skip reading the "startup.blend" in the users home directory .IP .TP -.B \-\-env\-system\-config -.br -Set the BLENDER_SYSTEM_CONFIG environment variable -.br - -.TP .B \-\-env\-system\-datafiles .br Set the BLENDER_SYSTEM_DATAFILES environment variable @@ -281,7 +281,7 @@ Print this help text and exit .TP .B \-y or \-\-enable\-autoexec .br -Enable automatic python script execution (default) +Enable automatic python script execution, (default) .br .TP @@ -376,7 +376,6 @@ Arguments are executed in the order they are given. eg .br .SH "ENVIRONMENT VARIABLES" \fIBLENDER_USER_CONFIG\fR Directory for user configuration files. - \fIBLENDER_SYSTEM_CONFIG\fR Directory for system wide configuration files. \fIBLENDER_USER_SCRIPTS\fR Directory for user scripts. \fIBLENDER_SYSTEM_SCRIPTS\fR Directory for system wide scripts. \fIBLENDER_USER_DATAFILES\fR Directory for user data files (icons, translations, ..). diff --git a/doc/python_api/blender-org/layout.html b/doc/python_api/blender-org/layout.html index a37ed730c22..88db31e1586 100644 --- a/doc/python_api/blender-org/layout.html +++ b/doc/python_api/blender-org/layout.html @@ -8,7 +8,7 @@ {%- macro relbar() %} <div class="subnav boxheader"> - <ul class="noprint"><li><a href="http://www.blender.org/development/coding-guides/">Coding Guides</a></li><li>•</li><li><a href="http://www.blender.org/development/report-a-bug/">Report a Bug</a></li><li>•</li><li><a href="http://www.blender.org/development/submit-a-patch/">Submit a Patch</a></li><li>•</li><li><a href="http://www.blender.org/development/release-logs/">Release Logs</a></li><li>•</li><li><a href="http://www.blender.org/development/current-projects/">Current Projects</a></li><li>•</li><li><a href="http://www.blender.org/development/architecture/">Architecture</a></li><li>•</li><li><a href="http://www.blender.org/development/building-blender/">Building Blender</a></li><li>•</li><li class="subnav-active"><a href="http://www.blender.org/documentation/250PythonDoc/contents.html">PyAPI</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Main_Page">Wiki</a></li></ul> + <ul class="noprint"><li><a href="http://wiki.blender.org/index.php/Dev:Contents">Documentation</a></li><li>•</li><li><a href="http://www.blender.org/development/report-a-bug/">Report a Bug</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Dev:Doc/Process/Patches">Submit a Patch</a></li><li>•</li><li><a href="http://www.blender.org/development/release-logs/">Release Logs</a></li><li>•</li><li><a href="http://www.blender.org/development/building-blender/">Building Blender</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Dev:Doc/Projects">Current Projects</a></li><li>•</li><li><a href="http://wiki.blender.org/index.php/Dev:Source/Architecture">Architecture</a></li><li>•</li><li><a href="http://www.blender.org/documentation/250PythonDoc/contents.html">Python API</a></li><li>•</li><li><a href="http://wiki.blender.org">Wiki</a></li></ul> </div> <div class="related subnav"> <h3>{{ _('Navigation') }}</h3> diff --git a/doc/python_api/epy/BGL.py b/doc/python_api/epy/BGL.py deleted file mode 100644 index ce148dc72ba..00000000000 --- a/doc/python_api/epy/BGL.py +++ /dev/null @@ -1,1807 +0,0 @@ -# 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 - -@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. -@see: U{www.opengl.org} -@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): - """ - B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, - glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, - glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, - glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, - glColor4uiv, glColor4usv} - - Set a new color. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html} - - @type red, green, blue, alpha: Depends on function prototype. - @param red, green, blue: Specify new red, green, and blue values for the current color. - @param alpha: Specifies a new alpha value for the current color. Included only in the - four-argument glColor4 commands. (With '4' colors only) - """ - -def glColorMask(red, green, blue, alpha): - """ - Enable and disable writing of frame buffer color components - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html} - - @type red, green, blue, alpha: int (boolean) - @param red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be - written into the frame buffer. The initial values are all GL_TRUE, indicating that the - color components can be written. - """ - -def glColorMaterial(face, mode): - """ - Cause a material color to track the current color - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html} - - @type face: Enumerated constant - @param face: Specifies whether front, back, or both front and back material parameters should - track the current color. - @type mode: Enumerated constant - @param mode: Specifies which of several material parameters track the current color. - """ - -def glCopyPixels(x, y, width, height, type): - """ - Copy pixels in the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html} - - @type x, y: int - @param x, y: Specify the window coordinates of the lower left corner of the rectangular - region of pixels to be copied. - @type width, height: int - @param width,height: Specify the dimensions of the rectangular region of pixels to be copied. - Both must be non-negative. - @type type: Enumerated constant - @param type: Specifies whether color values, depth values, or stencil values are to be copied. - """ - - def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border): - """ - Copy pixels into a 2D texture image - @see: U{www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @type x, y: int - @param x, y:Specify the window coordinates of the first pixel that is copied - from the frame buffer. This location is the lower left corner of a rectangular - block of pixels. - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. - @type height: int - @param height: Specifies the height of the texture image. Must be 2m+2(border) for - some integer m. All implementations support texture images that are at least 64 - texels high. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - """ - -def glCullFace(mode): - """ - Specify whether front- or back-facing facets can be culled - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html} - - @type mode: Enumerated constant - @param mode: Specifies whether front- or back-facing facets are candidates for culling. - """ - -def glDeleteLists(list, range): - """ - Delete a contiguous group of display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html} - - @type list: unsigned int - @param list: Specifies the integer name of the first display list to delete - @type range: int - @param range: Specifies the number of display lists to delete - """ - -def glDeleteTextures(n, textures): - """ - Delete named textures - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html} - - @type n: int - @param n: Specifies the number of textures to be deleted - @type textures: Buffer I{GL_INT} - @param textures: Specifies an array of textures to be deleted - """ - -def glDepthFunc(func): - """ - Specify the value used for depth buffer comparisons - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html} - - @type func: Enumerated constant - @param func: Specifies the depth comparison function. - """ - -def glDepthMask(flag): - """ - Enable or disable writing into the depth buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html} - - @type flag: int (boolean) - @param flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, - depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer - writing is enabled. - """ - -def glDepthRange(zNear, zFar): - """ - Specify mapping of depth values from normalized device coordinates to window coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html} - - @type zNear: int - @param zNear: Specifies the mapping of the near clipping plane to window coordinates. - The initial value is 0. - @type zFar: int - @param zFar: Specifies the mapping of the far clipping plane to window coordinates. - The initial value is 1. - """ - -def glDisable(cap): - """ - Disable server-side GL capabilities - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} - - @type cap: Enumerated constant - @param cap: Specifies a symbolic constant indicating a GL capability. - """ - -def glDrawBuffer(mode): - """ - Specify which color buffers are to be drawn into - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html} - - @type mode: Enumerated constant - @param mode: Specifies up to four color buffers to be drawn into. - """ - -def glDrawPixels(width, height, format, type, pixels): - """ - Write a block of pixels to the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html} - - @type width, height: int - @param width, height: Specify the dimensions of the pixel rectangle to be - written into the frame buffer. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type for pixels. - @type pixels: Buffer object - @param pixels: Specifies a pointer to the pixel data. - """ - -def glEdgeFlag (flag): - """ - B{glEdgeFlag, glEdgeFlagv} - - Flag edges as either boundary or non-boundary - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html} - - @type flag: Depends of function prototype - @param flag: Specifies the current edge flag value.The initial value is GL_TRUE. - """ - -def glEnable(cap): - """ - Enable server-side GL capabilities - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html} - - @type cap: Enumerated constant - @param cap: Specifies a symbolic constant indicating a GL capability. - """ - -def glEnd(): - """ - Delimit the vertices of a primitive or group of like primitives - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html} - """ - -def glEndList(): - """ - Create or replace a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} - """ - -def glEvalCoord (u,v): - """ - B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, - glEvalCoord2dv, glEvalCoord2fv} - - Evaluate enabled one- and two-dimensional maps - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html} - - @type u: Depends on function prototype. - @param u: Specifies a value that is the domain coordinate u to the basis function defined - in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then - u specifies a pointer to an array containing either one or two domain coordinates. The first - coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. - @type v: Depends on function prototype. (only with '2' prototypes) - @param v: Specifies a value that is the domain coordinate v to the basis function defined - in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. - """ - -def glEvalMesh (mode, i1, i2): - """ - B{glEvalMesh1 or glEvalMesh2} - - Compute a one- or two-dimensional grid of points or lines - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html} - - @type mode: Enumerated constant - @param mode: In glEvalMesh1, specifies whether to compute a one-dimensional - mesh of points or lines. - @type i1, i2: int - @param i1, i2: Specify the first and last integer values for the grid domain variable i. - """ - -def glEvalPoint (i, j): - """ - B{glEvalPoint1 and glEvalPoint2} - - Generate and evaluate a single point in a mesh - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html} - - @type i: int - @param i: Specifies the integer value for grid domain variable i. - @type j: int (only with '2' prototypes) - @param j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). - """ - -def glFeedbackBuffer (size, type, buffer): - """ - Controls feedback mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html} - - @type size: int - @param size:Specifies the maximum number of values that can be written into buffer. - @type type: Enumerated constant - @param type:Specifies a symbolic constant that describes the information that - will be returned for each vertex. - @type buffer: Buffer object I{GL_FLOAT} - @param buffer: Returns the feedback data. - """ - -def glFinish(): - """ - Block until all GL execution is complete - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html} - """ - -def glFlush(): - """ - Force Execution of GL commands in finite time - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html} - """ - -def glFog (pname, param): - """ - B{glFogf, glFogi, glFogfv, glFogiv} - - Specify fog parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html} - - @type pname: Enumerated constant - @param pname: Specifies a single-valued fog parameter. If the function prototype - ends in 'v' specifies a fog parameter. - @type param: Depends on function prototype. - @param param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR - requires an array of four values. All other parameters accept an array containing - only a single value. - """ - -def glFrontFace(mode): - """ - Define front- and back-facing polygons - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html} - - @type mode: Enumerated constant - @param mode: Specifies the orientation of front-facing polygons. - """ - -def glFrustum(left, right, bottom, top, zNear, zFar): - """ - Multiply the current matrix by a perspective matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html} - - @type left, right: double (float) - @param left, right: Specify the coordinates for the left and right vertical - clipping planes. - @type top, bottom: double (float) - @param top, bottom: Specify the coordinates for the bottom and top horizontal - clipping planes. - @type zNear, zFar: double (float) - @param zNear, zFar: Specify the distances to the near and far depth clipping planes. - Both distances must be positive. - """ - -def glGenLists(range): - """ - Generate a contiguous set of empty display lists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html} - - @type range: int - @param range: Specifies the number of contiguous empty display lists to be generated. - """ - -def glGenTextures(n, textures): - """ - Generate texture names - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html} - - @type n: int - @param n: Specifies the number of textures name to be generated. - @type textures: Buffer object I{type GL_INT} - @param textures: Specifies an array in which the generated textures names are stored. - """ - -def glGet (pname, param): - """ - B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} - - Return the value or values of a selected parameter - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html} - - @type pname: Enumerated constant - @param pname: Specifies the parameter value to be returned. - @type param: Depends on function prototype. - @param param: Returns the value or values of the specified parameter. - """ - -def glGetClipPlane(plane, equation): - """ - Return the coefficients of the specified clipping plane - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html} - - @type plane: Enumerated constant - @param plane: Specifies a clipping plane. The number of clipping planes depends on the - implementation, but at least six clipping planes are supported. They are identified by - symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. - @type equation: Buffer object I{type GL_FLOAT} - @param equation: Returns four float (double)-precision values that are the coefficients of the - plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). - """ - -def glGetError(): - """ - Return error information - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html} - """ - -def glGetLight (light, pname, params): - """ - B{glGetLightfv and glGetLightiv} - - Return light source parameter values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html} - - @type light: Enumerated constant - @param light: Specifies a light source. The number of possible lights depends on the - implementation, but at least eight lights are supported. They are identified by symbolic - names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. - @type pname: Enumerated constant - @param pname: Specifies a light source parameter for light. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetMap (target, query, v): - """ - B{glGetMapdv, glGetMapfv, glGetMapiv} - - Return evaluator parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of a map. - @type query: Enumerated constant - @param query: Specifies which parameter to return. - @type v: Buffer object. Depends on function prototype. - @param v: Returns the requested data. - """ - -def glGetMaterial (face, pname, params): - """ - B{glGetMaterialfv, glGetMaterialiv} - - Return material parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html} - - @type face: Enumerated constant - @param face: Specifies which of the two materials is being queried. - representing the front and back materials, respectively. - @type pname: Enumerated constant - @param pname: Specifies the material parameter to return. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetPixelMap (map, values): - """ - B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} - - Return the specified pixel map - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html} - - @type map: Enumerated constant - @param map: Specifies the name of the pixel map to return. - @type values: Buffer object. Depends on function prototype. - @param values: Returns the pixel map contents. - """ - -def glGetPolygonStipple(mask): - """ - Return the polygon stipple pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html} - - @type mask: Buffer object I{type GL_BYTE} - @param mask: Returns the stipple pattern. The initial value is all 1's. - """ - -def glGetString(name): - """ - Return a string describing the current GL connection - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html} - - @type name: Enumerated constant - @param name: Specifies a symbolic constant. - - """ - -def glGetTexEnv (target, pname, params): - """ - B{glGetTexEnvfv, glGetTexEnviv} - - Return texture environment parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html} - - @type target: Enumerated constant - @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a texture environment parameter. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexGen (coord, pname, params): - """ - B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} - - Return texture coordinate generation parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html} - - @type coord: Enumerated constant - @param coord: Specifies a texture coordinate. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the value(s) to be returned. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexImage(target, level, format, type, pixels): - """ - Return a texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html} - - @type target: Enumerated constant - @param target: Specifies which texture is to be obtained. - @type level: int - @param level: Specifies the level-of-detail number of the desired image. - Level 0 is the base image level. Level n is the nth mipmap reduction image. - @type format: Enumerated constant - @param format: Specifies a pixel format for the returned data. - @type type: Enumerated constant - @param type: Specifies a pixel type for the returned data. - @type pixels: Buffer object. - @param pixels: Returns the texture image. Should be a pointer to an array of the - type specified by type - """ - -def glGetTexLevelParameter (target, level, pname, params): - """ - B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} - - return texture parameter values for a specific level of detail - @see: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of the target texture. - @type level: int - @param level: Specifies the level-of-detail number of the desired image. - Level 0 is the base image level. Level n is the nth mipmap reduction image. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a texture parameter. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the requested data. - """ - -def glGetTexParameter (target, pname, params): - """ - B{glGetTexParameterfv, glGetTexParameteriv} - - Return texture parameter values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html} - - @type target: Enumerated constant - @param target: Specifies the symbolic name of the target texture. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name the target texture. - @type params: Buffer object. Depends on function prototype. - @param params: Returns the texture parameters. - """ - -def glHint(target, mode): - """ - Specify implementation-specific hints - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html} - - @type target: Enumerated constant - @param target: Specifies a symbolic constant indicating the behavior to be - controlled. - @type mode: Enumerated constant - @param mode: Specifies a symbolic constant indicating the desired behavior. - """ - -def glIndex (c): - """ - B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} - - Set the current color index - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html} - - @type c: Buffer object. Depends on function prototype. - @param c: Specifies a pointer to a one element array that contains the new value for - the current color index. - """ - -def glInitNames(): - """ - Initialize the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html} - """ - -def glIsEnabled(cap): - """ - Test whether a capability is enabled - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html} - - @type cap: Enumerated constant - @param cap: Specifies a constant representing a GL capability. - """ - -def glIsList(list): - """ - Determine if a name corresponds to a display-list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html} - - @type list: unsigned int - @param list: Specifies a potential display-list name. - """ - -def glIsTexture(texture): - """ - Determine if a name corresponds to a texture - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html} - - @type texture: unsigned int - @param texture: Specifies a value that may be the name of a texture. - """ - -def glLight (light, pname, param): - """ - B{glLightf,glLighti, glLightfv, glLightiv} - - Set the light source parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html} - - @type light: Enumerated constant - @param light: Specifies a light. The number of lights depends on the implementation, - but at least eight lights are supported. They are identified by symbolic names of the - form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. - @type pname: Enumerated constant - @param pname: Specifies a single-valued light source parameter for light. - @type param: Depends on function prototype. - @param param: Specifies the value that parameter pname of light source light will be set to. - If function prototype ends in 'v' specifies a pointer to the value or values that - parameter pname of light source light will be set to. - """ - -def glLightModel (pname, param): - """ - B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} - - Set the lighting model parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html} - - @type pname: Enumerated constant - @param pname: Specifies a single-value light model parameter. - @type param: Depends on function prototype. - @param param: Specifies the value that param will be set to. If function prototype ends in 'v' - specifies a pointer to the value or values that param will be set to. - """ - -def glLineStipple(factor, pattern): - """ - Specify the line stipple pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html} - - @type factor: int - @param factor: Specifies a multiplier for each bit in the line stipple pattern. - If factor is 3, for example, each bit in the pattern is used three times before - the next bit in the pattern is used. factor is clamped to the range [1, 256] and - defaults to 1. - @type pattern: unsigned short int - @param pattern: Specifies a 16-bit integer whose bit pattern determines which fragments - of a line will be drawn when the line is rasterized. Bit zero is used first; the default - pattern is all 1's. - """ - -def glLineWidth(width): - """ - Specify the width of rasterized lines. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html} - - @type width: float - @param width: Specifies the width of rasterized lines. The initial value is 1. - """ - -def glListBase(base): - """ - Set the display-list base for glCallLists - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html} - - @type base: unsigned int - @param base: Specifies an integer offset that will be added to glCallLists - offsets to generate display-list names. The initial value is 0. - """ - -def glLoadIdentity(): - """ - Replace the current matrix with the identity matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html} - """ - -def glLoadMatrix (m): - """ - B{glLoadMatrixd, glLoadMatixf} - - Replace the current matrix with the specified matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html} - - @type m: Buffer object. Depends on function prototype. - @param m: Specifies a pointer to 16 consecutive values, which are used as the elements - of a 4x4 column-major matrix. - """ - -def glLoadName(name): - """ - Load a name onto the name stack. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html} - - @type name: unsigned int - @param name: Specifies a name that will replace the top value on the name stack. - """ - -def glLogicOp(opcode): - """ - Specify a logical pixel operation for color index rendering - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html} - - @type opcode: Enumerated constant - @param opcode: Specifies a symbolic constant that selects a logical operation. - """ - -def glMap1 (target, u1, u2, stride, order, points): - """ - B{glMap1d, glMap1f} - - Define a one-dimensional evaluator - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html} - - @type target: Enumerated constant - @param target: Specifies the kind of values that are generated by the evaluator. - @type u1, u2: Depends on function prototype. - @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t - he variable that is evaluated by the equations specified by this command. - @type stride: int - @param stride: Specifies the number of floats or float (double)s between the beginning - of one control point and the beginning of the next one in the data structure - referenced in points. This allows control points to be embedded in arbitrary data - structures. The only constraint is that the values for a particular control point must - occupy contiguous memory locations. - @type order: int - @param order: Specifies the number of control points. Must be positive. - @type points: Buffer object. Depends on function prototype. - @param points: Specifies a pointer to the array of control points. - """ - -def glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points): - """ - B{glMap2d, glMap2f} - - Define a two-dimensional evaluator - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html} - - @type target: Enumerated constant - @param target: Specifies the kind of values that are generated by the evaluator. - @type u1, u2: Depends on function prototype. - @param u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t - he variable that is evaluated by the equations specified by this command. Initially - u1 is 0 and u2 is 1. - @type ustride: int - @param ustride: Specifies the number of floats or float (double)s between the beginning - of control point R and the beginning of control point R ij, where i and j are the u - and v control point indices, respectively. This allows control points to be embedded - in arbitrary data structures. The only constraint is that the values for a particular - control point must occupy contiguous memory locations. The initial value of ustride is 0. - @type uorder: int - @param uorder: Specifies the dimension of the control point array in the u axis. - Must be positive. The initial value is 1. - @type v1, v2: Depends on function prototype. - @param v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, to ^, - one of the two variables that are evaluated by the equations specified by this command. - Initially, v1 is 0 and v2 is 1. - @type vstride: int - @param vstride: Specifies the number of floats or float (double)s between the beginning of control - point R and the beginning of control point R ij, where i and j are the u and v control - point(indices, respectively. This allows control points to be embedded in arbitrary data - structures. The only constraint is that the values for a particular control point must - occupy contiguous memory locations. The initial value of vstride is 0. - @type vorder: int - @param vorder: Specifies the dimension of the control point array in the v axis. - Must be positive. The initial value is 1. - @type points: Buffer object. Depends on function prototype. - @param points: Specifies a pointer to the array of control points. - """ - -def glMapGrid (un, u1,u2 ,vn, v1, v2): - """ - B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} - - Define a one- or two-dimensional mesh - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html} - - @type un: int - @param un: Specifies the number of partitions in the grid range interval - [u1, u2]. Must be positive. - @type u1, u2: Depends on function prototype. - @param u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. - @type vn: int - @param vn: Specifies the number of partitions in the grid range interval [v1, v2] - (glMapGrid2 only). - @type v1, v2: Depends on function prototype. - @param v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn - (glMapGrid2 only). - """ - -def glMaterial (face, pname, params): - """ - Specify material parameters for the lighting model. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html} - - @type face: Enumerated constant - @param face: Specifies which face or faces are being updated. Must be one of: - @type pname: Enumerated constant - @param pname: Specifies the single-valued material parameter of the face - or faces that is being updated. Must be GL_SHININESS. - @type params: int - @param params: Specifies the value that parameter GL_SHININESS will be set to. - If function prototype ends in 'v' specifies a pointer to the value or values that - pname will be set to. - """ - -def glMatrixMode(mode): - """ - Specify which matrix is the current matrix. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html} - - @type mode: Enumerated constant - @param mode: Specifies which matrix stack is the target for subsequent matrix operations. - """ - -def glMultMatrix (m): - """ - B{glMultMatrixd, glMultMatrixf} - - Multiply the current matrix with the specified matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html} - - @type m: Buffer object. Depends on function prototype. - @param m: Points to 16 consecutive values that are used as the elements of a 4x4 column - major matrix. - """ - -def glNewList(list, mode): - """ - Create or replace a display list - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html} - - @type list: unsigned int - @param list: Specifies the display list name - @type mode: Enumerated constant - @param mode: Specifies the compilation mode. - """ - -def glNormal3 (nx, ny, nz, v): - """ - B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, - Normal3s, Normal3sv} - - Set the current normal vector - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html} - - @type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) - @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. - The initial value of the current normal is the unit vector, (0, 0, 1). - @type v: Buffer object. Depends on function prototype. ('v' prototypes) - @param v: Specifies a pointer to an array of three elements: the x, y, and z coordinates - of the new current normal. - """ - -def glOrtho(left, right, bottom, top, zNear, zFar): - """ - Multiply the current matrix with an orthographic matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html} - - @type left, right: double (float) - @param left, right: Specify the coordinates for the left and - right vertical clipping planes. - @type bottom, top: double (float) - @param bottom, top: Specify the coordinates for the bottom and top - horizontal clipping planes. - @type zNear, zFar: double (float) - @param zNear, zFar: Specify the distances to the nearer and farther - depth clipping planes. These values are negative if the plane is to be behind the viewer. - """ - -def glPassThrough(token): - """ - Place a marker in the feedback buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html} - - @type token: float - @param token: Specifies a marker value to be placed in the feedback - buffer following a GL_PASS_THROUGH_TOKEN. - """ - -def glPixelMap (map, mapsize, values): - """ - B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} - - Set up pixel transfer maps - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html} - - @type map: Enumerated constant - @param map: Specifies a symbolic map name. - @type mapsize: int - @param mapsize: Specifies the size of the map being defined. - @type values: Buffer object. Depends on function prototype. - @param values: Specifies an array of mapsize values. - """ - -def glPixelStore (pname, param): - """ - B{glPixelStoref, glPixelStorei} - - Set pixel storage modes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html} - - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the parameter to be set. - Six values affect the packing of pixel data into memory. - Six more affect the unpacking of pixel data from memory. - @type param: Depends on function prototype. - @param param: Specifies the value that pname is set to. - """ - -def glPixelTransfer (pname, param): - """ - B{glPixelTransferf, glPixelTransferi} - - Set pixel transfer modes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html} - - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the pixel transfer parameter to be set. - @type param: Depends on function prototype. - @param param: Specifies the value that pname is set to. - """ - -def glPixelZoom(xfactor, yfactor): - """ - Specify the pixel zoom factors - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html} - - @type xfactor, yfactor: float - @param xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. - """ - -def glPointSize(size): - """ - Specify the diameter of rasterized points - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html} - - @type size: float - @param size: Specifies the diameter of rasterized points. The initial value is 1. - """ - -def glPolygonMode(face, mode): - """ - Select a polygon rasterization mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html} - - @type face: Enumerated constant - @param face: Specifies the polygons that mode applies to. - Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing polygons, - or GL_FRONT_AND_BACK for front- and back-facing polygons. - @type mode: Enumerated constant - @param mode: Specifies how polygons will be rasterized. - The initial value is GL_FILL for both front- and back- facing polygons. - """ - -def glPolygonOffset(factor, units): - """ - Set the scale and units used to calculate depth values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html} - - @type factor: float - @param factor: Specifies a scale factor that is used to create a variable depth - offset for each polygon. The initial value is 0. - @type units: float - @param units: Is multiplied by an implementation-specific value to create a constant - depth offset. The initial value is 0. - """ - -def glPolygonStipple(mask): - """ - Set the polygon stippling pattern - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html} - - @type mask: Buffer object I{type GL_BYTE} - @param mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked - from memory in the same way that glDrawPixels unpacks pixels. - """ - -def glPopAttrib(): - """ - Pop the server attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} - """ - -def glPopClientAttrib(): - """ - Pop the client attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} - """ - -def glPopMatrix(): - """ - Pop the current matrix stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} - """ - -def glPopName(): - """ - Pop the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} - """ - -def glPrioritizeTextures(n, textures, priorities): - """ - Set texture residence priority - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html} - - @type n: int - @param n:Specifies the number of textures to be prioritized. - @type textures: Buffer I{type GL_INT} - @param textures: Specifies an array containing the names of the textures to be prioritized. - @type priorities: Buffer I{type GL_FLOAT} - @param priorities: Specifies an array containing the texture priorities. A priority given - in an element of priorities applies to the texture named by the corresponding element of textures. - """ - -def glPushAttrib(mask): - """ - Push the server attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html} - - @type mask: Enumerated constant(s) - @param mask: Specifies a mask that indicates which attributes to save. - """ - -def glPushClientAttrib(mask): - """ - Push the client attribute stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html} - - @type mask: Enumerated constant(s) - @param mask: Specifies a mask that indicates which attributes to save. - """ - -def glPushMatrix(): - """ - Push the current matrix stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html} - """ - -def glPushName(name): - """ - Push the name stack - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html} - - @type name: unsigned int - @param name: Specifies a name that will be pushed onto the name stack. - """ - -def glRasterPos (x,y,z,w): - """ - B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, - glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, - glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, - glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, - glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} - - Specify the raster position for pixel operations - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html} - - @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) - @param x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the - raster position. If function prototype ends in 'v' specifies a pointer to an array of two, - three, or four elements, specifying x, y, z, and w coordinates, respectively. - @note: - If you are drawing to the 3d view with a Scriptlink of a space handler - the zoom level of the panels will scale the glRasterPos by the view matrix. - so a X of 10 will not always offset 10 pixels as you would expect. - - To work around this get the scale value of the view matrix and use it to scale your pixel values. - - Workaround:: - - import Blender - from Blender.BGL import * - xval, yval= 100, 40 - # Get the scale of the view matrix - viewMatrix = Buffer(GL_FLOAT, 16) - glGetFloatv(GL_MODELVIEW_MATRIX, viewMatrix) - f = 1/viewMatrix[0] - glRasterPos2f(xval*f, yval*f) # Instead of the usual glRasterPos2i(xval, yval) - """ - -def glReadBuffer(mode): - """ - Select a color buffer source for pixels. - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html} - - @type mode: Enumerated constant - @param mode: Specifies a color buffer. - """ - -def glReadPixels(x, y, width, height, format, type, pixels): - """ - Read a block of pixels from the frame buffer - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html} - - @type x, y: int - @param x, y:Specify the window coordinates of the first pixel that is read - from the frame buffer. This location is the lower left corner of a rectangular - block of pixels. - @type width, height: int - @param width, height: Specify the dimensions of the pixel rectangle. width and - height of one correspond to a single pixel. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object - @param pixels: Returns the pixel data. - """ - -def glRect (x1,y1,x2,y2,v1,v2): - """ - B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} - - Draw a rectangle - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html} - - @type x1, y1: Depends on function prototype. (for non 'v' prototypes only) - @param x1, y1: Specify one vertex of a rectangle - @type x2, y2: Depends on function prototype. (for non 'v' prototypes only) - @param x2, y2: Specify the opposite vertex of the rectangle - @type v1, v2: Depends on function prototype. (for 'v' prototypes only) - @param v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer - to the opposite vertex of the rectangle - """ - -def glRenderMode(mode): - """ - Set rasterization mode - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html} - - @type mode: Enumerated constant - @param mode: Specifies the rasterization mode. - """ - -def glRotate (angle, x, y, z): - """ - B{glRotated, glRotatef} - - Multiply the current matrix by a rotation matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html} - - @type angle: Depends on function prototype. - @param angle: Specifies the angle of rotation in degrees. - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify the x, y, and z coordinates of a vector respectively. - """ - -def glScale (x,y,z): - """ - B{glScaled, glScalef} - - Multiply the current matrix by a general scaling matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html} - - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify scale factors along the x, y, and z axes, respectively. - """ - -def glScissor(x,y,width,height): - """ - Define the scissor box - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html} - - @type x, y: int - @param x, y: Specify the lower left corner of the scissor box. Initially (0, 0). - @type width, height: int - @param width height: Specify the width and height of the scissor box. When a - GL context is first attached to a window, width and height are set to the - dimensions of that window. - """ - -def glSelectBuffer(size, buffer): - """ - Establish a buffer for selection mode values - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html} - - @type size: int - @param size: Specifies the size of buffer - @type buffer: Buffer I{type GL_INT} - @param buffer: Returns the selection data - """ - -def glShadeModel(mode): - """ - Select flat or smooth shading - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html} - - @type mode: Enumerated constant - @param mode: Specifies a symbolic value representing a shading technique. - """ - -def glStencilFuc(func, ref, mask): - """ - Set function and reference value for stencil testing - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html} - - @type func: Enumerated constant - @param func:Specifies the test function. - @type ref: int - @param ref:Specifies the reference value for the stencil test. ref is clamped to - the range [0,2n-1], where n is the number of bitplanes in the stencil buffer. - The initial value is 0. - @type mask: unsigned int - @param mask:Specifies a mask that is ANDed with both the reference value and - the stored stencil value when the test is done. The initial value is all 1's. - """ - -def glStencilMask(mask): - """ - Control the writing of individual bits in the stencil planes - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html} - - @type mask: unsigned int - @param mask: Specifies a bit mask to enable and disable writing of individual bits - in the stencil planes. Initially, the mask is all 1's. - """ - -def glStencilOp(fail, zfail, zpass): - """ - Set stencil test actions - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html} - - @type fail: Enumerated constant - @param fail: Specifies the action to take when the stencil test fails. - The initial value is GL_KEEP. - @type zfail: Enumerated constant - @param zfail: Specifies the stencil action when the stencil test passes, but the - depth test fails. zfail accepts the same symbolic constants as fail. - The initial value is GL_KEEP. - @type zpass: Enumerated constant - @param zpass: Specifies the stencil action when both the stencil test and the - depth test pass, or when the stencil test passes and either there is no depth - buffer or depth testing is not enabled. zpass accepts the same symbolic constants - as fail. The initial value is GL_KEEP. - """ - -def glTexCoord (s,t,r,q,v): - """ - B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, - glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, - glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, - glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, - glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, - glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} - - Set the current texture coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html} - - @type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) - @param s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are - present in all forms of the command. - @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only) - @param v: Specifies a pointer to an array of one, two, three, or four elements, - which in turn specify the s, t, r, and q texture coordinates. - """ - -def glTexEnv (target, pname, param): - """ - B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} - - Set texture environment parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html} - - @type target: Enumerated constant - @param target: Specifies a texture environment. Must be GL_TEXTURE_ENV. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a single-valued texture environment - parameter. Must be GL_TEXTURE_ENV_MODE. - @type param: Depends on function prototype. - @param param: Specifies a single symbolic constant. If function prototype ends in 'v' - specifies a pointer to a parameter array that contains either a single symbolic - constant or an RGBA color - """ - -def glTexGen (coord, pname, param): - """ - B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} - - Control the generation of texture coordinates - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html} - - @type coord: Enumerated constant - @param coord: Specifies a texture coordinate. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of the texture- coordinate generation function. - @type param: Depends on function prototype. - @param param: Specifies a single-valued texture generation parameter. - If function prototype ends in 'v' specifies a pointer to an array of texture - generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must - contain a single symbolic constant. Otherwise, params holds the coefficients - for the texture-coordinate generation function specified by pname. - """ - -def glTexImage1D(target, level, internalformat, width, border, format, type, pixels): - """ - Specify a one-dimensional texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. The height of the 1D texture image is 1. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object. - @param pixels: Specifies a pointer to the image data in memory. - """ - -def glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels): - """ - Specify a two-dimensional texture image - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type level: int - @param level: Specifies the level-of-detail number. Level 0 is the base image level. - Level n is the nth mipmap reduction image. - @type internalformat: int - @param internalformat: Specifies the number of color components in the texture. - @type width: int - @param width: Specifies the width of the texture image. Must be 2n+2(border) for - some integer n. All implementations support texture images that are at least 64 - texels wide. - @type height: int - @param height: Specifies the height of the texture image. Must be 2m+2(border) for - some integer m. All implementations support texture images that are at least 64 - texels high. - @type border: int - @param border: Specifies the width of the border. Must be either 0 or 1. - @type format: Enumerated constant - @param format: Specifies the format of the pixel data. - @type type: Enumerated constant - @param type: Specifies the data type of the pixel data. - @type pixels: Buffer object. - @param pixels: Specifies a pointer to the image data in memory. - """ - -def glTexParameter (target, pname, param): - """ - B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} - - Set texture parameters - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html} - - @type target: Enumerated constant - @param target: Specifies the target texture. - @type pname: Enumerated constant - @param pname: Specifies the symbolic name of a single-valued texture parameter. - @type param: Depends on function prototype. - @param param: Specifies the value of pname. If function prototype ends in 'v' specifies - a pointer to an array where the value or values of pname are stored. - """ - -def glTranslate (x, y, z): - """ - B{glTranslatef, glTranslated} - - Multiply the current matrix by a translation matrix - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html} - - @type x, y, z: Depends on function prototype. - @param x, y, z: Specify the x, y, and z coordinates of a translation vector. - """ - -def glVertex (x,y,z,w,v): - """ - B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, - glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, - glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, - glVertex4fv, glVertex4iv, glVertex4sv} - - Specify a vertex - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html} - - @type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) - @param x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters - are present in all forms of the command. - @type v: Buffer object. Depends of function prototype (for 'v' prototypes only) - @param v: Specifies a pointer to an array of two, three, or four elements. The - elements of a two-element array are x and y; of a three-element array, x, y, and z; - and of a four-element array, x, y, z, and w. - """ - -def glViewport(x,y,width,height): - """ - Set the viewport - @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html} - - @type x, y: int - @param x, y: Specify the lower left corner of the viewport rectangle, - in pixels. The initial value is (0,0). - @type width, height: int - @param width, height: Specify the width and height of the viewport. When a GL context - is first attached to a window, width and height are set to the dimensions of that window. - """ - -def gluPerspective(fovY, aspect, zNear, zFar): - """ - Set up a perspective projection matrix. - @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} - - @type fovY: double - @param fovY: Specifies the field of view angle, in degrees, in the y direction. - @type aspect: double - @param aspect: Specifies the aspect ratio that determines the field of view in the x direction. - The aspect ratio is the ratio of x (width) to y (height). - @type zNear: double - @param zNear: Specifies the distance from the viewer to the near clipping plane (always positive). - @type zFar: double - @param zFar: Specifies the distance from the viewer to the far clipping plane (always positive). - """ - -def gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz): - """ - Define a viewing transformation - @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} - - @type eyex, eyey, eyez: double - @param eyex, eyey, eyez: Specifies the position of the eye point. - @type centerx, centery, centerz: double - @param centerx, centery, centerz: Specifies the position of the reference point. - @type upx, upy, upz: double - @param upx, upy, upz: Specifies the direction of the up vector. - """ - -def gluOrtho2D(left, right, bottom, top): - """ - Define a 2-D orthographic projection matrix - @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} - - @type left, right: double - @param left, right: Specify the coordinates for the left and right vertical clipping planes. - @type bottom, top: double - @param bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. - """ - -def gluPickMatrix(x, y, width, height, viewport): - """ - Define a picking region - @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} - - @type x, y: double - @param x, y: Specify the center of a picking region in window coordinates. - @type width, height: double - @param width, height: Specify the width and height, respectively, of the picking region in window coordinates. - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport. - """ - -def gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz): - """ - Map object coordinates to window coordinates. - @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} - - @type objx, objy, objz: double - @param objx, objy, objz: Specify the object coordinates. - @type modelMatrix: Buffer object. [double] - @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). - @type projMatrix: Buffer object. [double] - @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport (as from a glGetIntegerv call). - @type winx, winy, winz: Buffer object. [double] - @param winx, winy, winz: Return the computed window coordinates. - """ - -def gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz): - """ - Map object coordinates to window - coordinates. - @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} - - @type winx, winy, winz: double - @param winx, winy, winz: Specify the window coordinates to be mapped. - @type modelMatrix: Buffer object. [double] - @param modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). - @type projMatrix: Buffer object. [double] - @param projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). - @type viewport: Buffer object. [int] - @param viewport: Specifies the current viewport (as from a glGetIntegerv call). - @type objx, objy, objz: Buffer object. [double] - @param objx, objy, objz: Return the computed object coordinates. - """ - -class Buffer: - """ - The Buffer object is simply a block of memory that is delineated and initialized by the - user. Many OpenGL functions return data to a C-style pointer, however, because this - is not possible in python the Buffer object can be used to this end. Wherever pointer - notation is used in the OpenGL functions the Buffer object can be used in it's BGL - wrapper. In some instances the Buffer object will need to be initialized with the template - parameter, while in other instances the user will want to create just a blank buffer - which will be zeroed by default. - - Example with Buffer:: - import Blender - from Blender import BGL - myByteBuffer = BGL.Buffer(BGL.GL_BYTE, [32,32]) - BGL.glGetPolygonStipple(myByteBuffer) - print myByteBuffer.dimensions - print myByteBuffer.list - sliceBuffer = myByteBuffer[0:16] - print sliceBuffer - - @ivar list: The contents of the Buffer. - @ivar dimensions: The size of the Buffer. - """ - - def __init__(type, dimensions, template = None): - """ - This will create a new Buffer object for use with other BGL OpenGL commands. - Only the type of argument to store in the buffer and the dimensions of the buffer - are necessary. Buffers are zeroed by default unless a template is supplied, in - which case the buffer is initialized to the template. - - @type type: int - @param type: The format to store data in. The type should be one of - GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. - @type dimensions: An int or sequence object specifying the dimensions of the buffer. - @param dimensions: If the dimensions are specified as an int a linear array will - be created for the buffer. If a sequence is passed for the dimensions, the buffer - becomes n-Dimensional, where n is equal to the number of parameters passed in the - sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates - a three- dimensional buffer. You can think of each additional dimension as a sub-item - of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. - [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. - @type template: A python sequence object (optional) - @param template: A sequence of matching dimensions which will be used to initialize - the Buffer. If a template is not passed in all fields will be initialized to 0. - @rtype: Buffer object - @return: The newly created buffer as a PyObject. - """ diff --git a/doc/python_api/examples/aud.py b/doc/python_api/examples/aud.py new file mode 100644 index 00000000000..e41e8214cc0 --- /dev/null +++ b/doc/python_api/examples/aud.py @@ -0,0 +1,21 @@ +""" +Basic Sound Playback +++++++++++++++++++++ +This script shows how to use the classes: :class:`Device`, :class:`Factory` and +:class:`Handle`. +""" +import aud + +device = aud.device() +# load sound file (it can be a video file with audio) +factory = aud.Factory('music.ogg') + +# play the audio, this return a handle to control play/pause +handle = device.play(sound) +# if the audio is not too big and will be used often you can buffer it +factory_buffered = aud.Factory.buffer(sound) +handle_buffered = device.play(buffered) + +# stop the sounds (otherwise they play until their ends) +handle.stop() +handle_buffered.stop() diff --git a/doc/python_api/examples/bge.constraints.py b/doc/python_api/examples/bge.constraints.py new file mode 100644 index 00000000000..de2f7e0a39d --- /dev/null +++ b/doc/python_api/examples/bge.constraints.py @@ -0,0 +1,37 @@ +""" +Basic Physics Constraint +++++++++++++++++++++++ +Example of how to create a hinge Physics Constraint between two objects. +""" +from bge import logic +from bge import constraints + +# get object list +objects = logic.getCurrentScene().objects + +# get object named Object1 and Object 2 +object_1 = objects["Object1"] +object_2 = objects["Object2"] + +# want to use Edge constraint type +constraint_type = 2 + +# get Object1 and Object2 physics IDs +physics_id_1 = object_1.getPhysicsId() +physics_id_2 = object_2.getPhysicsId() + +# Use bottom right edge of Object1 for hinge position +edge_position_x = 1.0 +edge_position_y = 0.0 +edge_position_z = -1.0 + +# use Object1 y axis for angle to point hinge +edge_angle_x = 0.0 +edge_angle_y = 1.0 +edge_angle_z = 0.0 + +# create an edge constraint +constraints.createConstraint(physics_id_1, physics_id_2, + constraint_type, + edge_position_x, edge_position_y, edge_position_z, + edge_angle_x, edge_angle_y, edge_angle_z) diff --git a/doc/python_api/examples/bge.texture.1.py b/doc/python_api/examples/bge.texture.1.py new file mode 100644 index 00000000000..faa0ae736e8 --- /dev/null +++ b/doc/python_api/examples/bge.texture.1.py @@ -0,0 +1,39 @@ +""" +Texture replacement +++++++++++++++++++++++ +Example of how to replace a texture in game with an external image. +createTexture() and removeTexture() are to be called from a module Python +Controller. +""" +from bge import logic +from bge import texture + + +def createTexture(cont): + """Create a new Dynamic Texture""" + object = cont.owner + + # get the reference pointer (ID) of the internal texture + ID = texture.materialID(obj, 'IMoriginal.png') + + # create a texture object + object_texture = texture.Texture(object, ID) + + # create a new source with an external image + url = logic.expandPath("//newtexture.jpg") + new_source = texture.ImageFFmpeg(url) + + # the texture has to be stored in a permanent Python object + logic.texture = object_texture + + # update/replace the texture + logic.texture.source = new_source + logic.texture.refresh(False) + + +def removeTexture(cont): + """Delete the Dynamic Texture, reversing back the final to its original state.""" + try: + del logic.texture + except: + pass diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py new file mode 100644 index 00000000000..70e4d6d9377 --- /dev/null +++ b/doc/python_api/examples/bge.texture.py @@ -0,0 +1,32 @@ +""" +Basic Video Playback +++++++++++++++++++++++ +Example of how to replace a texture in game with a video. It needs to run everyframe +""" +import bge +from bge import texture +from bge import logic + +cont = logic.getCurrentController() +obj = cont.owner + +# the creation of the texture must be done once: save the +# texture object in an attribute of bge.logic module makes it persistent +if not hasattr(logic, 'video'): + + # identify a static texture by name + matID = texture.materialID(obj, 'IMvideo.png') + + # create a dynamic texture that will replace the static texture + logic.video = texture.Texture(obj, matID) + + # define a source of image for the texture, here a movie + movie = logic.expandPath('//trailer_400p.ogg') + logic.video.source = texture.VideoFFmpeg(movie) + logic.video.source.scale = True + + # quick off the movie, but it wont play in the background + logic.video.source.play() + +# you need to call this function every frame to ensure update of the texture. +logic.video.refresh(True) diff --git a/doc/python_api/examples/blf.py b/doc/python_api/examples/blf.py new file mode 100644 index 00000000000..f6e87cf488d --- /dev/null +++ b/doc/python_api/examples/blf.py @@ -0,0 +1,44 @@ +""" +Hello World Text Example +++++++++++++++++++++++++ + +Blender Game Engine example of using the blf module. For this module to work we +need to use the OpenGL wrapper :class:`~bgl` as well. +""" +# import game engine modules +from bge import render +from bge import logic +# import stand alone modules +import bgl +import blf + + +def init(): + """init function - runs once""" + # create a new font object, use external ttf file + font_path = logic.expandPath('//Zeyada.ttf') + # store the font indice - to use later + logic.font_id = blf.load(font_path) + + # set the font drawing routine to run every frame + scene = logic.getCurrentScene() + scene.post_draw = [write] + + +def write(): + """write on screen""" + width = render.getWindowWidth() + height = render.getWindowHeight() + + # OpenGL setup + bgl.glMatrixMode(bgl.GL_PROJECTION) + bgl.glLoadIdentity() + bgl.gluOrtho2D(0, width, 0, height) + bgl.glMatrixMode(bgl.GL_MODELVIEW) + bgl.glLoadIdentity() + + # BLF drawing routine + font_id = logic.font_id + blf.position(font_id, (width * 0.2), (height * 0.3), 0) + blf.size(font_id, 50, 72) + blf.draw(font_id, "Hello World") diff --git a/doc/python_api/examples/bpy.props.4.py b/doc/python_api/examples/bpy.props.4.py new file mode 100644 index 00000000000..2b44d94f72a --- /dev/null +++ b/doc/python_api/examples/bpy.props.4.py @@ -0,0 +1,21 @@ +""" +Update Example +++++++++++++++ + +It can be useful to perform an action when a property is changed and can be +used to update other properties or synchronize with external data. + +All properties define update functions except for CollectionProperty. +""" + +import bpy + + +def update_func(self, context): + print("my test function", self) + +bpy.types.Scene.testprop = bpy.props.FloatProperty(update=update_func) + +bpy.context.scene.testprop = 11.0 + +# >>> my test function <bpy_struct, Scene("Scene")> diff --git a/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py b/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py index 43e6ac90ae7..42e2a71cc70 100644 --- a/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py +++ b/doc/python_api/examples/bpy.types.BlendDataLibraries.load.py @@ -21,3 +21,19 @@ with bpy.data.libraries.load(filepath, link=True) as (data_from, data_to): with bpy.data.libraries.load(filepath) as (data_from, data_to): for attr in dir(data_to): setattr(data_to, attr, getattr(data_from, attr)) + + +# the 'data_to' variables lists are +with bpy.data.libraries.load(filepath) as (data_from, data_to): + data_to.scenes = ["Scene"] + + +# the loaded objects can be accessed from 'data_to' outside of the context +# since loading the data replaces the strings for the datablocks or None +# if the datablock could not be loaded. +with bpy.data.libraries.load(filepath) as (data_from, data_to): + data_to.meshes = data_from.meshes +# now operate directly on the loaded data +for mesh in data_to.meshes: + if mesh is not None: + print(mesh.name) diff --git a/doc/python_api/examples/bpy.types.RenderEngine.py b/doc/python_api/examples/bpy.types.RenderEngine.py index 48d642f7602..7af7de1068c 100644 --- a/doc/python_api/examples/bpy.types.RenderEngine.py +++ b/doc/python_api/examples/bpy.types.RenderEngine.py @@ -61,10 +61,10 @@ bpy.utils.register_class(CustomRenderEngine) # Otherwise most of the UI will be empty when the engine is selected. # In this example, we need to see the main render image button and # the material preview panel. -import properties_render +from bl_ui import properties_render properties_render.RENDER_PT_render.COMPAT_ENGINES.add('custom_renderer') del properties_render -import properties_material +from bl_ui import properties_material properties_material.MATERIAL_PT_preview.COMPAT_ENGINES.add('custom_renderer') del properties_material diff --git a/doc/python_api/examples/mathutils.Vector.py b/doc/python_api/examples/mathutils.Vector.py index 880b4ef2590..bf1fc70353f 100644 --- a/doc/python_api/examples/mathutils.Vector.py +++ b/doc/python_api/examples/mathutils.Vector.py @@ -1,15 +1,15 @@ import mathutils # zero length vector -vec = mathutils.Vector((0, 0, 1)) +vec = mathutils.Vector((0.0, 0.0, 1.0)) # unit length vector vec_a = vec.copy().normalize() -vec_b = mathutils.Vector((0, 1, 2)) +vec_b = mathutils.Vector((0.0, 1.0, 2.0)) -vec2d = mathutils.Vector((1, 2)) -vec3d = mathutils.Vector((1, 0, 0)) +vec2d = mathutils.Vector((1.0, 2.0)) +vec3d = mathutils.Vector((1.0, 0.0, 0.0)) vec4d = vec_a.to_4d() # other mathutuls types @@ -34,9 +34,9 @@ vec_a + vec_b vec_a - vec_b vec_a * vec_b vec_a * 10.0 -vec_a * matrix +matrix * vec_a +quat * vec_a vec_a * vec_b -vec_a * quat -vec_a @@ -44,6 +44,7 @@ vec_a * quat x = vec_a[0] len(vec) vec_a[:] = vec_b +vec_a[:] = 1.0, 2.0, 3.0 vec2d[:] = vec3d[:2] diff --git a/doc/python_api/rst/bge.constraints.rst b/doc/python_api/rst/bge.constraints.rst new file mode 100644 index 00000000000..882bbc39b9f --- /dev/null +++ b/doc/python_api/rst/bge.constraints.rst @@ -0,0 +1,199 @@ + +Game Engine bge.constraints Module +================================== + +.. note:: + This documentation is still very weak, and needs some help! + +.. function:: createConstraint([obj1, [obj2, [restLength, [restitution, [damping]]]]]) + + Creates a constraint. + + :arg obj1: first object on Constraint + :type obj1: :class:'bge.types.KX_GameObject' #I think, there is no error when I use one + + :arg obj2: second object on Constraint + :type obj2: :class:'bge.types.KX_GameObject' #too + + :arg restLength: #to be filled + :type restLength: float + + :arg restitution: #to be filled + :type restitution: float + + :arg damping: #to be filled + :type damping: float + +.. attribute:: error + + Simbolic constant string that indicates error. + +.. function:: exportBulletFile(filename) + + export a .bullet file + + :arg filename: File name + :type filename: string + +.. function:: getAppliedImpulse(constraintId) + + :arg constraintId: The id of the constraint. + :type constraintId: int + + :return: the most recent applied impulse. + :rtype: float + +.. function:: getVehicleConstraint(constraintId) + + :arg constraintId: The id of the vehicle constraint. + :type constraintId: int + + :return: a vehicle constraint object. + :rtype: :class:'KX_VehicleWrapper' + +.. function:: removeConstraint(constraintId) + + Removes a constraint. + + :arg constraintId: The id of the constraint to be removed. + :type constraintId: int + +.. function:: setCcdMode(ccdMode) + + ..note:: + Very experimental, not recommended + + Sets the CCD mode in the Physics Environment. + + :arg ccdMode: The new CCD mode. + :type ccdMode: int + +.. function:: setContactBreakingTreshold(breakingTreshold) + + .. note:: + Reasonable default is 0.02 (if units are meters) + + Sets the contact breaking treshold in the Physics Environment. + + :arg breakingTreshold: The new contact breaking treshold. + :type breakingTreshold: float + +.. function:: setDeactivationAngularTreshold(angularTreshold) + + Sets the deactivation angular treshold. + + :arg angularTreshold: New deactivation angular treshold. + :type angularTreshold: float + +.. function:: setDeactivationLinearTreshold(linearTreshold) + + Sets the deactivation linear treshold. + + :arg linearTreshold: New deactivation linear treshold. + :type linearTreshold: float + +.. function:: setDeactivationTime(time) + + Sets the time after which a resting rigidbody gets deactived. + + :arg time: The deactivation time. + :type time: float + +.. function:: setDebugMode(mode) + + Sets the debug mode. + + Debug modes: + - No debug: 0 + - Draw wireframe: 1 + - Draw Aabb: 2 #What's Aabb? + - Draw freatures text: 4 + - Draw contact points: 8 + - No deactivation: 16 + - No help text: 32 + - Draw text: 64 + - Profile timings: 128 + - Enable sat comparision: 256 + - Disable Bullet LCP: 512 + - Enable CCD: 1024 + - Draw Constraints: #(1 << 11) = ? + - Draw Constraint Limits: #(1 << 12) = ? + - Fast Wireframe: #(1 << 13) = ? + + :arg mode: The new debug mode. + :type mode: int + +.. function:: setGravity(x, y, z) + + Sets the gravity force. + + :arg x: Gravity X force. + :type x: float + + :arg y: Gravity Y force. + :type y: float + + :arg z: Gravity Z force. + :type z: float + +.. function:: setLinearAirDamping(damping) + + Not implemented. + +.. function:: setNumIterations(numiter) + + Sets the number of iterations for an iterative constraint solver. + + :arg numiter: New number of iterations. + :type numiter: int + +.. function:: setNumTimeSubSteps(numsubstep) + + Sets the number of substeps for each physics proceed. Tradeoff quality for performance. + + :arg numsubstep: New number of substeps. + :type numsubstep: int + +.. function:: setSolverDamping(damping) + + ..note:: + Very experimental, not recommended + + Sets the solver damping. + + :arg damping: New damping for the solver. + :type damping: float + +.. function:: setSolverTau(tau) + + .. note:: + Very experimental, not recommended + + Sets the solver tau. + + :arg tau: New tau for the solver. + :type tau: float + +.. function:: setSolverType(solverType) + + .. note:: + Very experimental, not recommended + + Sets the solver type. + + :arg solverType: The new type of the solver. + :type solverType: int + +.. function:: setSorConstant(sor) + + .. note:: + Very experimental, not recommended + + Sets the sor constant. + + :arg sor: New sor value. + :type sor: float + +.. function:: setUseEpa(epa) + + Not implemented. diff --git a/doc/python_api/rst/bge.events.rst b/doc/python_api/rst/bge.events.rst index 7215902a828..cc76ecded85 100644 --- a/doc/python_api/rst/bge.events.rst +++ b/doc/python_api/rst/bge.events.rst @@ -1,5 +1,5 @@ -Game Engine bge.events module +Game Engine bge.events Module ============================= ***** diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index 20a3a68b387..f7163ea928e 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -17,7 +17,7 @@ Module to access logic functions, imported automatically into the python control # To get the game object this controller is on: obj = cont.owner -:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`bge.types.~KX_LightObject` methods are available depending on the type of object +:class:`~bge.types.KX_GameObject` and :class:`~bge.types.KX_Camera` or :class:`~bge.types.KX_LightObject` methods are available depending on the type of object .. code-block:: python @@ -345,9 +345,9 @@ Utility functions .. function:: getAverageFrameRate() - Gets the estimated average framerate - - :return: The estimed average framerate in frames per second + Gets the estimated/average framerate for all the active scenes, not only the current scene. + + :return: The estimated average framerate in frames per second :rtype: float .. function:: getBlendFileList(path = "//") diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst new file mode 100644 index 00000000000..996f79a313a --- /dev/null +++ b/doc/python_api/rst/bge.texture.rst @@ -0,0 +1,549 @@ + +Game Engine bge.texture Module +============================== + +.. note:: + This documentation is still very weak, and needs some help! Right now they are mostly a collection + of the docstrings found in the bge.texture source code + some random places filled with text. + +***** +Intro +***** + +The bge.texture module allows you to manipulate textures during the game. + +Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that. + +The video and image files can be loaded from the internet using an URL instead of a file name. + +In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map. + +bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to:: + +* AVI +* Ogg +* Xvid +* Theora +* dv1394 camera +* video4linux capture card (this includes many webcams) +* videoForWindows capture card (this includes many webcams) +* JPG + +The principle is simple: first you identify a texture on an existing object using +the :materialID: function, then you create a new texture with dynamic content +and swap the two textures in the GPU. + +The GE is not aware of the substitution and continues to display the object as always, +except that you are now in control of the texture. + +When the texture object is deleted, the new texture is deleted and the old texture restored. + +.. module:: bge.texture + +.. class:: VideoFFmpeg(file [, capture=-1, rate=25.0, width=0, height=0]) + + FFmpeg video source + + .. attribute:: status + + video status + + .. attribute:: range + + replay range + + .. attribute:: repeat + + repeat count, -1 for infinite repeat + + :type: int + + .. attribute:: framerate + + frame rate + + :type: float + + .. attribute:: valid + + Tells if an image is available + + :type: bool + + .. attribute:: image + + image data + + .. attribute:: size + + image size + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. attribute:: flip + + flip image vertically + + .. attribute:: filter + + pixel filter + + .. attribute:: preseek + + number of frames of preseek + + :type: int + + .. attribute:: deinterlace + + deinterlace image + + :type: bool + + .. method:: play() + + Play (restart) video + + .. method:: pause() + + pause video + + .. method:: stop() + + stop video (play will replay it from start) + + .. method:: refresh() + + Refresh video - get its status + +.. class:: ImageFFmpeg(file) + + FFmpeg image source + + .. attribute:: status + + video status + + .. attribute:: valid + + Tells if an image is available + + :type: bool + + .. attribute:: image + + image data + + .. attribute:: size + + image size + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. attribute:: flip + + flip image vertically + + .. attribute:: filter + + pixel filter + + .. method:: refresh() + + Refresh image, i.e. load it + + .. method:: reload([newname]) + + Reload image, i.e. reopen it + +.. class:: ImageBuff() + + Image source from image buffer + + .. attribute:: filter + + pixel filter + + .. attribute:: flip + + flip image vertically + + .. attribute:: image + + image data + + .. method:: load(imageBuffer, width, height) + + Load image from buffer + + .. method:: plot(imageBuffer, width, height, positionX, positionY) + + update image buffer + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. attribute:: size + + image size + + .. attribute:: valid + + bool to tell if an image is available + +.. class:: ImageMirror(scene) + + Image source from mirror + + .. attribute:: alpha + + use alpha in texture + + .. attribute:: background + + background color + + .. attribute:: capsize + + size of render area + + .. attribute:: clip + + clipping distance + + .. attribute:: filter + + pixel filter + + .. attribute:: flip + + flip image vertically + + .. attribute:: image + + image data + + .. method:: refresh(imageMirror) + + Refresh image - invalidate its current content + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. attribute:: size + + image size + + .. attribute:: valid + + bool to tell if an image is available + + .. attribute:: whole + + use whole viewport to render + +.. class:: ImageMix() + + Image mixer + + .. attribute:: filter + + pixel filter + + .. attribute:: flip + + flip image vertically + + .. method:: getSource(imageMix) + + get image source + + .. method:: getWeight(imageMix) + + get image source weight + + + .. attribute:: image + + image data + + .. method:: refresh(imageMix) + + Refresh image - invalidate its current content + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. method:: setSource(imageMix) + + set image source + + .. method:: setWeight(imageMix) + + set image source weight + + .. attribute:: valid + + bool to tell if an image is available + +.. class:: ImageRender(scene, camera) + + Image source from render + + .. attribute:: alpha + + use alpha in texture + + .. attribute:: background + + background color + + .. attribute:: capsize + + size of render area + + .. attribute:: filter + + pixel filter + + .. attribute:: flip + + flip image vertically + + .. attribute:: image + + image data + + .. method:: refresh(imageRender) + + Refresh image - invalidate its current content + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. attribute:: size + + image size + + .. attribute:: valid + + bool to tell if an image is available + + .. attribute:: whole + + use whole viewport to render + +.. class:: ImageViewport() + + Image source from viewport + + .. attribute:: alpha + + use alpha in texture + + .. attribute:: capsize + + size of viewport area being captured + + .. attribute:: filter + + pixel filter + + .. attribute:: flip + + flip image vertically + + .. attribute:: image + + image data + + .. attribute:: position + + upper left corner of captured area + + .. method:: refresh(imageViewport) + + Refresh image - invalidate its current content + + .. attribute:: scale + + fast scale of image (near neighbour) + + .. attribute:: size + + image size + + .. attribute:: valid + + bool to tell if an image is available + + .. attribute:: whole + + use whole viewport to capture + +.. class:: Texture(gameObj) + + Texture objects + + .. attribute:: bindId + + OpenGL Bind Name + + .. method:: close(texture) + + Close dynamic texture and restore original + + .. attribute:: mipmap + + mipmap texture + + .. method:: refresh(texture) + + Refresh texture from source + + .. attribute:: source + + source of texture + +.. class:: FilterBGR24() + + Source filter BGR24 objects + +.. class:: FilterBlueScreen() + + Filter for Blue Screen objects + + .. attribute:: color + + blue screen color + + .. attribute:: limits + + blue screen color limits + + .. attribute:: previous + + previous pixel filter + +.. class:: FilterColor() + + Filter for color calculations + + .. attribute:: matrix + + matrix [4][5] for color calculation + + .. attribute:: previous + + previous pixel filter + +.. class:: FilterGray() + + Filter for gray scale effect + + .. attribute:: previous + + previous pixel filter + +.. class:: FilterLevel() + + Filter for levels calculations + + .. attribute:: levels + + levels matrix [4] (min, max) + + .. attribute:: previous + + previous pixel filter + +.. class:: FilterNormal() + + Filter for Blue Screen objects + + .. attribute:: colorIdx + + index of color used to calculate normal (0 - red, 1 - green, 2 - blue) + + .. attribute:: depth + + depth of relief + + .. attribute:: previous + + previous pixel filter + +.. class:: FilterRGB24() + + Returns a new input filter object to be used with :class:`ImageBuff` object when the image passed + to the ImageBuff.load() function has the 3-bytes pixel format BGR. + +.. class:: FilterRGBA32() + + Source filter RGBA32 objects + +.. function:: getLastError() + + Last error that occurred in a bge.texture function. + + :return: the description of the last error occurred in a bge.texture function. + :rtype: string + +.. function:: imageToArray(image,mode) + + Returns a :class:`~bgl.buffer` corresponding to the current image stored in a texture source object. + + :arg image: Image source object. + :type image: object of type :class:`VideoFFmpeg`, :class:`ImageFFmpeg`, :class:`ImageBuff`, :class:`ImageMix`, :class:`ImageRender`, :class:`ImageMirror` or :class:`ImageViewport` + :arg mode: optional argument representing the pixel format. + You can use the characters R, G, B for the 3 color channels, A for the alpha channel, + 0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel. + Example: "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order. + "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255. + The default mode is "RGBA". + + :type mode: string + :rtype: :class:`~bgl.buffer` + :return: A object representing the image as one dimensional array of bytes of size (pixel_size*width*height), + line by line starting from the bottom of the image. The pixel size and format is determined by the mode + parameter. + +.. function materialID(object,name) + + Returns a numeric value that can be used in :class:`Texture` to create a dynamic texture. + + The value corresponds to an internal material number that uses the texture identified + by name. name is a string representing a texture name with IM prefix if you want to + identify the texture directly. This method works for basic tex face and for material, + provided the material has a texture channel using that particular texture in first + position of the texture stack. name can also have MA prefix if you want to identify + the texture by material. In that case the material must have a texture channel in first + position. + + If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception. + + Ex: bge.texture.materialID(obj, 'IMvideo.png') + + :arg object: the game object that uses the texture you want to make dynamic + :type object: game object + :arg name: name of the texture/material you want to make dynamic. + :type name: string + :rtype: integer + +.. function setLogFile(filename) + + Sets the name of a text file in which runtime error messages will be written, in addition to the printing + of the messages on the Python console. Only the runtime errors specific to the VideoTexture module + are written in that file, ordinary runtime time errors are not written. + + :arg filename: name of error log file + :type filename: string + :rtype: integer diff --git a/doc/python_api/rst/bge.types.rst b/doc/python_api/rst/bge.types.rst index b54eca07e55..e42b362c771 100644 --- a/doc/python_api/rst/bge.types.rst +++ b/doc/python_api/rst/bge.types.rst @@ -710,6 +710,12 @@ Game Engine bge.types Module Applies changes to a camera. + .. attribute:: damping + + strength of of the camera following movement. + + :type: float + .. attribute:: min minimum distance to the target object maintained by the actuator. diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst new file mode 100644 index 00000000000..76b7442f2c5 --- /dev/null +++ b/doc/python_api/rst/bgl.rst @@ -0,0 +1,1889 @@ + +bgl module (OpenGL wrapper) +=========================== + +.. module:: 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(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. + +..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>`_ + + +.. function:: glAccum(op, value): + + Operate on the accumulation buffer. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/accum.html>`_ + + :type op: Enumerated constant + :arg op: The accumulation buffer operation. + :type value: float + :arg value: a value used in the accumulation buffer operation. + + +.. function:: glAlphaFunc(func, ref): + + Specify the alpha test function. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/alphafunc.html>`_ + + :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. + + +.. function:: glAreTexturesResident(n, textures, residences): + + Determine if textures are loaded in texture memory + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/aretexturesresident.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. + + +.. function:: glBegin(mode): + + Delimit the vertices of a primitive or a group of like primatives + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies the primitive that will be create from vertices between glBegin and + glEnd. + + +.. function:: glBindTexture(target, texture): + + Bind a named texture to a texturing target + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bindtexture.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target to which the texture is bound. + :type texture: unsigned int + :arg texture: Specifies the name of a texture. + + +.. function:: glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap): + + Draw a bitmap + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/bitmap.html>`_ + + :type width, height: int + :arg width, height: Specify the pixel width and height of the bitmap image. + :type xorig, yorig: float + :arg 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 + :arg xmove, ymove: Specify the x and y offsets to be added to the current raster position after + the bitmap is drawn. + :type bitmap: :class:`Buffer` object I{type GL_BYTE} + :arg bitmap: Specifies the address of the bitmap image. + + +.. function:: glBlendFunc(sfactor, dfactor): + + Specify pixel arithmetic + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/blendfunc.html>`_ + + :type sfactor: Enumerated constant + :arg sfactor: Specifies how the red, green, blue, and alpha source blending factors are + computed. + :type dfactor: Enumerated constant + :arg dfactor: Specifies how the red, green, blue, and alpha destination + blending factors are computed. + + +.. function:: glCallList(list): + + Execute a display list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllist.html>`_ + + :type list: unsigned int + :arg list: Specifies the integer name of the display list to be executed. + + +.. function:: glCallLists(n, type, lists): + + Execute a list of display lists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/calllists.html>`_ + + :type n: int + :arg n: Specifies the number of display lists to be executed. + :type type: Enumerated constant + :arg type: Specifies the type of values in lists. + :type lists: :class:`Buffer` object + :arg 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. + + +.. function:: glClear(mask): + + Clear buffers to preset values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clear.html>`_ + + :type mask: Enumerated constant(s) + :arg mask: Bitwise OR of masks that indicate the buffers to be cleared. + + +.. function:: glClearAccum(red, green, blue, alpha): + + Specify clear values for the accumulation buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html>`_ + + :type red, green, blue, alpha: float + :arg 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. + + +.. function:: glClearColor(red, green, blue, alpha): + + Specify clear values for the color buffers + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html>`_ + + :type red, green, blue, alpha: float + :arg 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. + + +.. function:: glClearDepth(depth): + + Specify the clear value for the depth buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cleardepth.html>`_ + + :type depth: int + :arg depth: Specifies the depth value used when the depth buffer is cleared. + The initial value is 1. + + +.. function:: glClearIndex(c): + + Specify the clear value for the color index buffers + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearindex.html>`_ + + :type c: float + :arg c: Specifies the index used when the color index buffers are cleared. + The initial value is 0. + + +.. function:: glClearStencil(s): + + Specify the clear value for the stencil buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearstencil.html>`_ + + :type s: int + :arg s: Specifies the index used when the stencil buffer is cleared. The initial value is 0. + + +.. function:: glClipPlane (plane, equation): + + Specify a plane against which all geometry is clipped + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clipplane.html>`_ + + :type plane: Enumerated constant + :arg plane: Specifies which clipping plane is being positioned. + :type equation: :class:`Buffer` object I{type GL_FLOAT}(double) + :arg equation: Specifies the address of an array of four double- precision + floating-point values. These values are interpreted as a plane equation. + + +.. function:: glColor (red, green, blue, alpha): + + B{glColor3b, glColor3d, glColor3f, glColor3i, glColor3s, glColor3ub, glColor3ui, glColor3us, + glColor4b, glColor4d, glColor4f, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, + glColor3bv, glColor3dv, glColor3fv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, + glColor3usv, glColor4bv, glColor4dv, glColor4fv, glColor4iv, glColor4sv, glColor4ubv, + glColor4uiv, glColor4usv} + + Set a new color. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html>`_ + + :type red, green, blue, alpha: Depends on function prototype. + :arg red, green, blue: Specify new red, green, and blue values for the current color. + :arg alpha: Specifies a new alpha value for the current color. Included only in the + four-argument glColor4 commands. (With '4' colors only) + + +.. function:: glColorMask(red, green, blue, alpha): + + Enable and disable writing of frame buffer color components + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html>`_ + + :type red, green, blue, alpha: int (boolean) + :arg red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be + written into the frame buffer. The initial values are all GL_TRUE, indicating that the + color components can be written. + + +.. function:: glColorMaterial(face, mode): + + Cause a material color to track the current color + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormaterial.html>`_ + + :type face: Enumerated constant + :arg face: Specifies whether front, back, or both front and back material parameters should + track the current color. + :type mode: Enumerated constant + :arg mode: Specifies which of several material parameters track the current color. + + +.. function:: glCopyPixels(x, y, width, height, type): + + Copy pixels in the frame buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html>`_ + + :type x, y: int + :arg x, y: Specify the window coordinates of the lower left corner of the rectangular + region of pixels to be copied. + :type width, height: int + :arg width,height: Specify the dimensions of the rectangular region of pixels to be copied. + Both must be non-negative. + :type type: Enumerated constant + :arg type: Specifies whether color values, depth values, or stencil values are to be copied. + + + def glCopyTexImage2D(target, level, internalformat, x, y, width, height, border): + + Copy pixels into a 2D texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type level: int + :arg level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + :type internalformat: int + :arg internalformat: Specifies the number of color components in the texture. + :type width: int + :type x, y: int + :arg x, y: Specify the window coordinates of the first pixel that is copied + from the frame buffer. This location is the lower left corner of a rectangular + block of pixels. + :arg width: Specifies the width of the texture image. Must be 2n+2(border) for + some integer n. All implementations support texture images that are at least 64 + texels wide. + :type height: int + :arg height: Specifies the height of the texture image. Must be 2m+2(border) for + some integer m. All implementations support texture images that are at least 64 + texels high. + :type border: int + :arg border: Specifies the width of the border. Must be either 0 or 1. + + +.. function:: glCullFace(mode): + + Specify whether front- or back-facing facets can be culled + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/cullface.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies whether front- or back-facing facets are candidates for culling. + + +.. function:: glDeleteLists(list, range): + + Delete a contiguous group of display lists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletelists.html>`_ + + :type list: unsigned int + :arg list: Specifies the integer name of the first display list to delete + :type range: int + :arg range: Specifies the number of display lists to delete + + +.. function:: glDeleteTextures(n, textures): + + Delete named textures + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html>`_ + + :type n: int + :arg n: Specifies the number of textures to be deleted + :type textures: :class:`Buffer` I{GL_INT} + :arg textures: Specifies an array of textures to be deleted + + +.. function:: glDepthFunc(func): + + Specify the value used for depth buffer comparisons + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthfunc.html>`_ + + :type func: Enumerated constant + :arg func: Specifies the depth comparison function. + + +.. function:: glDepthMask(flag): + + Enable or disable writing into the depth buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthmask.html>`_ + + :type flag: int (boolean) + :arg flag: Specifies whether the depth buffer is enabled for writing. If flag is GL_FALSE, + depth buffer writing is disabled. Otherwise, it is enabled. Initially, depth buffer + writing is enabled. + + +.. function:: glDepthRange(zNear, zFar): + + Specify mapping of depth values from normalized device coordinates to window coordinates + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/depthrange.html>`_ + + :type zNear: int + :arg zNear: Specifies the mapping of the near clipping plane to window coordinates. + The initial value is 0. + :type zFar: int + :arg zFar: Specifies the mapping of the far clipping plane to window coordinates. + The initial value is 1. + + +.. function:: glDisable(cap): + + Disable server-side GL capabilities + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html>`_ + + :type cap: Enumerated constant + :arg cap: Specifies a symbolic constant indicating a GL capability. + + +.. function:: glDrawBuffer(mode): + + Specify which color buffers are to be drawn into + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawbuffer.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies up to four color buffers to be drawn into. + + +.. function:: glDrawPixels(width, height, format, type, pixels): + + Write a block of pixels to the frame buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html>`_ + + :type width, height: int + :arg width, height: Specify the dimensions of the pixel rectangle to be + written into the frame buffer. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type for pixels. + :type pixels: :class:`Buffer` object + :arg pixels: Specifies a pointer to the pixel data. + + +.. function:: glEdgeFlag (flag): + + B{glEdgeFlag, glEdgeFlagv} + + Flag edges as either boundary or non-boundary + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/edgeflag.html>`_ + + :type flag: Depends of function prototype + :arg flag: Specifies the current edge flag value.The initial value is GL_TRUE. + + +.. function:: glEnable(cap): + + Enable server-side GL capabilities + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/enable.html>`_ + + :type cap: Enumerated constant + :arg cap: Specifies a symbolic constant indicating a GL capability. + + +.. function:: glEnd(): + + Delimit the vertices of a primitive or group of like primitives + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html>`_ + + +.. function:: glEndList(): + + Create or replace a display list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html>`_ + + +.. function:: glEvalCoord (u,v): + + B{glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, + glEvalCoord2dv, glEvalCoord2fv} + + Evaluate enabled one- and two-dimensional maps + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalcoord.html>`_ + + :type u: Depends on function prototype. + :arg u: Specifies a value that is the domain coordinate u to the basis function defined + in a previous glMap1 or glMap2 command. If the function prototype ends in 'v' then + u specifies a pointer to an array containing either one or two domain coordinates. The first + coordinate is u. The second coordinate is v, which is present only in glEvalCoord2 versions. + :type v: Depends on function prototype. (only with '2' prototypes) + :arg v: Specifies a value that is the domain coordinate v to the basis function defined + in a previous glMap2 command. This argument is not present in a glEvalCoord1 command. + + +.. function:: glEvalMesh (mode, i1, i2): + + B{glEvalMesh1 or glEvalMesh2} + + Compute a one- or two-dimensional grid of points or lines + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalmesh.html>`_ + + :type mode: Enumerated constant + :arg mode: In glEvalMesh1, specifies whether to compute a one-dimensional + mesh of points or lines. + :type i1, i2: int + :arg i1, i2: Specify the first and last integer values for the grid domain variable i. + + +.. function:: glEvalPoint (i, j): + + B{glEvalPoint1 and glEvalPoint2} + + Generate and evaluate a single point in a mesh + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/evalpoint.html>`_ + + :type i: int + :arg i: Specifies the integer value for grid domain variable i. + :type j: int (only with '2' prototypes) + :arg j: Specifies the integer value for grid domain variable j (glEvalPoint2 only). + + +.. function:: glFeedbackBuffer (size, type, buffer): + + Controls feedback mode + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/feedbackbuffer.html>`_ + + :type size: int + :arg size: Specifies the maximum number of values that can be written into buffer. + :type type: Enumerated constant + :arg type: Specifies a symbolic constant that describes the information that + will be returned for each vertex. + :type buffer: :class:`Buffer` object I{GL_FLOAT} + :arg buffer: Returns the feedback data. + + +.. function:: glFinish(): + + Block until all GL execution is complete + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/finish.html>`_ + + +.. function:: glFlush(): + + Force Execution of GL commands in finite time + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/flush.html>`_ + + +.. function:: glFog (pname, param): + + B{glFogf, glFogi, glFogfv, glFogiv} + + Specify fog parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/fog.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies a single-valued fog parameter. If the function prototype + ends in 'v' specifies a fog parameter. + :type param: Depends on function prototype. + :arg param: Specifies the value or values to be assigned to pname. GL_FOG_COLOR + requires an array of four values. All other parameters accept an array containing + only a single value. + + +.. function:: glFrontFace(mode): + + Define front- and back-facing polygons + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frontface.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies the orientation of front-facing polygons. + + +.. function:: glFrustum(left, right, bottom, top, zNear, zFar): + + Multiply the current matrix by a perspective matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/frustum.html>`_ + + :type left, right: double (float) + :arg left, right: Specify the coordinates for the left and right vertical + clipping planes. + :type top, bottom: double (float) + :arg top, bottom: Specify the coordinates for the bottom and top horizontal + clipping planes. + :type zNear, zFar: double (float) + :arg zNear, zFar: Specify the distances to the near and far depth clipping planes. + Both distances must be positive. + + +.. function:: glGenLists(range): + + Generate a contiguous set of empty display lists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/genlists.html>`_ + + :type range: int + :arg range: Specifies the number of contiguous empty display lists to be generated. + + +.. function:: glGenTextures(n, textures): + + Generate texture names + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gentextures.html>`_ + + :type n: int + :arg n: Specifies the number of textures name to be generated. + :type textures: :class:`Buffer` object I{type GL_INT} + :arg textures: Specifies an array in which the generated textures names are stored. + + +.. function:: glGet (pname, param): + + B{glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv} + + Return the value or values of a selected parameter + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/get.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies the parameter value to be returned. + :type param: Depends on function prototype. + :arg param: Returns the value or values of the specified parameter. + + +.. function:: glGetClipPlane(plane, equation): + + Return the coefficients of the specified clipping plane + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getclipplane.html>`_ + + :type plane: Enumerated constant + :arg plane: Specifies a clipping plane. The number of clipping planes depends on the + implementation, but at least six clipping planes are supported. They are identified by + symbolic names of the form GL_CLIP_PLANEi where 0 < i < GL_MAX_CLIP_PLANES. + :type equation: :class:`Buffer` object I{type GL_FLOAT} + :arg equation: Returns four float (double)-precision values that are the coefficients of the + plane equation of plane in eye coordinates. The initial value is (0, 0, 0, 0). + + +.. function:: glGetError(): + + Return error information + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/geterror.html>`_ + + +.. function:: glGetLight (light, pname, params): + + B{glGetLightfv and glGetLightiv} + + Return light source parameter values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getlight.html>`_ + + :type light: Enumerated constant + :arg light: Specifies a light source. The number of possible lights depends on the + implementation, but at least eight lights are supported. They are identified by symbolic + names of the form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. + :type pname: Enumerated constant + :arg pname: Specifies a light source parameter for light. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetMap (target, query, v): + + B{glGetMapdv, glGetMapfv, glGetMapiv} + + Return evaluator parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmap.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the symbolic name of a map. + :type query: Enumerated constant + :arg query: Specifies which parameter to return. + :type v: :class:`Buffer` object. Depends on function prototype. + :arg v: Returns the requested data. + + +.. function:: glGetMaterial (face, pname, params): + + B{glGetMaterialfv, glGetMaterialiv} + + Return material parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getmaterial.html>`_ + + :type face: Enumerated constant + :arg face: Specifies which of the two materials is being queried. + representing the front and back materials, respectively. + :type pname: Enumerated constant + :arg pname: Specifies the material parameter to return. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetPixelMap (map, values): + + B{glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv} + + Return the specified pixel map + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpixelmap.html>`_ + + :type map: Enumerated constant + :arg map: Specifies the name of the pixel map to return. + :type values: :class:`Buffer` object. Depends on function prototype. + :arg values: Returns the pixel map contents. + + +.. function:: glGetPolygonStipple(mask): + + Return the polygon stipple pattern + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getpolygonstipple.html>`_ + + :type mask: :class:`Buffer` object I{type GL_BYTE} + :arg mask: Returns the stipple pattern. The initial value is all 1's. + + +.. function:: glGetString(name): + + Return a string describing the current GL connection + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getstring.html>`_ + + :type name: Enumerated constant + :arg name: Specifies a symbolic constant. + + + +.. function:: glGetTexEnv (target, pname, params): + + B{glGetTexEnvfv, glGetTexEnviv} + + Return texture environment parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexenv.html>`_ + + :type target: Enumerated constant + :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a texture environment parameter. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetTexGen (coord, pname, params): + + B{glGetTexGendv, glGetTexGenfv, glGetTexGeniv} + + Return texture coordinate generation parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexgen.html>`_ + + :type coord: Enumerated constant + :arg coord: Specifies a texture coordinate. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the value(s) to be returned. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetTexImage(target, level, format, type, pixels): + + Return a texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/getteximage.html>`_ + + :type target: Enumerated constant + :arg target: Specifies which texture is to be obtained. + :type level: int + :arg level: Specifies the level-of-detail number of the desired image. + Level 0 is the base image level. Level n is the nth mipmap reduction image. + :type format: Enumerated constant + :arg format: Specifies a pixel format for the returned data. + :type type: Enumerated constant + :arg type: Specifies a pixel type for the returned data. + :type pixels: :class:`Buffer` object. + :arg pixels: Returns the texture image. Should be a pointer to an array of the + type specified by type + + +.. function:: glGetTexLevelParameter (target, level, pname, params): + + B{glGetTexLevelParameterfv, glGetTexLevelParameteriv} + + return texture parameter values for a specific level of detail + + .. seealso:: U{opengl.org/developers/documentation/man_pages/hardcopy/GL/html/gl/gettexlevelparameter.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the symbolic name of the target texture. + :type level: int + :arg level: Specifies the level-of-detail number of the desired image. + Level 0 is the base image level. Level n is the nth mipmap reduction image. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a texture parameter. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the requested data. + + +.. function:: glGetTexParameter (target, pname, params): + + B{glGetTexParameterfv, glGetTexParameteriv} + + Return texture parameter values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/gettexparameter.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the symbolic name of the target texture. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name the target texture. + :type params: :class:`Buffer` object. Depends on function prototype. + :arg params: Returns the texture parameters. + + +.. function:: glHint(target, mode): + + Specify implementation-specific hints + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/hint.html>`_ + + :type target: Enumerated constant + :arg target: Specifies a symbolic constant indicating the behavior to be + controlled. + :type mode: Enumerated constant + :arg mode: Specifies a symbolic constant indicating the desired behavior. + + +.. function:: glIndex(c): + + B{glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv} + + Set the current color index + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/index_.html>`_ + + :type c: :class:`Buffer` object. Depends on function prototype. + :arg c: Specifies a pointer to a one element array that contains the new value for + the current color index. + + +.. function:: glInitNames(): + + Initialize the name stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/initnames.html>`_ + + +.. function:: glIsEnabled(cap): + + Test whether a capability is enabled + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/isenabled.html>`_ + + :type cap: Enumerated constant + :arg cap: Specifies a constant representing a GL capability. + + +.. function:: glIsList(list): + + Determine if a name corresponds to a display-list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/islist.html>`_ + + :type list: unsigned int + :arg list: Specifies a potential display-list name. + + +.. function:: glIsTexture(texture): + + Determine if a name corresponds to a texture + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/istexture.html>`_ + + :type texture: unsigned int + :arg texture: Specifies a value that may be the name of a texture. + + +.. function:: glLight (light, pname, param): + + B{glLightf,glLighti, glLightfv, glLightiv} + + Set the light source parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/light.html>`_ + + :type light: Enumerated constant + :arg light: Specifies a light. The number of lights depends on the implementation, + but at least eight lights are supported. They are identified by symbolic names of the + form GL_LIGHTi where 0 < i < GL_MAX_LIGHTS. + :type pname: Enumerated constant + :arg pname: Specifies a single-valued light source parameter for light. + :type param: Depends on function prototype. + :arg param: Specifies the value that parameter pname of light source light will be set to. + If function prototype ends in 'v' specifies a pointer to the value or values that + parameter pname of light source light will be set to. + + +.. function:: glLightModel (pname, param): + + B{glLightModelf, glLightModeli, glLightModelfv, glLightModeliv} + + Set the lighting model parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/lightmodel.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies a single-value light model parameter. + :type param: Depends on function prototype. + :arg param: Specifies the value that param will be set to. If function prototype ends in 'v' + specifies a pointer to the value or values that param will be set to. + + +.. function:: glLineStipple(factor, pattern): + + Specify the line stipple pattern + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linestipple.html>`_ + + :type factor: int + :arg factor: Specifies a multiplier for each bit in the line stipple pattern. + If factor is 3, for example, each bit in the pattern is used three times before + the next bit in the pattern is used. factor is clamped to the range [1, 256] and + defaults to 1. + :type pattern: unsigned short int + :arg pattern: Specifies a 16-bit integer whose bit pattern determines which fragments + of a line will be drawn when the line is rasterized. Bit zero is used first; the default + pattern is all 1's. + + +.. function:: glLineWidth(width): + + Specify the width of rasterized lines. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/linewidth.html>`_ + + :type width: float + :arg width: Specifies the width of rasterized lines. The initial value is 1. + + +.. function:: glListBase(base): + + Set the display-list base for glCallLists + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/listbase.html>`_ + + :type base: unsigned int + :arg base: Specifies an integer offset that will be added to glCallLists + offsets to generate display-list names. The initial value is 0. + + +.. function:: glLoadIdentity(): + + Replace the current matrix with the identity matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadidentity.html>`_ + + +.. function:: glLoadMatrix (m): + + B{glLoadMatrixd, glLoadMatixf} + + Replace the current matrix with the specified matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadmatrix.html>`_ + + :type m: :class:`Buffer` object. Depends on function prototype. + :arg m: Specifies a pointer to 16 consecutive values, which are used as the elements + of a 4x4 column-major matrix. + + +.. function:: glLoadName(name): + + Load a name onto the name stack. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/loadname.html>`_ + + :type name: unsigned int + :arg name: Specifies a name that will replace the top value on the name stack. + + +.. function:: glLogicOp(opcode): + + Specify a logical pixel operation for color index rendering + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/logicop.html>`_ + + :type opcode: Enumerated constant + :arg opcode: Specifies a symbolic constant that selects a logical operation. + + +.. function:: glMap1 (target, u1, u2, stride, order, points): + + B{glMap1d, glMap1f} + + Define a one-dimensional evaluator + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map1.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the kind of values that are generated by the evaluator. + :type u1, u2: Depends on function prototype. + :arg u1,u2: Specify a linear mapping of u, as presented to glEvalCoord1, to ^, t + he variable that is evaluated by the equations specified by this command. + :type stride: int + :arg stride: Specifies the number of floats or float (double)s between the beginning + of one control point and the beginning of the next one in the data structure + referenced in points. This allows control points to be embedded in arbitrary data + structures. The only constraint is that the values for a particular control point must + occupy contiguous memory locations. + :type order: int + :arg order: Specifies the number of control points. Must be positive. + :type points: :class:`Buffer` object. Depends on function prototype. + :arg points: Specifies a pointer to the array of control points. + + +.. function:: glMap2 (target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points): + + B{glMap2d, glMap2f} + + Define a two-dimensional evaluator + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/map2.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the kind of values that are generated by the evaluator. + :type u1, u2: Depends on function prototype. + :arg u1,u2: Specify a linear mapping of u, as presented to glEvalCoord2, to ^, t + he variable that is evaluated by the equations specified by this command. Initially + u1 is 0 and u2 is 1. + :type ustride: int + :arg ustride: Specifies the number of floats or float (double)s between the beginning + of control point R and the beginning of control point R ij, where i and j are the u + and v control point indices, respectively. This allows control points to be embedded + in arbitrary data structures. The only constraint is that the values for a particular + control point must occupy contiguous memory locations. The initial value of ustride is 0. + :type uorder: int + :arg uorder: Specifies the dimension of the control point array in the u axis. + Must be positive. The initial value is 1. + :type v1, v2: Depends on function prototype. + :arg v1, v2: Specify a linear mapping of v, as presented to glEvalCoord2, + to ^, one of the two variables that are evaluated by the equations + specified by this command. Initially, v1 is 0 and v2 is 1. + :type vstride: int + :arg vstride: Specifies the number of floats or float (double)s between the + beginning of control point R and the beginning of control point R ij, + where i and j are the u and v control point(indices, respectively. + This allows control points to be embedded in arbitrary data structures. + The only constraint is that the values for a particular control point must + occupy contiguous memory locations. The initial value of vstride is 0. + :type vorder: int + :arg vorder: Specifies the dimension of the control point array in the v axis. + Must be positive. The initial value is 1. + :type points: :class:`Buffer` object. Depends on function prototype. + :arg points: Specifies a pointer to the array of control points. + + +.. function:: glMapGrid (un, u1,u2 ,vn, v1, v2): + + B{glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f} + + Define a one- or two-dimensional mesh + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/mapgrid.html>`_ + + :type un: int + :arg un: Specifies the number of partitions in the grid range interval + [u1, u2]. Must be positive. + :type u1, u2: Depends on function prototype. + :arg u1, u2: Specify the mappings for integer grid domain values i=0 and i=un. + :type vn: int + :arg vn: Specifies the number of partitions in the grid range interval + [v1, v2] (glMapGrid2 only). + :type v1, v2: Depends on function prototype. + :arg v1, v2: Specify the mappings for integer grid domain values j=0 and j=vn + (glMapGrid2 only). + + +.. function:: glMaterial (face, pname, params): + + Specify material parameters for the lighting model. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/material.html>`_ + + :type face: Enumerated constant + :arg face: Specifies which face or faces are being updated. Must be one of: + :type pname: Enumerated constant + :arg pname: Specifies the single-valued material parameter of the face + or faces that is being updated. Must be GL_SHININESS. + :type params: int + :arg params: Specifies the value that parameter GL_SHININESS will be set to. + If function prototype ends in 'v' specifies a pointer to the value or values that + pname will be set to. + + +.. function:: glMatrixMode(mode): + + Specify which matrix is the current matrix. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/matrixmode.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies which matrix stack is the target for subsequent matrix operations. + + +.. function:: glMultMatrix (m): + + B{glMultMatrixd, glMultMatrixf} + + Multiply the current matrix with the specified matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/multmatrix.html>`_ + + :type m: :class:`Buffer` object. Depends on function prototype. + :arg m: Points to 16 consecutive values that are used as the elements of a 4x4 column + major matrix. + + +.. function:: glNewList(list, mode): + + Create or replace a display list + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/newlist.html>`_ + + :type list: unsigned int + :arg list: Specifies the display list name + :type mode: Enumerated constant + :arg mode: Specifies the compilation mode. + + +.. function:: glNormal3 (nx, ny, nz, v): + + B{Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, + Normal3s, Normal3sv} + + Set the current normal vector + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/normal.html>`_ + + :type nx, ny, nz: Depends on function prototype. (non - 'v' prototypes only) + :arg nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. + The initial value of the current normal is the unit vector, (0, 0, 1). + :type v: :class:`Buffer` object. Depends on function prototype. ('v' prototypes) + :arg v: Specifies a pointer to an array of three elements: the x, y, and z coordinates + of the new current normal. + + +.. function:: glOrtho(left, right, bottom, top, zNear, zFar): + + Multiply the current matrix with an orthographic matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/ortho.html>`_ + + :type left, right: double (float) + :arg left, right: Specify the coordinates for the left and + right vertical clipping planes. + :type bottom, top: double (float) + :arg bottom, top: Specify the coordinates for the bottom and top + horizontal clipping planes. + :type zNear, zFar: double (float) + :arg zNear, zFar: Specify the distances to the nearer and farther + depth clipping planes. These values are negative if the plane is to be behind the viewer. + + +.. function:: glPassThrough(token): + + Place a marker in the feedback buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/passthrough.html>`_ + + :type token: float + :arg token: Specifies a marker value to be placed in the feedback + buffer following a GL_PASS_THROUGH_TOKEN. + + +.. function:: glPixelMap (map, mapsize, values): + + B{glPixelMapfv, glPixelMapuiv, glPixelMapusv} + + Set up pixel transfer maps + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelmap.html>`_ + + :type map: Enumerated constant + :arg map: Specifies a symbolic map name. + :type mapsize: int + :arg mapsize: Specifies the size of the map being defined. + :type values: :class:`Buffer` object. Depends on function prototype. + :arg values: Specifies an array of mapsize values. + + +.. function:: glPixelStore (pname, param): + + B{glPixelStoref, glPixelStorei} + + Set pixel storage modes + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelstore.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the parameter to be set. + Six values affect the packing of pixel data into memory. + Six more affect the unpacking of pixel data from memory. + :type param: Depends on function prototype. + :arg param: Specifies the value that pname is set to. + + +.. function:: glPixelTransfer (pname, param): + + B{glPixelTransferf, glPixelTransferi} + + Set pixel transfer modes + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixeltransfer.html>`_ + + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the pixel transfer parameter to be set. + :type param: Depends on function prototype. + :arg param: Specifies the value that pname is set to. + + +.. function:: glPixelZoom(xfactor, yfactor): + + Specify the pixel zoom factors + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pixelzoom.html>`_ + + :type xfactor, yfactor: float + :arg xfactor, yfactor: Specify the x and y zoom factors for pixel write operations. + + +.. function:: glPointSize(size): + + Specify the diameter of rasterized points + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pointsize.html>`_ + + :type size: float + :arg size: Specifies the diameter of rasterized points. The initial value is 1. + + +.. function:: glPolygonMode(face, mode): + + Select a polygon rasterization mode + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonmode.html>`_ + + :type face: Enumerated constant + :arg face: Specifies the polygons that mode applies to. + Must be GL_FRONT for front-facing polygons, GL_BACK for back- facing + polygons, or GL_FRONT_AND_BACK for front- and back-facing polygons. + :type mode: Enumerated constant + :arg mode: Specifies how polygons will be rasterized. + The initial value is GL_FILL for both front- and back- facing polygons. + + +.. function:: glPolygonOffset(factor, units): + + Set the scale and units used to calculate depth values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonoffset.html>`_ + + :type factor: float + :arg factor: Specifies a scale factor that is used to create a variable depth + offset for each polygon. The initial value is 0. + :type units: float + :arg units: Is multiplied by an implementation-specific value to create a + constant depth offset. The initial value is 0. + + +.. function:: glPolygonStipple(mask): + + Set the polygon stippling pattern + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/polygonstipple.html>`_ + + :type mask: :class:`Buffer` object I{type GL_BYTE} + :arg mask: Specifies a pointer to a 32x32 stipple pattern that will be unpacked + from memory in the same way that glDrawPixels unpacks pixels. + + +.. function:: glPopAttrib(): + + Pop the server attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html>`_ + + +.. function:: glPopClientAttrib(): + + Pop the client attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html>`_ + + +.. function:: glPopMatrix(): + + Pop the current matrix stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html>`_ + + +.. function:: glPopName(): + + Pop the name stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html>`_ + + +.. function:: glPrioritizeTextures(n, textures, priorities): + + Set texture residence priority + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/prioritizetextures.html>`_ + + :type n: int + :arg n: Specifies the number of textures to be prioritized. + :type textures: :class:`Buffer` I{type GL_INT} + :arg textures: Specifies an array containing the names of the textures to be prioritized. + :type priorities: :class:`Buffer` I{type GL_FLOAT} + :arg priorities: Specifies an array containing the texture priorities. + A priority given in an element of priorities applies to the texture named + by the corresponding element of textures. + + +.. function:: glPushAttrib(mask): + + Push the server attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushattrib.html>`_ + + :type mask: Enumerated constant(s) + :arg mask: Specifies a mask that indicates which attributes to save. + + +.. function:: glPushClientAttrib(mask): + + Push the client attribute stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushclientattrib.html>`_ + + :type mask: Enumerated constant(s) + :arg mask: Specifies a mask that indicates which attributes to save. + + +.. function:: glPushMatrix(): + + Push the current matrix stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushmatrix.html>`_ + + +.. function:: glPushName(name): + + Push the name stack + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/pushname.html>`_ + + :type name: unsigned int + :arg name: Specifies a name that will be pushed onto the name stack. + + +.. function:: glRasterPos (x,y,z,w): + + B{glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, + glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, + glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, + glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, + glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv} + + Specify the raster position for pixel operations + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html>`_ + + :type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) + :arg x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the + raster position. If function prototype ends in 'v' specifies a pointer to an array of two, + three, or four elements, specifying x, y, z, and w coordinates, respectively. + + .. note:: + + If you are drawing to the 3d view with a Scriptlink of a space handler + the zoom level of the panels will scale the glRasterPos by the view matrix. + so a X of 10 will not always offset 10 pixels as you would expect. + + To work around this get the scale value of the view matrix and use it to scale your pixel values. + + .. code-block:: python + + import bgl + xval, yval= 100, 40 + # Get the scale of the view matrix + view_matrix = bgl.Buffer(bgl.GL_FLOAT, 16) + bgl.glGetFloatv(bgl.GL_MODELVIEW_MATRIX, view_matrix) + f = 1.0 / view_matrix[0] + + # Instead of the usual glRasterPos2i(xval, yval) + bgl.glRasterPos2f(xval * f, yval * f) + + +.. function:: glReadBuffer(mode): + + Select a color buffer source for pixels. + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readbuffer.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies a color buffer. + + +.. function:: glReadPixels(x, y, width, height, format, type, pixels): + + Read a block of pixels from the frame buffer + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html>`_ + + :type x, y: int + :arg x, y: Specify the window coordinates of the first pixel that is read + from the frame buffer. This location is the lower left corner of a rectangular + block of pixels. + :type width, height: int + :arg width, height: Specify the dimensions of the pixel rectangle. width and + height of one correspond to a single pixel. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type of the pixel data. + :type pixels: :class:`Buffer` object + :arg pixels: Returns the pixel data. + + +.. function:: glRect (x1,y1,x2,y2,v1,v2): + + B{glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv} + + Draw a rectangle + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rect.html>`_ + + :type x1, y1: Depends on function prototype. (for non 'v' prototypes only) + :arg x1, y1: Specify one vertex of a rectangle + :type x2, y2: Depends on function prototype. (for non 'v' prototypes only) + :arg x2, y2: Specify the opposite vertex of the rectangle + :type v1, v2: Depends on function prototype. (for 'v' prototypes only) + :arg v1, v2: Specifies a pointer to one vertex of a rectangle and the pointer + to the opposite vertex of the rectangle + + +.. function:: glRenderMode(mode): + + Set rasterization mode + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rendermode.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies the rasterization mode. + + +.. function:: glRotate (angle, x, y, z): + + B{glRotated, glRotatef} + + Multiply the current matrix by a rotation matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rotate.html>`_ + + :type angle: Depends on function prototype. + :arg angle: Specifies the angle of rotation in degrees. + :type x, y, z: Depends on function prototype. + :arg x, y, z: Specify the x, y, and z coordinates of a vector respectively. + + +.. function:: glScale (x,y,z): + + B{glScaled, glScalef} + + Multiply the current matrix by a general scaling matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html>`_ + + :type x, y, z: Depends on function prototype. + :arg x, y, z: Specify scale factors along the x, y, and z axes, respectively. + + +.. function:: glScissor(x,y,width,height): + + Define the scissor box + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html>`_ + + :type x, y: int + :arg x, y: Specify the lower left corner of the scissor box. Initially (0, 0). + :type width, height: int + :arg width height: Specify the width and height of the scissor box. When a + GL context is first attached to a window, width and height are set to the + dimensions of that window. + + +.. function:: glSelectBuffer(size, buffer): + + Establish a buffer for selection mode values + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/selectbuffer.html>`_ + + :type size: int + :arg size: Specifies the size of buffer + :type buffer: :class:`Buffer` I{type GL_INT} + :arg buffer: Returns the selection data + + +.. function:: glShadeModel(mode): + + Select flat or smooth shading + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/shademodel.html>`_ + + :type mode: Enumerated constant + :arg mode: Specifies a symbolic value representing a shading technique. + + +.. function:: glStencilFuc(func, ref, mask): + + Set function and reference value for stencil testing + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilfunc.html>`_ + + :type func: Enumerated constant + :arg func: Specifies the test function. + :type ref: int + :arg ref: Specifies the reference value for the stencil test. ref is clamped + to the range [0,2n-1], where n is the number of bitplanes in the stencil + buffer. The initial value is 0. + :type mask: unsigned int + :arg mask: Specifies a mask that is ANDed with both the reference value and + the stored stencil value when the test is done. The initial value is all 1's. + + +.. function:: glStencilMask(mask): + + Control the writing of individual bits in the stencil planes + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilmask.html>`_ + + :type mask: unsigned int + :arg mask: Specifies a bit mask to enable and disable writing of individual bits + in the stencil planes. Initially, the mask is all 1's. + + +.. function:: glStencilOp(fail, zfail, zpass): + + Set stencil test actions + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/stencilop.html>`_ + + :type fail: Enumerated constant + :arg fail: Specifies the action to take when the stencil test fails. + The initial value is GL_KEEP. + :type zfail: Enumerated constant + :arg zfail: Specifies the stencil action when the stencil test passes, but the + depth test fails. zfail accepts the same symbolic constants as fail. + The initial value is GL_KEEP. + :type zpass: Enumerated constant + :arg zpass: Specifies the stencil action when both the stencil test and the + depth test pass, or when the stencil test passes and either there is no + depth buffer or depth testing is not enabled. zpass accepts the same + symbolic constants + as fail. The initial value is GL_KEEP. + + +.. function:: glTexCoord (s,t,r,q,v): + + B{glTexCoord1d, glTexCoord1f, glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2f, + glTexCoord2i, glTexCoord2s, glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, + glTexCoord4d, glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, + glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2fv, glTexCoord2iv, + glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, glTexCoord3sv, + glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, glTexCoord4sv} + + Set the current texture coordinates + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html>`_ + + :type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only) + :arg s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are + present in all forms of the command. + :type v: :class:`Buffer` object. Depends on function prototype. (for 'v' prototypes only) + :arg v: Specifies a pointer to an array of one, two, three, or four elements, + which in turn specify the s, t, r, and q texture coordinates. + + +.. function:: glTexEnv (target, pname, param): + + B{glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv} + + Set texture environment parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html>`_ + + :type target: Enumerated constant + :arg target: Specifies a texture environment. Must be GL_TEXTURE_ENV. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a single-valued texture environment + parameter. Must be GL_TEXTURE_ENV_MODE. + :type param: Depends on function prototype. + :arg param: Specifies a single symbolic constant. If function prototype ends in 'v' + specifies a pointer to a parameter array that contains either a single + symbolic constant or an RGBA color + + +.. function:: glTexGen (coord, pname, param): + + B{glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv} + + Control the generation of texture coordinates + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texgen.html>`_ + + :type coord: Enumerated constant + :arg coord: Specifies a texture coordinate. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of the texture- coordinate generation function. + :type param: Depends on function prototype. + :arg param: Specifies a single-valued texture generation parameter. + If function prototype ends in 'v' specifies a pointer to an array of texture + generation parameters. If pname is GL_TEXTURE_GEN_MODE, then the array must + contain a single symbolic constant. Otherwise, params holds the coefficients + for the texture-coordinate generation function specified by pname. + + +.. function:: glTexImage1D(target, level, internalformat, width, border, format, type, pixels): + + Specify a one-dimensional texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage1d.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type level: int + :arg level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + :type internalformat: int + :arg internalformat: Specifies the number of color components in the texture. + :type width: int + :arg width: Specifies the width of the texture image. Must be 2n+2(border) + for some integer n. All implementations support texture images that are + at least 64 texels wide. The height of the 1D texture image is 1. + :type border: int + :arg border: Specifies the width of the border. Must be either 0 or 1. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type of the pixel data. + :type pixels: :class:`Buffer` object. + :arg pixels: Specifies a pointer to the image data in memory. + + +.. function:: glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels): + + Specify a two-dimensional texture image + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/teximage2d.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type level: int + :arg level: Specifies the level-of-detail number. Level 0 is the base image level. + Level n is the nth mipmap reduction image. + :type internalformat: int + :arg internalformat: Specifies the number of color components in the texture. + :type width: int + :arg width: Specifies the width of the texture image. Must be 2n+2(border) + for some integer n. All implementations support texture images that are at + least 64 texels wide. + :type height: int + :arg height: Specifies the height of the texture image. Must be 2m+2(border) for + some integer m. All implementations support texture images that are at + least 64 texels high. + :type border: int + :arg border: Specifies the width of the border. Must be either 0 or 1. + :type format: Enumerated constant + :arg format: Specifies the format of the pixel data. + :type type: Enumerated constant + :arg type: Specifies the data type of the pixel data. + :type pixels: :class:`Buffer` object. + :arg pixels: Specifies a pointer to the image data in memory. + + +.. function:: glTexParameter (target, pname, param): + + B{glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv} + + Set texture parameters + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texparameter.html>`_ + + :type target: Enumerated constant + :arg target: Specifies the target texture. + :type pname: Enumerated constant + :arg pname: Specifies the symbolic name of a single-valued texture parameter. + :type param: Depends on function prototype. + :arg param: Specifies the value of pname. If function prototype ends in 'v' specifies + a pointer to an array where the value or values of pname are stored. + + +.. function:: glTranslate (x, y, z): + + B{glTranslatef, glTranslated} + + Multiply the current matrix by a translation matrix + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html>`_ + + :type x, y, z: Depends on function prototype. + :arg x, y, z: Specify the x, y, and z coordinates of a translation vector. + + +.. function:: glVertex (x,y,z,w,v): + + B{glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, + glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, + glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, + glVertex4fv, glVertex4iv, glVertex4sv} + + Specify a vertex + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html>`_ + + :type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only) + :arg x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters + are present in all forms of the command. + :type v: :class:`Buffer` object. Depends of function prototype (for 'v' + prototypes only) + :arg v: Specifies a pointer to an array of two, three, or four elements. The + elements of a two-element array are x and y; of a three-element array, + x, y, and z; and of a four-element array, x, y, z, and w. + + +.. function:: glViewport(x,y,width,height): + + Set the viewport + + .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html>`_ + + :type x, y: int + :arg x, y: Specify the lower left corner of the viewport rectangle, + in pixels. The initial value is (0,0). + :type width, height: int + :arg width, height: Specify the width and height of the viewport. When a GL + context is first attached to a window, width and height are set to the + dimensions of that window. + + +.. function:: gluPerspective(fovY, aspect, zNear, zFar): + + Set up a perspective projection matrix. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5577288} + + :type fovY: double + :arg fovY: Specifies the field of view angle, in degrees, in the y direction. + :type aspect: double + :arg aspect: Specifies the aspect ratio that determines the field of view in the x direction. + The aspect ratio is the ratio of x (width) to y (height). + :type zNear: double + :arg zNear: Specifies the distance from the viewer to the near clipping plane (always positive). + :type zFar: double + :arg zFar: Specifies the distance from the viewer to the far clipping plane (always positive). + + +.. function:: gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz): + + Define a viewing transformation. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5573042} + + :type eyex, eyey, eyez: double + :arg eyex, eyey, eyez: Specifies the position of the eye point. + :type centerx, centery, centerz: double + :arg centerx, centery, centerz: Specifies the position of the reference point. + :type upx, upy, upz: double + :arg upx, upy, upz: Specifies the direction of the up vector. + + +.. function:: gluOrtho2D(left, right, bottom, top): + + Define a 2-D orthographic projection matrix. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + :type left, right: double + :arg left, right: Specify the coordinates for the left and right vertical clipping planes. + :type bottom, top: double + :arg bottom, top: Specify the coordinates for the bottom and top horizontal clipping planes. + + +.. function:: gluPickMatrix(x, y, width, height, viewport): + + Define a picking region. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + :type x, y: double + :arg x, y: Specify the center of a picking region in window coordinates. + :type width, height: double + :arg width, height: Specify the width and height, respectively, of the picking region in window coordinates. + :type viewport: :class:`Buffer` object. [int] + :arg viewport: Specifies the current viewport. + + +.. function:: gluProject(objx, objy, objz, modelMatrix, projMatrix, viewport, winx, winy, winz): + + Map object coordinates to window coordinates. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5578074} + + :type objx, objy, objz: double + :arg objx, objy, objz: Specify the object coordinates. + :type modelMatrix: :class:`Buffer` object. [double] + :arg modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). + :type projMatrix: :class:`Buffer` object. [double] + :arg projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). + :type viewport: :class:`Buffer` object. [int] + :arg viewport: Specifies the current viewport (as from a glGetIntegerv call). + :type winx, winy, winz: :class:`Buffer` object. [double] + :arg winx, winy, winz: Return the computed window coordinates. + + +.. function:: gluUnProject(winx, winy, winz, modelMatrix, projMatrix, viewport, objx, objy, objz): + + Map object coordinates to window coordinates. + + .. seealso:: U{http://biology.ncsa.uiuc.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_RM/ch06.html#id5582204} + + :type winx, winy, winz: double + :arg winx, winy, winz: Specify the window coordinates to be mapped. + :type modelMatrix: :class:`Buffer` object. [double] + :arg modelMatrix: Specifies the current modelview matrix (as from a glGetDoublev call). + :type projMatrix: :class:`Buffer` object. [double] + :arg projMatrix: Specifies the current projection matrix (as from a glGetDoublev call). + :type viewport: :class:`Buffer` object. [int] + :arg viewport: Specifies the current viewport (as from a glGetIntegerv call). + :type objx, objy, objz: :class:`Buffer` object. [double] + :arg objx, objy, objz: Return the computed object coordinates. + + +class Buffer: + + The Buffer object is simply a block of memory that is delineated and initialized by the + user. Many OpenGL functions return data to a C-style pointer, however, because this + is not possible in python the Buffer object can be used to this end. Wherever pointer + notation is used in the OpenGL functions the Buffer object can be used in it's bgl + wrapper. In some instances the Buffer object will need to be initialized with the template + parameter, while in other instances the user will want to create just a blank buffer + which will be zeroed by default. + + .. code-block:: python + + import bgl + myByteBuffer = bgl.Buffer(bgl.GL_BYTE, [32, 32]) + bgl.glGetPolygonStipple(myByteBuffer) + print(myByteBuffer.dimensions) + print(myByteBuffer.to_list()) + sliceBuffer = myByteBuffer[0:16] + print(sliceBuffer) + + .. attribute:: dimensions + + The number of dimensions of the Buffer. + + .. method:: to_list() + + The contents of the Buffer as a python list. + + .. method:: __init__(type, dimensions, template = None): + + This will create a new Buffer object for use with other bgl OpenGL commands. + Only the type of argument to store in the buffer and the dimensions of the buffer + are necessary. Buffers are zeroed by default unless a template is supplied, in + which case the buffer is initialized to the template. + + :type type: int + :arg type: The format to store data in. The type should be one of + GL_BYTE, GL_SHORT, GL_INT, or GL_FLOAT. + :type dimensions: An int or sequence object specifying the dimensions of the buffer. + :arg dimensions: If the dimensions are specified as an int a linear array will + be created for the buffer. If a sequence is passed for the dimensions, the buffer + becomes n-Dimensional, where n is equal to the number of parameters passed in the + sequence. Example: [256,2] is a two- dimensional buffer while [256,256,4] creates + a three- dimensional buffer. You can think of each additional dimension as a sub-item + of the dimension to the left. i.e. [10,2] is a 10 element array each with 2 sub-items. + [(0,0), (0,1), (1,0), (1,1), (2,0), ...] etc. + :type template: A python sequence object (optional) + :arg template: A sequence of matching dimensions which will be used to initialize + the Buffer. If a template is not passed in all fields will be initialized to 0. + :rtype: Buffer object + :return: The newly created buffer as a PyObject. + diff --git a/doc/python_api/rst/change_log.rst b/doc/python_api/rst/change_log.rst index 7035ef4311b..e7db5df4a1f 100644 --- a/doc/python_api/rst/change_log.rst +++ b/doc/python_api/rst/change_log.rst @@ -696,3 +696,216 @@ Renamed * **force** -> :class:`bpy.types.MaterialPhysics.fh_force` * **use_normal_align** -> :class:`bpy.types.MaterialPhysics.use_fh_normal` + +2.57 to 2.58 +============ + +bpy_extras +---------- + +Added +^^^^^ + +* :mod:`bpy_extras` +* :mod:`bpy_extras.view3d_utils` + +Moved +^^^^^ + +* io_utils -> :mod:`bpy_extras.io_utils` +* image_utils -> :mod:`bpy_extras.image_utils` +* mesh_utils -> :mod:`bpy_extras.mesh_utils` +* object_utils -> :mod:`bpy_extras.object_utils` + +bpy.types.RenderSettings +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.RenderSettings.use_bake_lores_mesh` +* :class:`bpy.types.RenderSettings.use_bake_multires` + +bpy.types.Camera +---------------- + +Added +^^^^^ + +* :class:`bpy.types.Camera.show_guide` + +bpy.types.SpaceImageEditor +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceImageEditor.zoom` + +bpy.types.SpaceView3D +--------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceView3D.lock_camera` + +bpy.types.RegionView3D +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.RegionView3D.is_perspective` + +bpy.types.Scene +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Scene.frame_subframe` + +bpy.types.Area +-------------- + +Removed +^^^^^^^ + +* **active_space** + +bpy.types.DisplaceModifier +-------------------------- + +Renamed +^^^^^^^ + +* **texture_coordinate_object** -> :class:`bpy.types.DisplaceModifier.texture_coords_object` + +bpy.types.UserPreferencesView +----------------------------- + +Added +^^^^^ + +* :class:`bpy.types.UserPreferencesView.use_camera_lock_parent` + +bpy.types.DomainFluidSettings +----------------------------- + +Added +^^^^^ + +* :class:`bpy.types.DomainFluidSettings.fluid_mesh_vertices` +* :class:`bpy.types.DomainFluidSettings.surface_noobs` + +bpy.types.Sculpt +---------------- + +Added +^^^^^ + +* :class:`bpy.types.Sculpt.use_deform_only` + +bpy.types.ClothCollisionSettings +-------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ClothCollisionSettings.distance_repel` +* :class:`bpy.types.ClothCollisionSettings.repel_force` + +bpy.types.UILayout +------------------ + +Added +^^^^^ + +* :class:`bpy.types.UILayout.template_edit_mode_selection` + +bpy.types.ToolSettings +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.ToolSettings.use_snap_project_self` + +bpy.types.Mesh +-------------- + +Removed +^^^^^^^ + +* **edge_face_count** +* **edge_face_count_dict** +* **edge_loops_from_edges** +* **edge_loops_from_faces** + +bpy.types.PointDensity +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.PointDensity.falloff_curve` +* :class:`bpy.types.PointDensity.falloff_speed_scale` +* :class:`bpy.types.PointDensity.use_falloff_curve` + +bpy.types.SpaceTextEditor +------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceTextEditor.use_match_case` + +bpy.types.CameraActuator +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.CameraActuator.damping` + +bpy.types.Property +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Property.is_skip_save` + +bpy.types.UserPreferencesSystem +------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.UserPreferencesSystem.anisotropic_filter` + +bpy.types.Object +---------------- + +Added +^^^^^ + +* :class:`bpy.types.Object.empty_image_offset` + +bpy.types.Image +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Image.resolution` + +bpy.types.SceneGameData +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.SceneGameData.use_glsl_color_management` + diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index eb4fc4716e6..7a56e73b7ad 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -24,17 +24,17 @@ Dump the python API into a text file so we can generate changelogs. output from this tool should be added into "doc/python_api/rst/change_log.rst" # dump api blender_version.py in CWD -blender --background --python intern/tools/rna_api_dump.py -- --dump +blender --background --python doc/python_api/sphinx_changelog_gen.py -- --dump # create changelog -blender --background --python intern/tools/rna_api_dump.py -- \ +blender --background --python doc/python_api/sphinx_changelog_gen.py -- \ --api_from blender_2_56_1.py \ --api_to blender_2_57_0.py \ --api_out changes.rst # Api comparison can also run without blender -python intern/tools/rna_api_dump.py +python doc/python_api/sphinx_changelog_gen.py \ --api_from blender_api_2_56_6.py \ --api_to blender_api_2_57.py \ --api_out changes.rst diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 03c8fe1b4ff..6b514cf9eb1 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -29,14 +29,15 @@ For HTML generation ./blender.bin --background --python doc/python_api/sphinx_doc_gen.py - This will generate python files in doc/python_api/sphinx-in/, - assuming that ./blender.bin is or links to the blender executable + This will generate python files in doc/python_api/sphinx-in/ + providing ./blender.bin is or links to the blender executable - Generate html docs by running... - sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out + cd doc/python_api + sphinx-build sphinx-in sphinx-out - assuming that you have sphinx 1.0.7 installed + This requires sphinx 1.0.7 to be installed. For PDF generation ------------------ @@ -47,6 +48,15 @@ For PDF generation make ''' +# Check we're running in blender +if __import__("sys").modules.get("bpy") is None: + print("\nError, this script must run from inside blender2.5") + print(script_help_msg) + + import sys + sys.exit() + + # Switch for quick testing if 1: # full build @@ -57,16 +67,17 @@ if 1: else: # for testing so doc-builds dont take so long. EXCLUDE_MODULES = ( - # "bpy.context", + "bpy.context", "bpy.app", "bpy.path", "bpy.data", "bpy.props", "bpy.utils", "bpy.context", - # "bpy.types", # supports filtering + "bpy.types", # supports filtering "bpy.ops", # supports filtering - "bge", + "bpy_extras", + # "bge", "aud", "bgl", "blf", @@ -204,10 +215,24 @@ def write_indented_lines(ident, fn, text, strip=True): ''' if text is None: return - for l in text.split("\n"): - if strip: - fn(ident + l.strip() + "\n") - else: + + lines = text.split("\n") + + # strip empty lines from the start/end + while lines and not lines[0].strip(): + del lines[0] + while lines and not lines[-1].strip(): + del lines[-1] + + if strip: + ident_strip = 1000 + for l in lines: + if l.strip(): + ident_strip = min(ident_strip, len(l) - len(l.lstrip())) + for l in lines: + fn(ident + l[ident_strip:] + "\n") + else: + for l in lines: fn(ident + l + "\n") @@ -252,7 +277,7 @@ def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True): fw(ident + ".. %s:: %s%s\n\n" % (func_type, identifier, arg_str)) if py_func.__doc__: - write_indented_lines(ident + " ", fw, py_func.__doc__.strip()) + write_indented_lines(ident + " ", fw, py_func.__doc__) fw("\n") @@ -267,8 +292,10 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier): if type(descr) == GetSetDescriptorType: fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, doc, False) + fw("\n") elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType): write_indented_lines(ident, fw, doc, False) + fw("\n") else: raise TypeError("type was not GetSetDescriptorType, MethodDescriptorType or ClassMethodDescriptorType") @@ -316,11 +343,17 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): attribute_set = set() filepath = os.path.join(BASEPATH, module_name + ".rst") + module_all = getattr(module, "__all__", None) + module_dir = sorted(dir(module)) + + if module_all: + module_dir = module_all + file = open(filepath, "w") fw = file.write - write_title(fw, title, "=") + write_title(fw, "%s (%s)" % (title, module_name), "=") fw(".. module:: %s\n\n" % module_name) @@ -331,6 +364,35 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): write_example_ref("", fw, module_name) + # write submodules + # we could also scan files but this ensures __all__ is used correctly + if module_all is not None: + submod_name = None + submod = None + submod_ls = [] + for submod_name in module_all: + ns = {} + exec_str = "from %s import %s as submod" % (module.__name__, submod_name) + exec(exec_str, ns, ns) + submod = ns["submod"] + if type(submod) == types.ModuleType: + submod_ls.append((submod_name, submod)) + + del submod_name + del submod + + if submod_ls: + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + + for submod_name, submod in submod_ls: + submod_name_full = "%s.%s" % (module_name, submod_name) + fw(" %s.rst\n\n" % submod_name_full) + + pymodule2sphinx(BASEPATH, submod_name_full, submod, "%s submodule" % module_name) + del submod_ls + # done writing submodules! + # write members of the module # only tested with PyStructs which are not exactly modules for key, descr in sorted(type(module).__dict__.items()): @@ -348,15 +410,15 @@ def pymodule2sphinx(BASEPATH, module_name, module, title): if descr.__doc__: fw(".. data:: %s\n\n" % key) write_indented_lines(" ", fw, descr.__doc__, False) - attribute_set.add(key) fw("\n") + attribute_set.add(key) + del key, descr classes = [] - for attribute in sorted(dir(module)): + for attribute in module_dir: if not attribute.startswith("_"): - if attribute in attribute_set: continue @@ -927,6 +989,7 @@ def rna2sphinx(BASEPATH): fw("\n") fw("* `Quickstart Intro <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>`_ if you are new to scripting in blender and want to get you're feet wet!\n") fw("* `Blender/Python Overview <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Overview>`_ for a more complete explanation of python integration in blender\n") + fw("\n") fw("===================\n") fw("Application Modules\n") @@ -966,12 +1029,14 @@ def rna2sphinx(BASEPATH): fw(" mathutils.rst\n\n") if "mathutils.geometry" not in EXCLUDE_MODULES: fw(" mathutils.geometry.rst\n\n") - # XXX TODO - #fw(" bgl.rst\n\n") + if "bgl" not in EXCLUDE_MODULES: + fw(" bgl.rst\n\n") if "blf" not in EXCLUDE_MODULES: fw(" blf.rst\n\n") if "aud" not in EXCLUDE_MODULES: fw(" aud.rst\n\n") + if "bpy_extras" not in EXCLUDE_MODULES: + fw(" bpy_extras.rst\n\n") # game engine if "bge" not in EXCLUDE_MODULES: @@ -984,7 +1049,9 @@ def rna2sphinx(BASEPATH): fw(" bge.types.rst\n\n") fw(" bge.logic.rst\n\n") fw(" bge.render.rst\n\n") + fw(" bge.texture.rst\n\n") fw(" bge.events.rst\n\n") + fw(" bge.constraints.rst\n\n") # rna generated change log fw("========\n") @@ -1068,41 +1135,47 @@ def rna2sphinx(BASEPATH): # python modules if "bpy.utils" not in EXCLUDE_MODULES: from bpy import utils as module - pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities (bpy.utils)") + pymodule2sphinx(BASEPATH, "bpy.utils", module, "Utilities") if "bpy.path" not in EXCLUDE_MODULES: from bpy import path as module - pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities (bpy.path)") + pymodule2sphinx(BASEPATH, "bpy.path", module, "Path Utilities") + + if "bpy_extras" not in EXCLUDE_MODULES: + import bpy_extras as module + pymodule2sphinx(BASEPATH, "bpy_extras", module, "Extra Utilities") # C modules if "bpy.app" not in EXCLUDE_MODULES: from bpy import app as module - pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data (bpy.app)") + pymodule2sphinx(BASEPATH, "bpy.app", module, "Application Data") if "bpy.props" not in EXCLUDE_MODULES: from bpy import props as module - pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions (bpy.props)") + pymodule2sphinx(BASEPATH, "bpy.props", module, "Property Definitions") if "mathutils" not in EXCLUDE_MODULES: import mathutils as module - pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities (mathutils)") + pymodule2sphinx(BASEPATH, "mathutils", module, "Math Types & Utilities") if "mathutils.geometry" not in EXCLUDE_MODULES: import mathutils.geometry as module - pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities (mathutils.geometry)") + pymodule2sphinx(BASEPATH, "mathutils.geometry", module, "Geometry Utilities") - if "mathutils.geometry" not in EXCLUDE_MODULES: + if "blf" not in EXCLUDE_MODULES: import blf as module - pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)") + pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing") - # XXX TODO - #import bgl as module - #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper (bgl)") - #del module + if "bgl" not in EXCLUDE_MODULES: + #import bgl as module + #pymodule2sphinx(BASEPATH, "bgl", module, "Blender OpenGl wrapper") + #del module + import shutil + shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bgl.rst"), BASEPATH) if "aud" not in EXCLUDE_MODULES: import aud as module - pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)") + pymodule2sphinx(BASEPATH, "aud", module, "Audio System") del module ## game engine @@ -1112,7 +1185,9 @@ def rna2sphinx(BASEPATH): shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.types.rst"), BASEPATH) shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.logic.rst"), BASEPATH) shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.render.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.texture.rst"), BASEPATH) shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.events.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.constraints.rst"), BASEPATH) shutil.copy2(os.path.join(BASEPATH, "..", "rst", "change_log.rst"), BASEPATH) @@ -1137,72 +1212,67 @@ def rna2sphinx(BASEPATH): def main(): - import bpy - if 'bpy' not in dir(): - print("\nError, this script must run from inside blender2.5") - print(script_help_msg) - else: - import shutil + import shutil - script_dir = os.path.dirname(__file__) - path_in = os.path.join(script_dir, "sphinx-in") - path_out = os.path.join(script_dir, "sphinx-out") - path_examples = os.path.join(script_dir, "examples") - # only for partial updates - path_in_tmp = path_in + "-tmp" + script_dir = os.path.dirname(__file__) + path_in = os.path.join(script_dir, "sphinx-in") + path_out = os.path.join(script_dir, "sphinx-out") + path_examples = os.path.join(script_dir, "examples") + # only for partial updates + path_in_tmp = path_in + "-tmp" - if not os.path.exists(path_in): - os.mkdir(path_in) + if not os.path.exists(path_in): + os.mkdir(path_in) - for f in os.listdir(path_examples): - if f.endswith(".py"): - EXAMPLE_SET.add(os.path.splitext(f)[0]) + for f in os.listdir(path_examples): + if f.endswith(".py"): + EXAMPLE_SET.add(os.path.splitext(f)[0]) - # only for full updates - if _BPY_FULL_REBUILD: - shutil.rmtree(path_in, True) - shutil.rmtree(path_out, True) - else: - # write here, then move - shutil.rmtree(path_in_tmp, True) - - rna2sphinx(path_in_tmp) - - if not _BPY_FULL_REBUILD: - import filecmp - - # now move changed files from 'path_in_tmp' --> 'path_in' - file_list_path_in = set(os.listdir(path_in)) - file_list_path_in_tmp = set(os.listdir(path_in_tmp)) - - # remove deprecated files that have been removed. - for f in sorted(file_list_path_in): - if f not in file_list_path_in_tmp: - print("\tdeprecated: %s" % f) - os.remove(os.path.join(path_in, f)) - - # freshen with new files. - for f in sorted(file_list_path_in_tmp): - f_from = os.path.join(path_in_tmp, f) - f_to = os.path.join(path_in, f) - - do_copy = True - if f in file_list_path_in: - if filecmp.cmp(f_from, f_to): - do_copy = False - - if do_copy: - print("\tupdating: %s" % f) - shutil.copy(f_from, f_to) - '''else: - print("\tkeeping: %s" % f) # eh, not that useful''' - - EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED - if EXAMPLE_SET_UNUSED: - print("\nUnused examples found in '%s'..." % path_examples) - for f in EXAMPLE_SET_UNUSED: - print(" %s.py" % f) - print(" %d total\n" % len(EXAMPLE_SET_UNUSED)) + # only for full updates + if _BPY_FULL_REBUILD: + shutil.rmtree(path_in, True) + shutil.rmtree(path_out, True) + else: + # write here, then move + shutil.rmtree(path_in_tmp, True) + + rna2sphinx(path_in_tmp) + + if not _BPY_FULL_REBUILD: + import filecmp + + # now move changed files from 'path_in_tmp' --> 'path_in' + file_list_path_in = set(os.listdir(path_in)) + file_list_path_in_tmp = set(os.listdir(path_in_tmp)) + + # remove deprecated files that have been removed. + for f in sorted(file_list_path_in): + if f not in file_list_path_in_tmp: + print("\tdeprecated: %s" % f) + os.remove(os.path.join(path_in, f)) + + # freshen with new files. + for f in sorted(file_list_path_in_tmp): + f_from = os.path.join(path_in_tmp, f) + f_to = os.path.join(path_in, f) + + do_copy = True + if f in file_list_path_in: + if filecmp.cmp(f_from, f_to): + do_copy = False + + if do_copy: + print("\tupdating: %s" % f) + shutil.copy(f_from, f_to) + '''else: + print("\tkeeping: %s" % f) # eh, not that useful''' + + EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED + if EXAMPLE_SET_UNUSED: + print("\nUnused examples found in '%s'..." % path_examples) + for f in EXAMPLE_SET_UNUSED: + print(" %s.py" % f) + print(" %d total\n" % len(EXAMPLE_SET_UNUSED)) import sys sys.exit() diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 5f23ca395b6..a3befe1b7cb 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -38,8 +38,11 @@ cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html ssh $SSH_USER@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' rsync --progress -avze "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ -# symlink the dir to a static URL -ssh $SSH_USER@emo.blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc' +## symlink the dir to a static URL +#ssh $SSH_USER@emo.blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc' + +# better redirect +ssh $SSH_USER@emo.blender.org 'echo "<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\" content=\"0;url=../blender_python_api_'$BLENDER_VERSION'/\"></head><body>Redirecting...</body></html>" > '$SSH_UPLOAD'/250PythonDoc/index.html' # pdf sphinx-build -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out |