oglglslnoob oglglslnoob - 2 years ago 135
C++ Question

gltexcoord[].st doesnt work on new hardware

Since switching hardware from AMD to Intel, something that worked on AMD seems to cause fatal glsl error on Intel and I had to comment it out:

gltexcoord[0].st is not recognised and breaks the shader.

I am looking for help for an alternative method or maybe a workaround for this piece of code:

gl_TexCoord[0].s = r.x / m + 0.5;
gl_TexCoord[0].t = r.y / m + 0.5;

vec4 rS = texture(reflectionSampler, gl_TexCoord[0].st);

OpenGL 3.3, GLSL 3.3 - both vertex & fragment shaders 3.30 core.

Answer Source

gl_TexCoord is deprecated in "modern" GLSL. The easiest way to achieve the same effect would be defining output variable vec2 in vertex shader:

out vec2 texCoord;
texCoord.xy = vec2(r.x / m + 0.f, r.y / m + 0.5);

and input variable in fragment shader:

in vec2 texCoord;
vec4 rS = texture(reflectionSampler, texCoord.xy);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download