python-minecraft-clone icon indicating copy to clipboard operation
python-minecraft-clone copied to clipboard

pyglet.gl.ContextException: Could not create GL context

Open MicrosoftwareStudios opened this issue 2 years ago • 5 comments

I am using a Raspberry Pi and running Pyglet 2.0.7, Python 3.9. When I run main.py, I am given the error "pyglet.gl.ContextException: Could not create GL context". I saw something saying that some apps may not work right with the new version of Pyglet. Thank you for your work, and, in advance, for your help.

MicrosoftwareStudios avatar Jun 03 '23 21:06 MicrosoftwareStudios

That's possible (@Jukitsu can you provide input on this?), but it could also be RPI-related as I haven't yet tested this on the Raspberry. Could you tell us if it's a VC4 or a VC6 Raspberry, as well as which drivers you're using?

obiwac avatar Jun 03 '23 21:06 obiwac

I am not running any extra drivers except for the default ones, and I do not remember what VC# means.

MicrosoftwareStudios avatar Jun 04 '23 20:06 MicrosoftwareStudios

what model raspberry is it?

obiwac avatar Jun 04 '23 21:06 obiwac

Raspberry Pi 4, Model B ARM64 Cortex CPU, 8 GB RAM.

MicrosoftwareStudios avatar Jun 07 '23 01:06 MicrosoftwareStudios

Okay so I've looked into this a bit on my side (I'm unfamiliar with the RPI4), and it seems like the Raspberry drivers don't support 3.3. That being said, I'm pretty sure the hardware does support what's needed, as from memory even the previous VC4 does. So you can maybe try forcing an older version in the config in main.py:

config = gl.Config(major_version = 2, minor_version = 1, ...)

Hopefully the newer version of Pyglet won't cause issue too, as I haven't yet played around with that.

Worst case scenario you can always run with LIBGL_ALWAYS_SOFTWARE=1:

LIBGL_ALWAYS_SOFTWARE=1 python3 main.py

But that's using software rendering so not ideal.

obiwac avatar Jun 07 '23 14:06 obiwac

Closing this as stale.

obiwac avatar Aug 10 '24 00:08 obiwac

I was able to fix the problem. Thanks!

MicrosoftwareStudios avatar Aug 19 '24 17:08 MicrosoftwareStudios