From 0f30c95734da5c3316816b1d6f52b979d3cf1472 Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Mon, 25 Sep 2017 07:38:00 -0700 Subject: [PATCH 1/2] fix a compile error on Windows (variables need to be declared together at the start of a block in C) --- examples/pybullet/pybullet.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 5a4c4cda0..aa6c4c63c 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -7138,13 +7138,14 @@ static PyObject* pybullet_calculateJacobian(PyObject* self, PyObject* args, PyOb pybullet_internalGetFloatFromSequence(objAccelerations, i); } { - b3SharedMemoryStatusHandle statusHandle; + b3SharedMemoryStatusHandle statusHandle; + int statusType; b3SharedMemoryCommandHandle commandHandle = b3CalculateJacobianCommandInit(sm, bodyUniqueId, linkIndex, localPoint, jointPositions, jointVelocities, jointAccelerations); statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle); - int statusType = b3GetStatusType(statusHandle); + statusType = b3GetStatusType(statusHandle); if (statusType == CMD_CALCULATED_JACOBIAN_COMPLETED) { int dofCount; From 6d68a67c79fe43de235f44315a9f81249a008c0c Mon Sep 17 00:00:00 2001 From: erwincoumans Date: Mon, 25 Sep 2017 11:11:48 -0700 Subject: [PATCH 2/2] fix a bug in a changeVisualShape/texture selection, out-of-bounds check was using the wrong array. May fix some internal texture mug bug. --- examples/OpenGLWindow/GLInstancingRenderer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/OpenGLWindow/GLInstancingRenderer.cpp b/examples/OpenGLWindow/GLInstancingRenderer.cpp index b89309aab..a92500af7 100644 --- a/examples/OpenGLWindow/GLInstancingRenderer.cpp +++ b/examples/OpenGLWindow/GLInstancingRenderer.cpp @@ -971,10 +971,10 @@ int GLInstancingRenderer::registerTexture(const unsigned char* texels, int width void GLInstancingRenderer::replaceTexture(int shapeIndex, int textureId) { - if (shapeIndex >=0 && shapeIndex < m_data->m_textureHandles.size()) + if ((shapeIndex >=0) && (shapeIndex < m_graphicsInstances.size())) { b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex]; - if (textureId>=0) + if (textureId>=0 && textureId < m_data->m_textureHandles.size()) { gfxObj->m_textureIndex = textureId; gfxObj->m_flags |= eGfxHasTexture; @@ -985,7 +985,7 @@ void GLInstancingRenderer::replaceTexture(int shapeIndex, int textureId) void GLInstancingRenderer::updateTexture(int textureIndex, const unsigned char* texels, bool flipPixelsY) { - if (textureIndex>=0) + if ((textureIndex>=0) && (textureIndex < m_data->m_textureHandles.size())) { glActiveTexture(GL_TEXTURE0); b3Assert(glGetError() ==GL_NO_ERROR); @@ -1027,7 +1027,7 @@ void GLInstancingRenderer::activateTexture(int textureIndex) { glActiveTexture(GL_TEXTURE0); - if (textureIndex>=0) + if (textureIndex>=0 && textureIndex < m_data->m_textureHandles.size()) { glBindTexture(GL_TEXTURE_2D,m_data->m_textureHandles[textureIndex].m_glTexture); } else