svn merge ^/trunk/blender -r41226:41227 .
[blender.git] / source / gameengine / VideoTexture / Texture.cpp
index 04b39f0b05caecdae7d611744cf6599d34629d6a..eaf6002663b5695cedc5ef9550fc38afb46871f9 100644 (file)
@@ -1,4 +1,6 @@
-/* $Id$
+/** \file gameengine/VideoTexture/Texture.cpp
+ *  \ingroup bgevideotex
+ */
 -----------------------------------------------------------------------------
 This source file is part of VideoTexture library
 
@@ -186,11 +188,12 @@ int Texture_init (Texture *self, PyObject *args, PyObject *kwds)
        // texture object with shared texture ID
        Texture * texObj = NULL;
 
-       static char *kwlist[] = {"gameObj", "materialID", "textureID", "textureObj", NULL};
+       static const char *kwlist[] = {"gameObj", "materialID", "textureID", "textureObj", NULL};
 
        // get parameters
-       if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|hhO!", kwlist, &obj, &matID,
-               &texID, &TextureType, &texObj))
+       if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|hhO!",
+               const_cast<char**>(kwlist), &obj, &matID, &texID, &TextureType,
+               &texObj))
                return -1; 
 
        // if parameters are available
@@ -279,7 +282,9 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
 {
        // get parameter - refresh source
        PyObject * param;
-       if (!PyArg_ParseTuple(args, "O:refresh", &param) || !PyBool_Check(param))
+       double ts = -1.0;
+
+       if (!PyArg_ParseTuple(args, "O|d:refresh", &param, &ts) || !PyBool_Check(param))
        {
                // report error
                PyErr_SetString(PyExc_TypeError, "The value must be a bool");
@@ -315,7 +320,7 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
                                }
 
                                // get texture
-                               unsigned int * texture = self->m_source->m_image->getImage(self->m_actTex);
+                               unsigned int * texture = self->m_source->m_image->getImage(self->m_actTex, ts);
                                // if texture is available
                                if (texture != NULL)
                                {
@@ -354,6 +359,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)
@@ -427,6 +438,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}
 };
 
@@ -452,7 +464,7 @@ PyTypeObject TextureType =
        0,                         /*tp_str*/
        0,                         /*tp_getattro*/
        0,                         /*tp_setattro*/
-       0,                         /*tp_as_buffer*/
+       &imageBufferProcs,         /*tp_as_buffer*/
        Py_TPFLAGS_DEFAULT,        /*tp_flags*/
        "Texture objects",       /* tp_doc */
        0,                             /* tp_traverse */