fogleman / Minecraft

Simple Minecraft-inspired program using Python and Pyglet
MIT License
5.21k stars 1.23k forks source link

NameError: name 'GL_FOG' is not defined #147

Open MasterHansCoding opened 1 year ago

MasterHansCoding commented 1 year ago

When I run main.py I get this error. What should I do?

captain-wangrun-cn commented 1 year ago

me too

dzx825 commented 1 year ago

me too

Dada010101 commented 1 year ago

me too...

rish-hyun commented 1 year ago

I got the same error, I resolved by installing PyOpenGL

pip install PyOpenGL

And later imported these two statements

from OpenGL.GL import *
from OpenGL.GLU import *

Import and NameError are resolved but now I'm getting another error

raise GLException('(0x%x): %s' % (error, msg))
pyglet.gl.lib.GLException: (0x500): Invalid enum. An unacceptable value is specified for an enumerated argument.
rish-hyun commented 1 year ago

I got the same error, I resolved by installing PyOpenGL

pip install PyOpenGL

And later imported these two statements

from OpenGL.GL import *
from OpenGL.GLU import *

Import and NameError are resolved but now I'm getting another error

raise GLException('(0x%x): %s' % (error, msg))
pyglet.gl.lib.GLException: (0x500): Invalid enum. An unacceptable value is specified for an enumerated argument.

I've downgraded to pyglet==1.5.27, and it's working! No need to install PyOpenGL

michaelboerman commented 1 year ago

I got the same error, I resolved by installing PyOpenGL

pip install PyOpenGL

And later imported these two statements

from OpenGL.GL import *
from OpenGL.GLU import *

Import and NameError are resolved but now I'm getting another error

raise GLException('(0x%x): %s' % (error, msg))
pyglet.gl.lib.GLException: (0x500): Invalid enum. An unacceptable value is specified for an enumerated argument.

I've downgraded to pyglet==1.5.27, and it's working! No need to install PyOpenGL

Thank you for posting your solution! Your steps worked for me.

For others downgrading pyglet, you can do so by running pip install pyglet==1.5.27

iTSiolinux commented 1 year ago

i guess git pull the pyglet version in the how to run in the README.md add ' pip install pyglet==1.5.27 '

Sjxooooooooooooooooooooooooooo commented 8 months ago

Me too. I move it to my new laptop,but it got this error… What can I do?

[Running] python -u "e:\Minecraft-master\main.py"
Traceback (most recent call last):
  File "e:\Minecraft-master\main.py", line 902, in <module>
    main()
  File "e:\Minecraft-master\main.py", line 897, in main
    setup()
  File "e:\Minecraft-master\main.py", line 890, in setup
    setup_fog()
  File "e:\Minecraft-master\main.py", line 861, in setup_fog
    glEnable(GL_FOG)
             ^^^^^^
NameError: name 'GL_FOG' is not defined

[Done] exited with code=1 in 0.776 seconds
RequiemxOP commented 4 months ago

Screenshot 2024-04-08 120628