Get access to later versions of GLSL
Asked Answered
S

0

1

I was making a shader with GLSL so I could apply texture arrays to a cube when I ran into an issue. The issue was that layout wasn't supported in the version I was using. Easy fix, use a later version, but the problem with that was that I don't have support for later versions that support layout. I was wondering, is it possible to get support for later versions of GLSL, and if so, how would I do such a thing?

This is my current GLSL code for applying textures Vertex Shader:

#version 130
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aColor;
layout (location = 2) in vec2 aTexCoord;

out vec3 ourColor;
out vec2 TexCoord;

void main() {
    gl_Position = vec4(aPos, 1.0);
    ourColor = aColor;
    TexCoord = aTexCoord;
}

Fragment Shader:

#version 130
out vec4 FragColor;

in vec3 ourColor;
in vec2 TexCoord;

uniform sampler2DArray texture;
uniform index;

void main()
{
    FragColor = texture(texture, vec3(TexCoord, index));
}

Result of running:

print(glGetString(GL_VENDOR))
print(glGetString(GL_RENDERER))
print(glGetString(GL_VERSION))
print(glGetString(GL_SHADING_LANGUAGE_VERSION))

Intel Open Source Technology Center

Mesa DRI Intel(R) Sandybridge Mobile

3.0 Mesa 18.3.6

1.30

Stylus answered 26/9, 2020 at 19:21 Comment(4)
"I don't have support for later versions [...]" - Why? What is your hardware? How do you create the OpenGL Context?Nasalize
I added current hardwareStylus
Mesa supports OpenGL 3.3 core profile on Sandy Bridge just fine, it does not support compatibility profile though, so you end up with GL 3.0 if you request a legacy context.Tericaterina
How do I make sure I'm requesting the latest context?Stylus

© 2022 - 2024 — McMap. All rights reserved.