Get access to later versions of GLSL

心不动则不痛 提交于 2021-01-28 21:07:16

问题


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

来源:https://stackoverflow.com/questions/64081669/get-access-to-later-versions-of-glsl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!