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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-11-22 09:15:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-11-22 09:15:52 +0400
commit9d0334bc74b87fc47e54984e8ede7bea84a5b302 (patch)
tree7fef694c5a83c90aaa661388449db97e3ad3d5fc
parent55535b21feafd7bf22aa565e8048b02c0fc76cf7 (diff)
add missing bgl and gpu api docstrings (found using docstring completeness checker)
-rw-r--r--doc/python_api/rst/bgl.rst251
-rw-r--r--doc/python_api/rst/gpu.rst8
-rw-r--r--source/blender/python/generic/bgl.c22
-rw-r--r--source/tests/bl_rst_completeness.py2
-rw-r--r--source/tests/rst_to_doctree_mini.py12
5 files changed, 272 insertions, 23 deletions
diff --git a/doc/python_api/rst/bgl.rst b/doc/python_api/rst/bgl.rst
index eefa30403a2..fc4524b1213 100644
--- a/doc/python_api/rst/bgl.rst
+++ b/doc/python_api/rst/bgl.rst
@@ -689,7 +689,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Return the specified pixel map
- .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPixelMap.xml>`_
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPixelMap.xml>`_
:type map: Enumerated constant
:arg map: Specifies the name of the pixel map to return.
@@ -701,7 +701,7 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Return the polygon stipple pattern
- .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetPolygonStipple.xml>`_
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glGetPolygonStipple.xml>`_
:type mask: :class:`bgl.Buffer` object I{type GL_BYTE}
:arg mask: Returns the stipple pattern. The initial value is all 1's.
@@ -824,13 +824,25 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
Set the current color index
- .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIndex.xml>`_
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndex.xml>`_
:type c: :class:`bgl.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:: glIndexMask(mask):
+
+ Control the writing of individual bits in the color index buffers
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man2/xhtml/glIndexMask.xml>`_
+
+ :type mask: int
+ :arg mask: Specifies a bit mask to enable and disable the writing of individual bits
+ in the color index buffers.
+ Initially, the mask is all 1's.
+
+
.. function:: glInitNames():
Initialize the name stack
@@ -1835,7 +1847,238 @@ OpenGL}" and the online NeHe tutorials are two of the best resources.
:arg objx, objy, objz: Return the computed object coordinates.
-class Buffer:
+.. function:: glUseProgram(program):
+
+ Installs a program object as part of current rendering state
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glUseProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the handle of the program object whose executables are to be used as part of current rendering state.
+
+
+.. function:: glValidateProgram(program):
+
+ Validates a program object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glValidateProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the handle of the program object to be validated.
+
+
+.. function:: glLinkProgram(program):
+
+ Links a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glLinkProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the handle of the program object to be linked.
+
+
+.. function:: glActiveTexture(texture):
+
+ Select active texture unit.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glActiveTexture.xml>`_
+
+ :type texture: int
+ :arg texture: Constant in ``GL_TEXTURE0`` 0 - 8
+
+
+.. function:: glAttachShader(program, shader):
+
+ Attaches a shader object to a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glAttachShader.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to which a shader object will be attached.
+ :type shader: int
+ :arg shader: Specifies the shader object that is to be attached.
+
+
+.. function:: glCompileShader(shader):
+
+ Compiles a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCompileShader.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object to be compiled.
+
+
+.. function:: glCreateProgram():
+
+ Creates a program object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateProgram.xml>`_
+
+ :rtype: int
+ :return: The new program or zero if an error occurs.
+
+
+.. function:: glCreateShader(shaderType):
+
+ Creates a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glCreateShader.xml>`_
+
+ :type shaderType: Specifies the type of shader to be created.
+ Must be one of ``GL_VERTEX_SHADER``,
+ ``GL_TESS_CONTROL_SHADER``,
+ ``GL_TESS_EVALUATION_SHADER``,
+ ``GL_GEOMETRY_SHADER``,
+ or ``GL_FRAGMENT_SHADER``.
+ :arg shaderType:
+ :rtype: int
+ :return: 0 if an error occurs.
+
+
+.. function:: glDeleteProgram(program):
+
+ Deletes a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to be deleted.
+
+
+.. function:: glDeleteShader(shader):
+
+ Deletes a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDeleteShader.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object to be deleted.
+
+
+.. function:: glDetachShader(program, shader):
+
+ Detaches a shader object from a program object to which it is attached.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glDetachShader.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object from which to detach the shader object.
+ :type shader: int
+ :arg shader: pecifies the program object from which to detach the shader object.
+
+
+.. function:: glGetAttachedShaders(program, maxCount, count, shaders):
+
+ Returns the handles of the shader objects attached to a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetAttachedShaders.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to be queried.
+ :type maxCount: int
+ :arg maxCount: Specifies the size of the array for storing the returned object names.
+ :type count: :class:`bgl.Buffer` int buffer.
+ :arg count: Returns the number of names actually returned in objects.
+ :type shaders: :class:`bgl.Buffer` int buffer.
+ :arg shaders: Specifies an array that is used to return the names of attached shader objects.
+
+
+.. function:: glGetProgramInfoLog(program, maxLength, length, infoLog):
+
+ Returns the information log for a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgramInfoLog.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object whose information log is to be queried.
+ :type maxLength: int
+ :arg maxLength: Specifies the size of the character buffer for storing the returned information log.
+ :type length: :class:`bgl.Buffer` int buffer.
+ :arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
+ :type infoLog: :class:`bgl.Buffer` char buffer.
+ :arg infoLog: Specifies an array of characters that is used to return the information log.
+
+
+.. function:: glGetShaderInfoLog(program, maxLength, length, infoLog):
+
+ Returns the information log for a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderInfoLog.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object whose information log is to be queried.
+ :type maxLength: int
+ :arg maxLength: Specifies the size of the character buffer for storing the returned information log.
+ :type length: :class:`bgl.Buffer` int buffer.
+ :arg length: Returns the length of the string returned in **infoLog** (excluding the null terminator).
+ :type infoLog: :class:`bgl.Buffer` char buffer.
+ :arg infoLog: Specifies an array of characters that is used to return the information log.
+
+
+.. function:: glGetProgramiv(program, pname, params):
+
+ Returns a parameter from a program object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies the program object to be queried.
+ :type pname: int
+ :arg pname: Specifies the object parameter.
+ :type params: :class:`bgl.Buffer` int buffer.
+ :arg params: Returns the requested object parameter.
+
+
+.. function:: glIsShader(shader):
+
+ Determines if a name corresponds to a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsShader.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies a potential shader object.
+
+
+.. function:: glIsProgram(program):
+
+ Determines if a name corresponds to a program object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glIsProgram.xml>`_
+
+ :type program: int
+ :arg program: Specifies a potential program object.
+
+
+.. function:: glGetShaderSource(shader, bufSize, length, source):
+
+ Returns the source code string from a shader object
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glGetShaderSource.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the shader object to be queried.
+ :type bufSize: int
+ :arg bufSize: Specifies the size of the character buffer for storing the returned source code string.
+ :type length: :class:`bgl.Buffer` int buffer.
+ :arg length: Returns the length of the string returned in source (excluding the null terminator).
+ :type source: :class:`bgl.Buffer` char.
+ :arg source: Specifies an array of characters that is used to return the source code string.
+
+
+.. function:: glShaderSource(shader, shader_string):
+
+ Replaces the source code in a shader object.
+
+ .. seealso:: `OpenGL Docs <http://www.opengl.org/sdk/docs/man/xhtml/glShaderSource.xml>`_
+
+ :type shader: int
+ :arg shader: Specifies the handle of the shader object whose source code is to be replaced.
+ :type shader_string: string
+ :arg shader_string: The shader string.
+
+
+.. 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
diff --git a/doc/python_api/rst/gpu.rst b/doc/python_api/rst/gpu.rst
index 68dc30b6143..a225829b3e8 100644
--- a/doc/python_api/rst/gpu.rst
+++ b/doc/python_api/rst/gpu.rst
@@ -262,10 +262,16 @@ The calculation of some of the uniforms is based on matrices available in the sc
.. data:: GPU_DYNAMIC_SAMPLER_2DSHADOW
+ The uniform is an float representing the bumpmap scaling.
+
+ :value: 14
+
+.. data:: GPU_DYNAMIC_OBJECT_AUTOBUMPSCALE
+
The uniform is an integer representing a shadow buffer corresponding to a lamp
casting shadow.
- :value: 14
+ :value: 15
GLSL attribute type
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index a10bfef2a8d..22b9c1a2208 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -613,15 +613,15 @@ static PyObject *Buffer_repr(Buffer *self)
}
-BGL_Wrap(2, Accum, void, (GLenum, GLfloat))
-BGL_Wrap(1, ActiveTexture, void, (GLenum))
-BGL_Wrap(2, AlphaFunc, void, (GLenum, GLclampf))
+BGL_Wrap(2, Accum, void, (GLenum, GLfloat))
+BGL_Wrap(1, ActiveTexture, void, (GLenum))
+BGL_Wrap(2, AlphaFunc, void, (GLenum, GLclampf))
BGL_Wrap(3, AreTexturesResident, GLboolean, (GLsizei, GLuintP, GLbooleanP))
BGL_Wrap(2, AttachShader, void, (GLuint, GLuint))
-BGL_Wrap(1, Begin, void, (GLenum))
-BGL_Wrap(2, BindTexture, void, (GLenum, GLuint))
-BGL_Wrap(7, Bitmap, void, (GLsizei, GLsizei, GLfloat,
- GLfloat, GLfloat, GLfloat, GLubyteP))
+BGL_Wrap(1, Begin, void, (GLenum))
+BGL_Wrap(2, BindTexture, void, (GLenum, GLuint))
+BGL_Wrap(7, Bitmap, void, (GLsizei, GLsizei, GLfloat,
+ GLfloat, GLfloat, GLfloat, GLubyteP))
BGL_Wrap(2, BlendFunc, void, (GLenum, GLenum))
BGL_Wrap(1, CallList, void, (GLuint))
BGL_Wrap(3, CallLists, void, (GLsizei, GLenum, GLvoidP))
@@ -675,7 +675,7 @@ BGL_Wrap(1, CullFace, void, (GLenum))
BGL_Wrap(2, DeleteLists, void, (GLuint, GLsizei))
BGL_Wrap(1, DeleteProgram, void, (GLuint))
BGL_Wrap(1, DeleteShader, void, (GLuint))
-BGL_Wrap(2, DeleteTextures, void, (GLsizei, GLuintP))
+BGL_Wrap(2, DeleteTextures, void, (GLsizei, GLuintP))
BGL_Wrap(1, DepthFunc, void, (GLenum))
BGL_Wrap(1, DepthMask, void, (GLboolean))
BGL_Wrap(2, DepthRange, void, (GLclampd, GLclampd))
@@ -773,7 +773,7 @@ BGL_Wrap(3, Lighti, void, (GLenum, GLenum, GLint))
BGL_Wrap(3, Lightiv, void, (GLenum, GLenum, GLintP))
BGL_Wrap(2, LineStipple, void, (GLint, GLushort))
BGL_Wrap(1, LineWidth, void, (GLfloat))
-BGL_Wrap(1, LinkProgram, void, (GLuint))
+BGL_Wrap(1, LinkProgram, void, (GLuint))
BGL_Wrap(1, ListBase, void, (GLuint))
BGL_Wrap(1, LoadIdentity, void, (void))
BGL_Wrap(1, LoadMatrixd, void, (GLdoubleP))
@@ -1907,9 +1907,9 @@ PyObject *BPyInit_bgl(void)
return submodule;
}
-static PyObject *Method_ShaderSource (PyObject *UNUSED(self), PyObject *args)
+static PyObject *Method_ShaderSource(PyObject *UNUSED(self), PyObject *args)
{
- int shader;
+ unsigned int shader;
char *source;
if (!PyArg_ParseTuple(args, "Is", &shader, &source))
diff --git a/source/tests/bl_rst_completeness.py b/source/tests/bl_rst_completeness.py
index 175d0a4231b..e9e2779bda8 100644
--- a/source/tests/bl_rst_completeness.py
+++ b/source/tests/bl_rst_completeness.py
@@ -29,6 +29,7 @@ exec(compile(open(filepath).read(), filepath, 'exec'))
'''
import os
+
THIS_DIR = os.path.dirname(__file__)
RST_DIR = os.path.normpath(os.path.join(THIS_DIR, "..", "..", "doc", "python_api", "rst"))
@@ -138,7 +139,6 @@ def main():
if bge is None:
print("Skipping BGE modules!")
- continue
for filename, modname, partial_ok in modules:
if bge is None and modname.startswith("bge"):
diff --git a/source/tests/rst_to_doctree_mini.py b/source/tests/rst_to_doctree_mini.py
index 19c20ccc006..181037299cf 100644
--- a/source/tests/rst_to_doctree_mini.py
+++ b/source/tests/rst_to_doctree_mini.py
@@ -47,7 +47,8 @@ def parse_rst_py(filepath):
re_prefix = re.compile(r"^\.\.\s([a-zA-Z09\-]+)::\s*(.*)\s*$")
tree = collections.defaultdict(list)
-
+ indent_map = {}
+ indent_prev = 0
f = open(filepath, encoding="utf-8")
indent_lists = []
for i, line in enumerate(f):
@@ -70,12 +71,11 @@ def parse_rst_py(filepath):
members=[])
tree[indent].append(item)
+ if indent_prev < indent:
+ indent_map[indent] = indent_prev
if indent > 0:
- # get the previous indent, ok this isn't fast but no matter.
- keys = list(sorted(tree.keys()))
- key_index = keys.index(indent)
- parent_indent = keys[key_index - 1]
- tree[parent_indent][-1].members.append(item)
+ tree[indent_map[indent]][-1].members.append(item)
+ indent_prev = indent
f.close()
return tree[0]