Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoerg Mueller <nexyon@gmail.com>2011-07-22 01:11:58 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-22 01:11:58 +0400
commit4532bd731d5edbe348d4df810856f6bdfdea705c (patch)
tree778fdcd594b5f384eacf5cd82f50afc10bbed513 /doc
parentcf34f7509f4ea8c3f0c92045933f089c72de5313 (diff)
parentbbfe3c9c49523d3987a3144da119d8f6afd09cf9 (diff)
Merge with trunk up to r38584.
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bge.texture.py2
-rw-r--r--doc/python_api/rst/bgl.rst41
2 files changed, 22 insertions, 21 deletions
diff --git a/doc/python_api/examples/bge.texture.py b/doc/python_api/examples/bge.texture.py
index b27c357b1ee..0ec9aa16bca 100644
--- a/doc/python_api/examples/bge.texture.py
+++ b/doc/python_api/examples/bge.texture.py
@@ -29,4 +29,4 @@ if not hasattr(logic, 'video'):
logic.video.source.play()
# you need to call this function every frame to ensure update of the texture.
-logic.video.refresh(True) \ No newline at end of file
+logic.video.refresh(True)
diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst
index 743f1c33e27..76b7442f2c5 100644
--- a/doc/python_api/rst/bgl.rst
+++ b/doc/python_api/rst/bgl.rst
@@ -1379,14 +1379,15 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
.. code-block:: python
- import Blender
- from Blender.BGL import *
+ import bgl
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)
+ 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):
@@ -1839,32 +1840,32 @@ 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
+ 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
+ .. 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
+ print(sliceBuffer)
- .. attribute:: list
+ .. attribute:: dimensions
- The contents of the Buffer.
+ The number of dimensions of the Buffer.
- .. attribute:: dimensions
+ .. method:: to_list()
- The size of the Buffer.
+ 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.
+ 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.