Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using PyBullet in
DIRECTmode with the EGL OpenGL renderer, dynamically replacing a visual texture throughchangeVisualShape(..., textureUniqueId=...)can produce an incorrect texture result.The EGL visual shape converter was passing the public
textureUniqueIddirectly to the instancing renderer. However, textures registered by the EGL renderer have their own internal renderer texture ID (m_innerTexUid), so the two IDs are not necessarily interchangeable.I noticed the error was first mentioned on Dec 4, 2020, while it remains unfixed in 2026. Here is the discussion: #3419.
This can make dynamically assigned textures render incorrectly with EGL even though the same texture is rendered correctly by the Tiny Renderer.
Approach
Update
EGLRendererVisualShapeConverter::changeShapeTexture()to:textureUniqueIdto the corresponding internalm_innerTexUidbefore callingreplaceTexture();-1as the value used to remove/disable the texture;m_textures.The change is intentionally limited to the EGL visual shape converter.
Result
Dynamic texture replacement now uses the renderer's actual internal texture ID, allowing textures changed through PyBullet's visual-shape API to render correctly with the EGL GPU renderer.
This is particularly useful for headless
DIRECTrendering where EGL is used for GPU-accelerated camera images.Validation
I reproduced the issue by comparing dynamic texture replacement using the Tiny Renderer and the EGL hardware OpenGL renderer in
DIRECTmode.After this change, the dynamically replaced texture is correctly used by the EGL renderer.
git diff --checkpasses.Thank you for developing and maintaining Bullet and PyBullet. I really enjoy using PyBullet, especially for robotics and GPU-accelerated simulation, and I hope this small fix is useful to the project.