GLSL seems broken on Ubuntu 18.04

It seems this change broke GLSL (via juce::OpenGLShaderProgram) on Ubuntu 18.04. AFAICS that OS only supports GLSL version 1.30; since the above change, the version is always specified as 1.50, where before it was left unspecified when JUCE_OPENGL3 was left undefined.

I guess it makes sense to make this an overrideable setting? (and, maybe also lower the default; Ubuntu 18.04 is still in common use).

p.s. the comment above the linked diff also seems out of date.

3 Likes

Thanks for reporting this issue. I installed a copy of Ubuntu 18.04 in a VM and wasn’t able to repro the issue (the OpenGLDemo reports a GLSL version of 3.30), so I guess this depends on the hardware/driver being used.

Would you be able to test out this patch on your machine and check if it resolves the problem? Thanks!

opengl.patch (4.8 KB)

2 Likes

After applying the patch, there’s now a more subtle error: OpenGLShaderProgram::getLanguageVersion() returns 1.3 which is less than 1.5, which means OpenGLHelpers::getGLSLVersionString() returns an empty string so no #version prefix gets prepended to shader code, which means the implicit version is 1.1; at the same time, since 1.3 is more than 1.2, the string conversions in the OpenGLHelpers::translateXXXShaderToV3() functions take place, resulting in GLSL code which is incompatible with version 1.1 and error messages such as

error: 'in' qualifier in declaration of 'position' only valid for function parameters in GLSL 1.10

Thanks for letting me know. Were you previously enabling JUCE_OPENGL3=1 on this platform? In that case, it looks like we would have run into a similar problem, unless I’m missing something.

I found a way to force my VM to use a GL 3.1 / GLSL 1.4 context, and the following patch seems to work there, and also on my mac using both a 2.1 and a 4.1 context. Could you try this one out on your machine please?

opengl.patch (7.2 KB)

1 Like

I was not.

Works OK with this patch. Thanks!

1 Like

Thanks for trying that out, the change is now on develop:

2 Likes