diff --git a/data/multibody.bullet b/data/multibody.bullet index 0dee8f14a..b071e4eb7 100644 Binary files a/data/multibody.bullet and b/data/multibody.bullet differ diff --git a/data/plane_transparent.mtl b/data/plane_transparent.mtl new file mode 100644 index 000000000..6b700a066 --- /dev/null +++ b/data/plane_transparent.mtl @@ -0,0 +1,14 @@ +newmtl Material + Ns 10.0000 + Ni 1.5000 + d 1.0000 + Tr 0.0000 + Tf 1.0000 1.0000 1.0000 + illum 2 + Ka 0.0000 0.0000 0.0000 + Kd 0.5880 0.5880 0.5880 + Ks 0.0000 0.0000 0.0000 + Ke 0.0000 0.0000 0.0000 + map_Kd tex4x4.png + + diff --git a/data/plane_transparent.obj b/data/plane_transparent.obj new file mode 100644 index 000000000..b1317066e --- /dev/null +++ b/data/plane_transparent.obj @@ -0,0 +1,18 @@ +# Blender v2.66 (sub 1) OBJ File: '' +# www.blender.org +mtllib plane_transparent.mtl +o Plane +v 15.000000 -15.000000 0.000000 +v 15.000000 15.000000 0.000000 +v -15.000000 15.000000 0.000000 +v -15.000000 -15.000000 0.000000 + +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 + +usemtl Material +s off +f 1/1 2/2 3/3 +f 1/1 3/3 4/4 diff --git a/data/plane_transparent.urdf b/data/plane_transparent.urdf new file mode 100644 index 000000000..4054d2948 --- /dev/null +++ b/data/plane_transparent.urdf @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/ExampleBrowser/OpenGLGuiHelper.cpp b/examples/ExampleBrowser/OpenGLGuiHelper.cpp index 49b717b5a..daeefddc6 100644 --- a/examples/ExampleBrowser/OpenGLGuiHelper.cpp +++ b/examples/ExampleBrowser/OpenGLGuiHelper.cpp @@ -292,10 +292,10 @@ int OpenGLGuiHelper::registerTexture(const unsigned char* texels, int width, int return textureId; } -void OpenGLGuiHelper::changeTexture(int textureUniqueId, const unsigned char* texels, int width, int height) +void OpenGLGuiHelper::changeTexture(int textureUniqueId, const unsigned char* rgbTexels, int width, int height) { bool flipPixelsY = true; - m_data->m_glApp->m_renderer->updateTexture(textureUniqueId, texels,flipPixelsY); + m_data->m_glApp->m_renderer->updateTexture(textureUniqueId, rgbTexels,flipPixelsY); } diff --git a/examples/OpenGLWindow/GLInstancingRenderer.cpp b/examples/OpenGLWindow/GLInstancingRenderer.cpp index 92a11f417..c00f41be4 100644 --- a/examples/OpenGLWindow/GLInstancingRenderer.cpp +++ b/examples/OpenGLWindow/GLInstancingRenderer.cpp @@ -118,14 +118,14 @@ GLint lineWidthRange[2]={1,1}; enum { eGfxTransparency=1, + eGfxHasTexture = 2, }; struct b3GraphicsInstance { - GLuint m_cube_vao; - GLuint m_index_vbo; - GLuint m_textureIndex; - + GLuint m_cube_vao; + GLuint m_index_vbo; + GLuint m_textureIndex; int m_numIndices; int m_numVertices; @@ -974,6 +974,7 @@ void GLInstancingRenderer::replaceTexture(int shapeIndex, int textureId) if (textureId>=0) { gfxObj->m_textureIndex = textureId; + gfxObj->m_flags |= eGfxHasTexture; } } @@ -1052,6 +1053,7 @@ int GLInstancingRenderer::registerShape(const float* vertices, int numvertices, if (textureId>=0) { gfxObj->m_textureIndex = textureId; + gfxObj->m_flags |= eGfxHasTexture; } gfxObj->m_primitiveType = primitiveType; @@ -2204,7 +2206,7 @@ b3Assert(glGetError() ==GL_NO_ERROR); { glActiveTexture(GL_TEXTURE0); GLuint curBindTexture = 0; - if (gfxObj->m_textureIndex>=0) + if (gfxObj->m_flags & eGfxHasTexture) { curBindTexture = m_data->m_textureHandles[gfxObj->m_textureIndex].m_glTexture; diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 4cf3eb6ac..aba9c69c2 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -4583,7 +4583,7 @@ static PyObject* pybullet_changeTexture(PyObject* self, PyObject* args, PyObject PyObject* item; int i; int numPixels = width*height; - unsigned char* pixelBuffer = (char*) malloc (numPixels*3); + unsigned char* pixelBuffer = (unsigned char*) malloc (numPixels*3); if (PyList_Check(seqPixels)) { for (i=0;i