fixes in pybullet.loadTexture, changeVisualShape replacing texture.

(also works for OpenGL3 renderer now)
This commit is contained in:
Erwin Coumans
2017-06-30 13:35:07 -07:00
parent dcaaed9238
commit dd3d55610b
14 changed files with 275 additions and 76 deletions

View File

@@ -392,6 +392,15 @@ GLInstancingRenderer::~GLInstancingRenderer()
int GLInstancingRenderer::getShapeIndexFromInstance(int srcIndex)
{
b3PublicGraphicsInstance* pg = m_data->m_publicGraphicsInstances.getHandle(srcIndex);
if (pg)
{
return pg->m_shapeIndex;
}
return -1;
}
@@ -955,6 +964,17 @@ 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())
{
b3GraphicsInstance* gfxObj = m_graphicsInstances[shapeIndex];
if (textureId>=0)
{
gfxObj->m_texturehandle = m_data->m_textureHandles[textureId].m_glTexture;
}
}
}
void GLInstancingRenderer::updateTexture(int textureIndex, const unsigned char* texels, bool flipPixelsY)
{