diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-03-20 03:11:25 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-03-20 03:11:25 +0300 |
commit | 15bd165ca0effa4d0900499eec6f3058c2f18b18 (patch) | |
tree | e73b09a9ea74c2316b9b0a4786033a4797dff784 /source/gameengine/VideoTexture/Texture.cpp | |
parent | d50876f8d5f3d857779f53e559f724cb126d6bd3 (diff) |
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.
Diffstat (limited to 'source/gameengine/VideoTexture/Texture.cpp')
-rw-r--r-- | source/gameengine/VideoTexture/Texture.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
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} }; |