Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL/GLFW Conflict Between Taichi and PyGEL3D on macOS (Apple Silicon) #165

Closed
analogjedi opened this issue Dec 20, 2024 · 5 comments
Closed

Comments

@analogjedi
Copy link

Environment

  • macOS with Apple Silicon (M3 Max)
  • Python 3.11
  • Genesis Physics 0.2.0
  • PyGEL3D 0.5.2
  • Taichi 1.7.2

Issue

When running the macOS example script with visualization enabled, there's a conflict between GLFW implementations from Taichi and PyGEL3D packages. This leads to OpenGL initialization issues and ultimately causes a framebuffer binding error.

The specific error starts with duplicate GLFW class implementations:

Class GLFWHelper is implemented in both /taichi/_lib/core/taichi_python.cpython-311-darwin.so and /pygel3d/libPyGEL.dylib
Class GLFWApplicationDelegate is implemented in both locations
[etc...]

This is followed by shader uniform binding failures and eventually crashes with:

OpenGL.error.GLError: GLError(
err = 1282,
description = b'invalid operation',
baseOperation = glBindFramebuffer,
cArguments = (GL_DRAW_FRAMEBUFFER, 0)
)


Steps to Reproduce

Create a Python virtual environment
Install genesis-world and its dependencies
Run the macOS example script form the /examples directory with visualization enabled (python getting_started_mac.py -v)

Expected Behavior
The visualization window should open and show the physics simulation.

Actual Behavior
The script crashes with OpenGL errors due to conflicting GLFW implementations.
@DuinoDu
Copy link

DuinoDu commented Dec 20, 2024

I find that this bug is not caused by OpenGL/GLFW conflict. I compile PyGEL3D without OpenGL/GLFW, by setting Use_GLGraphics to OFF in CMakeLists.txt. Conflict warnings disappear but bug still exists.
Here is a screen record for log.

20241221-012147.mp4

@DuinoDu
Copy link

DuinoDu commented Dec 20, 2024

I fixed it by replacing genesis/ext/pyrender with pyrender offical one, with some update compatible with genesis. Code is here https://github.com/DuinoDu/Genesis. Plan to push a pull request after fixing other compatible bugs.

20241221-021753.mp4

Just wonder why don't use pyrender via pip but copy-paste?

@arch1baald
Copy link

The same issue on Python 3.10 and 3.12

VioletBenin referenced this issue Dec 20, 2024
… duplicate class names on MacOS (M1) by changing "PyGEL3D == 0.1.0"
@VioletBenin
Copy link

I solve this problem using the older "PyGEL3D == 0.1.0" version on MacOS M1 chip. #179

@analogjedi
Copy link
Author

analogjedi commented Dec 22, 2024

Thanks to the post of:
#207 (comment)

I was able to get the initial getting started script working on my Macbook Pro M3 Max w/ Sonoma 14.5.

I could not get it to work with my python venv's but I had success using miniconda with Python 3.10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants