#version 410 in float partId; out vec4 fragColorV; in vec2 uv; in float partSlot; in vec2 xy; uniform sampler2D partValues; uniform float partIndex_translate; // vec4 as x, y, z, scale uniform vec2 meScreenSize; void main(void) { vec4 partTranslate = texture(partValues, vec2(partIndex_translate, partSlot)); // One. X & Y. & Z, too. vec4 pos = vec4(xy.x, xy.y, partTranslate.z, 1.0); pos.xy += partTranslate.xy; pos.xy /= meScreenSize; pos.xy = pos.xy * 2.0 - vec2(1.0, 1.0); // convert from [0,1] to [-1,+1] pos.y = -pos.y; // Argh, after all that, I want pixel coords for all this. eeeee. gl_Position = pos; // Two. Fragcolor based on partId and st values. fragColorV.r = uv.x; fragColorV.g = uv.y; fragColorV.b = partId; fragColorV.a = pos.z; }