OpenGL GLSL 3.30 in Ubuntu 14.10 mesa 10.1.3

2019-05-31 06:34发布

问题:

when I try to compile a glsl shader with OpenGL in Ubuntu I get the following error: - 0:1(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, and 1.00 ES

But when I do a "glxinfo | grep OpenGL" it says:

OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD JUNIPER
OpenGL core profile version string: 3.3 (Core Profile) Mesa 10.1.3
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 10.1.3
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:

It appears that the glsl version is right, so I don't know what am I doing wrong

I am developing with lwjgl and Java

回答1:

This is basically telling you that you don't have a core profile context. Mesa is giving you a 3.0 context since it does not support compatibility profiles, and I imagine this is because you did not explicitly ask the framework you used to create your context for a core profile.

Update:

Given lwjgl, when you create your context you need to request a 3.3 core profile.

You can do that like this:

PixelFormat    pixelFormat       = new PixelFormat ();
ContextAttribs contextAtrributes = new ContextAttribs (3, 3).withProfileCore (true);

[...]

Display.create (pixelFormat, contextAtrributes);