#version 410 in float partSlot; in vec2 xy; in vec2 uv; out vec2 uvV; out float alphaV; out vec4 colorV; uniform sampler2D partValues; uniform float partIndex_translate; // vec4 as x, y, z, scale uniform float partIndex_color; // vec4 as x, y, z, scale uniform vec2 meScreenSize; void main(void) { vec4 partTranslate = texture(partValues, vec2(partIndex_translate, partSlot)); // Draw against the very back of the visible cube. vec4 pos = vec4(xy.x, xy.y, partTranslate.z, 1.0); 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; gl_Position = pos; uvV = uv; colorV = texture(partValues, vec2(partIndex_color, partSlot)); }