#version 410 compatibility layout(quads, ccw) in; uniform sampler2D field_tex; uniform float field_scale; void main() { vec4 v1 = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x); vec4 v2 = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x); vec4 pos = mix(v1, v2, gl_TessCoord.y); vec4 top = mix(gl_in[0].gl_TexCoord[0], gl_in[1].gl_TexCoord[0], gl_TessCoord.x); vec4 bot = mix(gl_in[3].gl_TexCoord[0], gl_in[2].gl_TexCoord[0], gl_TessCoord.x); vec4 uv = mix(top, bot, gl_TessCoord.y); float field = -texture2D(field_tex, uv.st).x; pos.y = field * field_scale; gl_Position = gl_ModelViewProjectionMatrix * pos; gl_TexCoord[0] = uv; }