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

Game not starting. Says that GLSL is not supported #55

Closed
glowiak opened this issue Feb 2, 2022 · 17 comments
Closed

Game not starting. Says that GLSL is not supported #55

glowiak opened this issue Feb 2, 2022 · 17 comments

Comments

@glowiak
Copy link

glowiak commented Feb 2, 2022

Traceback (most recent call last):
  File "main.py", line 204, in <module>
    game = Game()
  File "main.py", line 198, in __init__
    self.window = Window(config = self.config, width = 800, height = 600, caption = "Minecraft clone", resizable = True, vsync = False)
  File "main.py", line 34, in __init__
    self.shader = shader.Shader("vert.glsl", "frag.glsl")
  File "/usr/home/glowiak/gits/python-minecraft-clone/episode-12/shader.py", line 45, in __init__
    create_shader(self.vert_shader, vert_path)
  File "/usr/home/glowiak/gits/python-minecraft-clone/episode-12/shader.py", line 36, in create_shader
    raise Shader_error(str(log_buffer.value))
shader.Shader_error: b'0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES\n'
@obiwac
Copy link
Owner

obiwac commented Feb 2, 2022

Could I know what OS you're running on and what your graphics adapter is?

@glowiak
Copy link
Author

glowiak commented Feb 2, 2022

My OS is FreeBSD 13.0-RELEASE-p4, my graphics adapter is intel integrated gpu. Minecraft 1.18 runs on about 100fps

@Jukitsu
Copy link
Contributor

Jukitsu commented Feb 2, 2022

That's odd, if your GPU can run Mine raft (which uses GLSL 150, which is GL 3.2), how come it doesn't support GLSL 330 ? (Which is merely one version away)

@obiwac
Copy link
Owner

obiwac commented Feb 2, 2022

my graphics adapter is intel integrated gpu

I need you to be a bit more specific than that.

Either way, I believe I know what the issue is, and it isn't really an "issue" per se, but rather just a simple incompatibility.

You can work around this by replacing #version 330 in both shaders by the following:

#version 300 es
precision mediump float;

This should convert your shaders to OpenGL ES shaders, which your drivers seems to support. I don't have the necessary hardware nearby to test this right now, so you might still get a few errors (in which case do send them).

@glowiak
Copy link
Author

glowiak commented Feb 4, 2022

shader.Shader_error: b'0:2(1): preprocessor error: Illegal non-directive after #\n'

@obiwac
Copy link
Owner

obiwac commented Feb 4, 2022

Could you send your full shader source?

@obiwac obiwac pinned this issue Feb 5, 2022
@glowiak
Copy link
Author

glowiak commented Feb 7, 2022

Full shader source?

@drakeerv
Copy link
Contributor

drakeerv commented Feb 7, 2022

I think he means the whole shader file.

@glowiak
Copy link
Author

glowiak commented Feb 7, 2022

vert.glsl:

#version 300 es
#percision mediump float;

layout(location = 0) in vec3 vertex_position;
layout(location = 1) in vec3 tex_coords;
layout(location = 2) in float shading_value;

out vec3 local_position;
out vec3 interpolated_tex_coords;
out float interpolated_shading_value;

uniform mat4 matrix;

void main(void) {
	local_position = vertex_position;
	interpolated_tex_coords = tex_coords;
	interpolated_shading_value = shading_value;
	gl_Position = matrix * vec4(vertex_position, 1.0);
}

frag.glsl:

#version 300 es
#precision mediump float;

out vec4 fragment_colour;

uniform sampler2DArray texture_array_sampler;

in vec3 local_position;
in vec3 interpolated_tex_coords;
in float interpolated_shading_value;

void main(void) {
	vec4 texture_colour = texture(texture_array_sampler, interpolated_tex_coords);
	fragment_colour = texture_colour * interpolated_shading_value;

	if (texture_colour.a == 0.0) { // discard if texel's alpha component is 0 (texel is transparent)
		discard;
	}
}

@obiwac
Copy link
Owner

obiwac commented Feb 7, 2022

You didn't copy the snippet I sent over correctly. precision isn't a directive which must be preceded with a #. Also, you've got a small typo in your vertex shader; you wrote percision instead of precision.

@glowiak
Copy link
Author

glowiak commented Feb 7, 2022

Traceback (most recent call last):
  File "main.py", line 204, in <module>
    game = Game()
  File "main.py", line 198, in __init__
    self.window = Window(config = self.config, width = 800, height = 600, caption = "Minecraft clone", resizable = True, vsync = False)
  File "main.py", line 34, in __init__
    self.shader = shader.Shader("vert.glsl", "frag.glsl")
  File "/usr/home/glowiak/gits/python-minecraft-clone/episode-12/shader.py", line 51, in __init__
    create_shader(self.frag_shader, frag_path)
  File "/usr/home/glowiak/gits/python-minecraft-clone/episode-12/shader.py", line 36, in create_shader
    raise Shader_error(str(log_buffer.value))
shader.Shader_error: b"0:6(1): error: No precision specified in this scope for type `sampler2DArray'\n"

@glowiak
Copy link
Author

glowiak commented Feb 7, 2022

Now this appears

@obiwac
Copy link
Owner

obiwac commented Feb 8, 2022

Ah yes, I forgot the precision specifier for sampler2DArray. Add this after the other precision specifier:

precision lowp sampler2DArray;

Again sorry for all this back and forth; I don't have a system to test this on right now.

@glowiak
Copy link
Author

glowiak commented Feb 8, 2022

Thanks!!! Now everything works!

@glowiak glowiak closed this as completed Feb 8, 2022
@obiwac
Copy link
Owner

obiwac commented Feb 8, 2022

Great!

@drakeerv
Copy link
Contributor

Why is this still pinned?

@obiwac
Copy link
Owner

obiwac commented Mar 17, 2022

Because it seems to be a relatively common issue.

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