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:
authorDalai Felinto <dfelinto@gmail.com>2010-03-28 14:20:26 +0400
committerDalai Felinto <dfelinto@gmail.com>2010-03-28 14:20:26 +0400
commit822dcc48cd6c362ef0a154ae07c17137e9e33b76 (patch)
tree4f2b959f580c86927f139ba558086296d13acdf9 /source/blender/python
parentddbb2bdaa57b69839e835c68c32086883a377560 (diff)
bgl/BGE: glCopyTexImage2D + bgl.buffer creation error more verbose + dome post_draw (it draw only for the last overlayed scene)
1) glCopyTexImage2D - www.opengl.org/sdk/docs/man/xhtml/glCopyTexImage2D.xml 2) dome post_draw. Now dome mode can also use scene.post_draw. It only runs for the last scene. It's really useful. I'm working on a nice showcase for this (a dome visualizer for the dome mode running with bgl. In the mean time this is a (lame) example of both working together (the buffer is being copied and draw on top of the window): http://blenderecia.orgfree.com/blender/tmp/dome_bgl_copytex2d.jpg
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/doc/epy/BGL.py28
-rw-r--r--source/blender/python/generic/bgl.c7
2 files changed, 34 insertions, 1 deletions
diff --git a/source/blender/python/doc/epy/BGL.py b/source/blender/python/doc/epy/BGL.py
index b054e762273..ce148dc72ba 100644
--- a/source/blender/python/doc/epy/BGL.py
+++ b/source/blender/python/doc/epy/BGL.py
@@ -318,6 +318,34 @@ def glCopyPixels(x, y, width, height, type):
@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):
"""
diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c
index 2ca84f3a311..63c518c8721 100644
--- a/source/blender/python/generic/bgl.c
+++ b/source/blender/python/generic/bgl.c
@@ -355,7 +355,10 @@ static int Buffer_ass_slice(PyObject *self, int begin, int end, PyObject *seq)
}
if (PySequence_Length(seq)!=(end-begin)) {
- PyErr_SetString(PyExc_TypeError, "size mismatch in assignment");
+ int seq_len = PySequence_Length(seq);
+ char err_str[128];
+ sprintf(err_str, "size mismatch in assignment. Expected size: %d (size provided: %d)", seq_len, (end-begin));
+ PyErr_SetString(PyExc_TypeError, err_str);
return -1;
}
@@ -476,6 +479,7 @@ BGL_Wrap(1, Color4usv, void, (GLushortP))
BGL_Wrap(4, ColorMask, void, (GLboolean, GLboolean, GLboolean, GLboolean))
BGL_Wrap(2, ColorMaterial, void, (GLenum, GLenum))
BGL_Wrap(5, CopyPixels, void, (GLint, GLint, GLsizei, GLsizei, GLenum))
+BGL_Wrap(8, CopyTexImage2D, void, (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint))
BGL_Wrap(1, CullFace, void, (GLenum))
BGL_Wrap(2, DeleteLists, void, (GLuint, GLsizei))
BGL_Wrap(2, DeleteTextures, void, (GLsizei, GLuintP))
@@ -819,6 +823,7 @@ static struct PyMethodDef BGL_methods[] = {
MethodDef(ColorMask),
MethodDef(ColorMaterial),
MethodDef(CopyPixels),
+ MethodDef(CopyTexImage2D),
MethodDef(CullFace),
MethodDef(DeleteLists),
MethodDef(DeleteTextures),