From 15bd165ca0effa4d0900499eec6f3058c2f18b18 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Sat, 20 Mar 2010 00:11:25 +0000 Subject: [PATCH] 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. --- source/gameengine/VideoTexture/Texture.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index b8ed38c435d..f97ceb1fa67 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -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} };