[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27617] trunk/blender/source/gameengine/ VideoTexture/Texture.cpp: BGE: bindId property in VideoTexture.Texture ( to get the openGL id of the texture)
Dalai Felinto
dfelinto at gmail.com
Sat Mar 20 01:11:25 CET 2010
Revision: 27617
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27617
Author: dfelinto
Date: 2010-03-20 01:11:25 +0100 (Sat, 20 Mar 2010)
Log Message:
-----------
BGE: bindId property in VideoTexture.Texture (to get the openGL id of the texture)
Now if you have a VideoTexture.Texture you can use its id and draw it with bgl
The Id is only going to be valid if the obj you are getting the VideoTexture.Texture from has a valid texture. In the examples you will see them as planes, that become invisible at load time, but are needed to validate the texture id.
This is a simple example file:
http://blenderecia.orgfree.com/blender/bind_id_simple.blend
And a (much) more advanced one:
http://blenderecia.orgfree.com/blender/bind_id.blend
(get also this image and save it to the same folder of your blend file - http://blenderecia.orgfree.com/blender/mask.png )
Benoit, I couldn't decide on better names so for now I'm glad with this one.
Modified Paths:
--------------
trunk/blender/source/gameengine/VideoTexture/Texture.cpp
Modified: trunk/blender/source/gameengine/VideoTexture/Texture.cpp
===================================================================
--- trunk/blender/source/gameengine/VideoTexture/Texture.cpp 2010-03-19 23:14:42 UTC (rev 27616)
+++ trunk/blender/source/gameengine/VideoTexture/Texture.cpp 2010-03-20 00:11:25 UTC (rev 27617)
@@ -357,6 +357,12 @@
Py_RETURN_NONE;
}
+// get OpenGL Bind Id
+PyObject * Texture_getBindId (Texture * self, void * closure)
+{
+ unsigned int id = self->m_actTex;
+ return Py_BuildValue("h", id);
+}
// get mipmap value
PyObject * Texture_getMipmap (Texture * self, void * closure)
@@ -430,6 +436,7 @@
{
{(char*)"source", (getter)Texture_getSource, (setter)Texture_setSource, (char*)"source of texture", NULL},
{(char*)"mipmap", (getter)Texture_getMipmap, (setter)Texture_setMipmap, (char*)"mipmap texture", NULL},
+ {(char*)"bindId", (getter)Texture_getBindId, NULL, (char*)"OpenGL Bind Name", NULL},
{NULL}
};
More information about the Bf-blender-cvs
mailing list