obiwac / python-minecraft-clone

Source code for each episode of my Minecraft clone in Python YouTube tutorial series.
https://www.youtube.com/playlist?list=PL6_bLxRDFzoKjaa3qCGkwR5L_ouSreaVP
MIT License
157 stars 72 forks source link

episode 3 shader error #106

Open WarLordGamer14 opened 2 months ago

WarLordGamer14 commented 2 months ago

Im getting an error that I can't quite figure out how to fix. at first VS code was reading the vert.glsl and the frag.glsl as text files (if you open up the minecraft clone file they are specified as glsl files still) I managed to fix that with the glsl extension but I'm still getting the same error.

Traceback (most recent call last): File "main.py", line 87, in <module> game = Game() ^^^^^^ File "main.py", line 81, in __init__ self.window = Window(config = self.config, width = 800, height = 600, caption = "Minecraft clone", resizable = True, vsync = False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "main.py", line 61, in __init__ self.shader = shader.Shader("vert.glsl", "frag.glsl") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "shader.py", line 45, in __init__ create_shader(self.vert_shader, vert_path) File "shader.py", line 36, in create_shader raise Shader_error(str(log_buffer.value)) shader.Shader_error: b"ERROR: 0:9: 'gl' : undeclared identifier \nERROR: 0:9: 'scalar swizzle' : not supported for this version or the enabled extensions \nERROR: 0:9: 'Position' : vector swizzle too long \nERROR: 0:9: 'Position' : unknown swizzle selection \nERROR: 0:9: 'Position' : unknown swizzle selection \nERROR: 0:9: 'Position' : unknown swizzle selection \nERROR: 0:9: '' : compilation terminated \nERROR: 7 compilation errors. No code generated.\n\n"

JustAnEric commented 1 month ago

Add depth_size to your self.config like this:

self.config = gl.Config(double_buffer = True, major_version = 3, minor_version = 3, depth_size = 16)