Reputation: 3
My partner and I are working on an OpenGL project that includes a skybox. The skybox works fine on his computer (which has GLSL version 4.5) and everything BUT the skybox works on mine (GLSL 4.0). The compiler complains about a syntax error in this line:
layout(binding=0) uniform samplerCube currTexture;
and the impression I've gotten is that this syntax is not supported by versions of GLSL earlier than 4.2, is this correct? If so, how do I rewrite this line to be compatible with GLSL 4.0? I keep either seeing repeats of how to do this using the newest version, or much longer pieces of code that I am not sure I fully understand / don't know if it's even doing the same thing.
Upvotes: 0
Views: 707
Reputation: 45332
I've gotten is that this syntax is not supported by versions of GLSL earlier than 4.2, is this correct?
Yes. layout(binding=...)
was intruduced in the GL_ARB_shading_language_420pack
extension and is core since GL 4.2.
If so, how do I rewrite this line to be compatible with GLSL 4.0?
You simply omit the layout(binding)
qualifier. It is only a shortcut for having to query the uniform location and setting the value via glUniform1i()
on the client side. However, uniforms are initialized to 0 anyways, so in your case, this will just work as before.
Upvotes: 1