Home | Trees | Index | Help |
|
---|
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(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": "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 instructions = "Hold mouse buttons to change the background color." quitting = " Press ESC or q to quit." # 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(1,1,1) # change default color glRasterPos2i(50,100) # move cursor to x = 50, y = 100 Draw.Text("Testing BGL + Draw") # draw this text there glRasterPos2i(350,20) # 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 glColor3f(0.35,0.18,0.92) # change default color again glBegin(GL_POLYGON) # another list, for a polygon glVertex2i(315, 292) glVertex2i(412, 200) glVertex2i(264, 256) glEnd() Draw.Redraw(1) # make changes visible. # def ev(evt, val): # this is a 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 evt == Draw.LEFTMOUSE: R = 1 - R elif evt == Draw.MIDDLEMOUSE: G = 1 - G elif evt == Draw.RIGHTMOUSE: B = 1 - B else: Draw.Register(show_win, ev, None) # Draw.Register(show_win, ev, None) # start the main loop
Classes | |
---|---|
Buffer |
The Buffer object is simply a block of memory that is delineated and initalized by the user. |
Function Summary | |
---|---|
Operate on the accumulation buffer | |
Specify the alpha test function | |
Determine if textures are loaded in texture memory | |
Delimit the vertices of a primitive or a group of like primatives | |
Bind a named texture to a textureing target | |
Draw a bitmap | |
Specify pixel arithmetic | |
Execute a display list | |
Execute a list of display lists | |
Clear buffers to preset values | |
Specify clear values for the accumulation buffer | |
Specify clear values for the color buffers | |
Specify the clear value for the depth buffer | |
Specify the clear value for the color index buffers | |
Specify the clear value for the stencil buffer | |
Specify a plane against which all geometery is clipped | |
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 | |
Enable and disable writing of frame buffer color components | |
Cause a material color to track the current color | |
Copy pixels in the frame buffer | |
Specify whether front- or back-facing facets can be culled | |
Delete a contiguous group of display lists | |
Delete named textures | |
Specify the value used for depth buffer comparisons | |
Enable or disable writing into the depth buffer | |
Specify mapping of depth values from normalized device coordinates to window coordinates | |
Disable server-side GL capabilities | |
Specify which color buffers are to be drawn into | |
Write a block of pixels to the frame buffer | |
glEdgeFlag, glEdgeFlagv | |
Enable server-side GL capabilities | |
Delimit the vertices of a primitive or group of like primitives | |
Create or replace a display list | |
glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, glEvalCoord2dv, glEvalCoord2fv | |
glEvalMesh1 or glEvalMesh2 | |
glEvalPoint1 and glEvalPoint2 | |
Controls feedback mode | |
Block until all GL execution is complete | |
Force Execution of GL commands in finite time | |
glFogf, glFogi, glFogfv, glFogiv | |
Define front- and back-facing polygons | |
Multiply the current matrix by a perspective matrix | |
Generate a contiguous set of empty display lists | |
Generate texture names | |
glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv | |
Return the coefficients of the specified clipping plane | |
Return error information | |
glGetLightfv and glGetLightiv | |
glGetMapdv, glGetMapfv, glGetMapiv | |
glGetMaterialfv, glGetMaterialiv | |
glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv | |
Return the polygon stipple pattern | |
Return a strin describing the current GL connection | |
glGetTexEnvfv, glGetTexEnviv | |
glGetTexGendv, glGetTexGenfv, glGetTexGeniv | |
Return a texture image | |
glGetTexLevelParameterfv, glGetTexLevelParameteriv | |
glGetTexParameterfv, glGetTexParameteriv | |
Specify implementation-specific hints | |
glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv | |
Initialize the name stack | |
Test whether a capability is enabled | |
Determine if a name corresponds to a display-list | |
Determine if a name corresponds to a texture | |
glLightf,glLighti, glLightfv, glLightiv | |
glLightModelf, glLightModeli, glLightModelfv, glLightModeliv | |
Specify the line stipple pattern | |
Specify the width of rasterized lines. | |
Set the display-list base for glCallLists | |
Replace the current matrix with the identity matrix | |
glLoadMatrixd, glLoadMatixf | |
Load a name onto the name stack. | |
Specify a logical pixel operation for color index rendering | |
glMap1d, glMap1f | |
glMap2d, glMap2f | |
glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f | |
Specify material parameters for the lighting model. | |
Specify which matrix is the current matrix. | |
glMultMatrixd, glMultMatrixf | |
Create or replace a display list | |
Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, Normal3s, Normal3sv | |
Multiply the current matrix with an orthographic matrix | |
Place a marker in the feedback buffer | |
glPixelMapfv, glPixelMapuiv, glPixelMapusv | |
glPixelStoref, glPixelStorei | |
glPixelTransferf, glPixelTransferi | |
Specify the pixel zoom factors | |
Specify the diameter of rasterized points | |
Select a polygon rasterization mode | |
Set the scale and units used to calculate depth values | |
Set the polygon stippling pattern | |
Pop the server attribute stack | |
Pop the current matrix stack | |
Pop the name stack | |
Set texture residence priority | |
Push the server attribute stack | |
Push the current matrix stack | |
Push the name stack | |
glRasterPos2d, glRasterPos2f, glRasterPos2i, glRasterPos2s, glRasterPos3d, glRasterPos3f, glRasterPos3i, glRasterPos3s, glRasterPos4d, glRasterPos4f, glRasterPos4i, glRasterPos4s, glRasterPos2dv, glRasterPos2fv, glRasterPos2iv, glRasterPos2sv, glRasterPos3dv, glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, glRasterPos4dv, glRasterPos4fv, glRasterPos4iv, glRasterPos4sv | |
Select a color buffer source for pixels. | |
Read a block of pixels from the frame buffer | |
glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv | |
Set rasterization mode | |
glRotated, glRotatef | |
glScaled, glScalef | |
Define the scissor box | |
Establish a buffer for selection mode values | |
Select flat or smooth shading | |
Set function and reference value for stencil testing | |
Control the writing of individual bits in the stencil planes | |
Set stencil test actions | |
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 | |
glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv | |
glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv | |
Specify a one-dimensional texture image | |
Specify a two-dimensional texture image | |
glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv | |
glTranslatef, glTranslated | |
glVertex2d, glVertex2f, glVertex2i, glVertex2s, glVertex3d, glVertex3f, glVertex3i, glVertex3s, glVertex4d, glVertex4f, glVertex4i, glVertex4s, glVertex2dv, glVertex2fv, glVertex2iv, glVertex2sv, glVertex3dv, glVertex3fv, glVertex3iv, glVertex3sv, glVertex4dv, glVertex4fv, glVertex4iv, glVertex4sv | |
Set the viewport |
Function Details |
---|
glAccum(op, value)Operate on the accumulation buffer
|
glAlphaFunc(func, ref)Specify the alpha test function
|
glAreTexturesResident(n, textures, residences)Determine if textures are loaded in texture memory
|
glBegin(mode)Delimit the vertices of a primitive or a group of like primatives
|
glBindTexture(target, texture)Bind a named texture to a textureing target
|
glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap)Draw a bitmap
|
glBlendFunc(sfactor, dfactor)Specify pixel arithmetic
|
glCallList(list)Execute a display list
|
glCallLists(n, type, lists)Execute a list of display lists
|
glClear(mask)Clear buffers to preset values
|
glClearAccum(red, green, blue, alpha)Specify clear values for the accumulation buffer
|
glClearColor(red, green, blue, alpha)Specify clear values for the color buffers
|
glClearDepth(depth)Specify the clear value for the depth buffer
|
glClearIndex(c)Specify the clear value for the color index buffers
|
glClearStencil(s)Specify the clear value for the stencil buffer
|
glClipPlane(plane, equation)Specify a plane against which all geometery is clipped
|
glColor(red, green, blue, alpha)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.
|
glColorMask(red, green, blue, alpha)Enable and disable writing of frame buffer color components
|
glColorMaterial(face, mode)Cause a material color to track the current color
|
glCopyPixels(x, y, width, height, type)Copy pixels in the frame buffer
|
glCullFace(mode)Specify whether front- or back-facing facets can be culled
|
glDeleteLists(list, range)Delete a contiguous group of display lists
|
glDeleteTextures(n, textures)Delete named textures
|
glDepthFunc(func)Specify the value used for depth buffer comparisons
|
glDepthMask(flag)Enable or disable writing into the depth buffer
|
glDepthRange(zNear, zFar)Specify mapping of depth values from normalized device coordinates to window coordinates
|
glDisable(cap)Disable server-side GL capabilities
|
glDrawBuffer(mode)Specify which color buffers are to be drawn into
|
glDrawPixels(width, height, format, type, pixels)Write a block of pixels to the frame buffer
|
glEdgeFlag(flag)glEdgeFlag, glEdgeFlagv Flag edges as either boundary or nonboundary
|
glEnable(cap)Enable server-side GL capabilities
|
glEnd()Delimit the vertices of a primitive or group of like primitives |
glEndList()Create or replace a display list |
glEvalCoord(u, v)glEvalCoord1d, glEvalCoord1f, glEvalCoord2d, glEvalCoord2f, glEvalCoord1dv, glEvalCoord1fv, glEvalCoord2dv, glEvalCoord2fv Evaluate enabled one- and two-dimensional maps
|
glEvalMesh(mode, i1, i2)glEvalMesh1 or glEvalMesh2 Compute a one- or two-dimensional grid of points or lines
|
glEvalPoint(i, j)glEvalPoint1 and glEvalPoint2 Generate and evaluate a single point in a mesh
|
glFeedbackBuffer(size, type, buffer)Controls feedback mode
|
glFinish()Block until all GL execution is complete |
glFlush()Force Execution of GL commands in finite time |
glFog(pname, param)glFogf, glFogi, glFogfv, glFogiv Specify fog parameters
|
glFrontFace(mode)Define front- and back-facing polygons
|
glFrustum(left, right, bottom, top, zNear, zFar)Multiply the current matrix by a perspective matrix
|
glGenLists(range)Generate a contiguous set of empty display lists
|
glGenTextures(n, textures)Generate texture names
|
glGet(pname, param)glGetBooleanv, glGetfloatv, glGetFloatv, glGetIntegerv Return the value or values of a selected parameter
|
glGetClipPlane(plane, equation)Return the coefficients of the specified clipping plane
|
glGetError()Return error information |
glGetLight(light, pname, params)glGetLightfv and glGetLightiv Return light source parameter values
|
glGetMap(target, query, v)glGetMapdv, glGetMapfv, glGetMapiv Return evaluator parameters
|
glGetMaterial(face, pname, params)glGetMaterialfv, glGetMaterialiv Return material parameters
|
glGetPixelMap(map, values)glGetPixelMapfv, glGetPixelMapuiv, glGetPixelMapusv Return the specified pixel map
|
glGetPolygonStipple(mask)Return the polygon stipple pattern
|
glGetString(name)Return a strin describing the current GL connection
|
glGetTexEnv(target, pname, params)glGetTexEnvfv, glGetTexEnviv Return texture environment parameters
|
glGetTexGen(coord, pname, params)glGetTexGendv, glGetTexGenfv, glGetTexGeniv Return texture coordinate generation parameters
|
glGetTexImage(target, level, format, type, pixels)Return a texture image
|
glGetTexLevelParameter(target, level, pname, params)glGetTexLevelParameterfv, glGetTexLevelParameteriv return texture parameter values for a specific level of detail
|
glGetTexParameter(target, pname, params)glGetTexParameterfv, glGetTexParameteriv Return texture parameter values
|
glHint(target, mode)Specify implementation-specific hints
|
glIndex(c)glIndexd, glIndexf, glIndexi, glIndexs, glIndexdv, glIndexfv, glIndexiv, glIndexsv Set the current color index
|
glInitNames()Initialize the name stack |
glIsEnabled(cap)Test whether a capability is enabled
|
glIsList(list)Determine if a name corresponds to a display-list
|
glIsTexture(texture)Determine if a name corresponds to a texture
|
glLight(light, pname, param)glLightf,glLighti, glLightfv, glLightiv Set the light source parameters
|
glLightModel(pname, param)glLightModelf, glLightModeli, glLightModelfv, glLightModeliv Set the lighting model parameters
|
glLineStipple(factor, pattern)Specify the line stipple pattern
|
glLineWidth(width)Specify the width of rasterized lines.
|
glListBase(base)Set the display-list base for glCallLists
|
glLoadIdentity()Replace the current matrix with the identity matrix |
glLoadMatrix(m)glLoadMatrixd, glLoadMatixf Replace the current matrix with the specified matrix
|
glLoadName(name)Load a name onto the name stack.
|
glLogicOp(opcode)Specify a logical pixel operation for color index rendering
|
glMap1(target, u1, u2, stride, order, points)glMap1d, glMap1f Define a one-dimensional evaluator
|
glMap2(target, u1, u2, ustride, uorder, v1, v2, vstride, vorder, points)glMap2d, glMap2f Define a two-dimensional evaluator
|
glMapGrid(un, u1, u2, vn, v1, v2)glMapGrid1d, glMapGrid1f, glMapGrid2d, glMapGrid2f Define a one- or two-dimensional mesh
|
glMaterial(face, pname, params)Specify material parameters for the lighting model.
|
glMatrixMode(mode)Specify which matrix is the current matrix.
|
glMultMatrix(m)glMultMatrixd, glMultMatrixf Multiply the current matrix with the specified matrix
|
glNewList(list, mode)Create or replace a display list
|
glNormal3(nx, ny, nz, v)Normal3b, Normal3bv, Normal3d, Normal3dv, Normal3f, Normal3fv, Normal3i, Normal3iv, Normal3s, Normal3sv Set the current normal vector
|
glOrtho(left, right, bottom, top, zNear, zFar)Multiply the current matrix with an orthographic matrix
|
glPassThrough(token)Place a marker in the feedback buffer
|
glPixelMap(map, mapsize, values)glPixelMapfv, glPixelMapuiv, glPixelMapusv Set up pixel transfer maps
|
glPixelStore(pname, param)glPixelStoref, glPixelStorei Set pixel storage modes
|
glPixelTransfer(pname, param)glPixelTransferf, glPixelTransferi Set pixel transfer modes
|
glPixelZoom(xfactor, yfactor)Specify the pixel zoom factors
|
glPointSize(size)Specify the diameter of rasterized points
|
glPolygonMode(face, mode)Select a polygon rasterization mode
|
glPolygonOffset(factor, units)Set the scale and units used to calculate depth values
|
glPolygonStipple(mask)Set the polygon stippling pattern
|
glPopAttrib()Pop the server attribute stack |
glPopMatrix()Pop the current matrix stack |
glPopName()Pop the name stack |
glPrioritizeTextures(n, textures, priorities)Set texture residence priority
|
glPushAttrib(mask)Push the server attribute stack
|
glPushMatrix()Push the current matrix stack |
glPushName(name)Push the name stack
|
glRasterPos(x, y, z, w)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
|
glReadBuffer(mode)Select a color buffer source for pixels.
|
glReadPixels(x, y, width, height, format, type, pixels)Read a block of pixels from the frame buffer
|
glRect(x1, y1, x2, y2, v1, v2)glRectd, glRectf, glRecti, glRects, glRectdv, glRectfv, glRectiv, glRectsv Draw a rectangle
|
glRenderMode(mode)Set rasterization mode
|
glRotate(angle, x, y, z)glRotated, glRotatef Multiply the current matrix by a rotation matrix
|
glScale(x, y, z)glScaled, glScalef Multiply the current matrix by a general scaling matrix
|
glScissor(x, y, width, height)Define the scissor box
|
glSelectBuffer(size, buffer)Establish a buffer for selection mode values
|
glShadeModel(mode)Select flat or smooth shading
|
glStencilFuc(func, ref, mask)Set function and reference value for stencil testing
|
glStencilMask(mask)Control the writing of individual bits in the stencil planes
|
glStencilOp(fail, zfail, zpass)Set stencil test actions
|
glTexCoord(s, t, r, q, v)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
|
glTexEnv(target, pname, param)glTextEnvf, glTextEnvi, glTextEnvfv, glTextEnviv Set texture environment parameters
|
glTexGen(coord, pname, param)glTexGend, glTexGenf, glTexGeni, glTexGendv, glTexGenfv, glTexGeniv Control the generation of texture coordinates
|
glTexImage1D(target, level, internalformat, width, border, format, type, pixels)Specify a one-dimensional texture image
|
glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels)Specify a two-dimensional texture image
|
glTexParameter(target, pname, param)glTexParameterf, glTexParameteri, glTexParameterfv, glTexParameteriv Set texture parameters
|
glTranslate(x, y, z)glTranslatef, glTranslated Multiply the current matrix by a translation matrix
|
glVertex(x, y, z, w, v)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
|
glViewport(x, y, width, height)Set the viewport
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.0 on Tue Nov 11 20:06:11 2003 | http://epydoc.sf.net |