madjestic / e1337

A Shader-Toy on steroids and a space-time-sim game, inspired by Strugatskis "Noon, XXII century".
BSD 3-Clause "New" or "Revised" License
5 stars 0 forks source link

Difficulty running due to wrong OpenGL version #2

Open ivanperez-keera opened 5 years ago

ivanperez-keera commented 5 years ago

So, I managed to compile it, but I get this when I run it:

e1337: user error (compile log: 0:1(10): error: GLSL 4.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

I'm on linux, with a MacBookAir. The OpenGL-related outputs to glxinfo are:

OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 6000 (Broadwell GT3) 
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.2.8
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 18.2.8
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 18.2.8
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

I had a very similar case on a different and newer Mac using OSX.

madjestic commented 5 years ago

I think it has to do with "OpenGL shading language version string: 1.30", but my shader programs have the version string set to "#version 450", as seen here: vertex program and here fragment program. Since the shader is rather basic, I do not think it really needs to be "#version 450" as it is now...

Have you tried lowering the shader program version string? What happens if you change it to "#version 130"?

ivanperez-keera commented 5 years ago

If I make that just 130 in both files, I get:

e1337: user error (compile log: 0:3(1): error: syntax error, unexpected NEW_IDENTIFIER

I cannot run the thing with make, by the way. I'm compiling with cabal (old building style) and running directly from the sandbox.

madjestic commented 5 years ago

I'll give a stab at it when I have a moment...

madjestic commented 5 years ago

I think it does not like layout(location = 0) in vec4 vPosition; I assume this is not supported by GLSL version 130, so it fails. I do not know what would be version 130 equivalent to do the same thing... Do you have any OpenGL hurus around to ask about it?

madjestic commented 5 years ago

A quick search brought this: GLSL - Equivalent Of “layout (location = 1)” In #version 130

ivanperez-keera commented 5 years ago

Do you have any OpenGL hurus around to ask about it?

I do not, no.

A quick search brought this: GLSL - Equivalent Of “layout (location = 1)” In #version 130

I'm not experienced enough in OpenGL to even understand how to use this without a substantial amount of tinkering. What would I need to change, and where?

ivanperez-keera commented 5 years ago

By the way, on my machine, supported versions are:

1.10, 1.20, 1.30, 1.00 ES, 3.00 ES, 3.10 ES, and 3.20 ES

So, we may not have to go as far back as 1.30 for everything (I guess 3.20 ES is newer than 1.30).

If I use #version 320 es, the error messages I get are:

0:22(1): error: No precision specified in this scope for type `vec4'
0:24(1): error: No precision specified in this scope for type `float'
0:28(2): error: No precision specified in this scope for type `vec3'
0:29(2): error: No precision specified in this scope for type `float'
0:30(2): error: No precision specified in this scope for type `vec2'
0:31(2): error: No precision specified in this scope for type `vec2'
0:35(2): error: No precision specified in this scope for type `float'
0:36(2): error: No precision specified in this scope for type `float'
0:37(2): error: No precision specified in this scope for type `vec2'
0:40(2): error: No precision specified in this scope for type `vec2'
0:41(2): error: No precision specified in this scope for type `float'
0:42(2): error: No precision specified in this scope for type `vec2'
0:58(2): error: No precision specified in this scope for type `float'
0:64(2): error: No precision specified in this scope for type `vec3'

By adding:

precision highp float;

to both the shader.frag and shader.vert files, as well as changing the version number for the languages used, I was able to run the example!!!

Do you want me to send you a PR?

madjestic commented 5 years ago

Sounds good, Ivan!

Yes, please do.

madjestic commented 4 years ago

Btw, are you, by chance, running a GLES device? Could you describe the hardware that you are running this on? I would like to get an idea what I should anticipate.

Thanks, Vlad