[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27797] trunk/blender/source: bgl/BGE: glCopyTexImage2D + bgl. buffer creation error more verbose + dome post_draw ( it draw only for the last overlayed scene)
Dalai Felinto
dfelinto at gmail.com
Sun Mar 28 12:20:28 CEST 2010
Revision: 27797
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27797
Author: dfelinto
Date: 2010-03-28 12:20:26 +0200 (Sun, 28 Mar 2010)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/python/doc/epy/BGL.py
trunk/blender/source/blender/python/generic/bgl.c
trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
Modified: trunk/blender/source/blender/python/doc/epy/BGL.py
===================================================================
--- trunk/blender/source/blender/python/doc/epy/BGL.py 2010-03-27 22:48:18 UTC (rev 27796)
+++ trunk/blender/source/blender/python/doc/epy/BGL.py 2010-03-28 10:20:26 UTC (rev 27797)
@@ -318,7 +318,35 @@
@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
Modified: trunk/blender/source/blender/python/generic/bgl.c
===================================================================
--- trunk/blender/source/blender/python/generic/bgl.c 2010-03-27 22:48:18 UTC (rev 27796)
+++ trunk/blender/source/blender/python/generic/bgl.c 2010-03-28 10:20:26 UTC (rev 27797)
@@ -355,7 +355,10 @@
}
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(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 @@
MethodDef(ColorMask),
MethodDef(ColorMaterial),
MethodDef(CopyPixels),
+ MethodDef(CopyTexImage2D),
MethodDef(CullFace),
MethodDef(DeleteLists),
MethodDef(DeleteTextures),
Modified: trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 2010-03-27 22:48:18 UTC (rev 27796)
+++ trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 2010-03-28 10:20:26 UTC (rev 27797)
@@ -285,6 +285,7 @@
return;
KX_SceneList::iterator sceneit;
+ KX_Scene* scene;
int n_renders=m_dome->GetNumberRenders();// usually 4 or 6
for (int i=0;i<n_renders;i++){
@@ -292,7 +293,7 @@
for (sceneit = m_scenes.begin();sceneit != m_scenes.end(); sceneit++)
// for each scene, call the proceed functions
{
- KX_Scene* scene = *sceneit;
+ scene = *sceneit;
KX_Camera* cam = scene->GetActiveCamera();
m_rendertools->BeginFrame(m_rasterizer);
@@ -368,6 +369,10 @@
);
}
m_dome->Draw();
+ // Draw Callback for the last scene
+#ifndef DISABLE_PYTHON
+ scene->RunDrawingCallbacks(scene->GetPostDrawCB());
+#endif
EndFrame();
}
More information about the Bf-blender-cvs
mailing list