Merge pull request #1338 from erwincoumans/master

pybullet changeVisualShape texture fix, MSVC compile error
This commit is contained in:
erwincoumans
2017-09-25 12:21:45 -07:00
committed by GitHub
2 changed files with 7 additions and 6 deletions

View File

@@ -971,10 +971,10 @@ int GLInstancingRenderer::registerTexture(const unsigned char* texels, int width
void GLInstancingRenderer::replaceTexture(int shapeIndex, int textureId) 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]; b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
if (textureId>=0) if (textureId>=0 && textureId < m_data->m_textureHandles.size())
{ {
gfxObj->m_textureIndex = textureId; gfxObj->m_textureIndex = textureId;
gfxObj->m_flags |= eGfxHasTexture; 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) 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); glActiveTexture(GL_TEXTURE0);
b3Assert(glGetError() ==GL_NO_ERROR); b3Assert(glGetError() ==GL_NO_ERROR);
@@ -1027,7 +1027,7 @@ void GLInstancingRenderer::activateTexture(int textureIndex)
{ {
glActiveTexture(GL_TEXTURE0); 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); glBindTexture(GL_TEXTURE_2D,m_data->m_textureHandles[textureIndex].m_glTexture);
} else } else

View File

@@ -7138,13 +7138,14 @@ static PyObject* pybullet_calculateJacobian(PyObject* self, PyObject* args, PyOb
pybullet_internalGetFloatFromSequence(objAccelerations, i); pybullet_internalGetFloatFromSequence(objAccelerations, i);
} }
{ {
b3SharedMemoryStatusHandle statusHandle; b3SharedMemoryStatusHandle statusHandle;
int statusType;
b3SharedMemoryCommandHandle commandHandle = b3SharedMemoryCommandHandle commandHandle =
b3CalculateJacobianCommandInit(sm, bodyUniqueId, b3CalculateJacobianCommandInit(sm, bodyUniqueId,
linkIndex, localPoint, jointPositions, linkIndex, localPoint, jointPositions,
jointVelocities, jointAccelerations); jointVelocities, jointAccelerations);
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle); statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle);
int statusType = b3GetStatusType(statusHandle); statusType = b3GetStatusType(statusHandle);
if (statusType == CMD_CALCULATED_JACOBIAN_COMPLETED) if (statusType == CMD_CALCULATED_JACOBIAN_COMPLETED)
{ {
int dofCount; int dofCount;