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.
This commit is contained in:
Dalai Felinto 2010-03-20 00:11:25 +00:00
parent d50876f8d5
commit 15bd165ca0

@ -357,6 +357,12 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
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 @@ static PyGetSetDef textureGetSets[] =
{
{(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}
};