layout(std430, binding=0) buffer texture_image{ uint texpix[]; }; uniform float width; uniform float height; in vec2 f_texcoord; out vec4 gl_FragColor; void main(void) { // Note on formats: gl_FragColor is 4 floats // A pixel in our image is 4 bytes, as unsigned 8-bit integers uint icolor = texpix[int(round(f_texcoord.y) * width + f_texcoord.x)]; gl_FragColor.r = (icolor >> 24) / 256.0f; gl_FragColor.g = ((icolor >> 16) & 0xFF) / 256.0f; gl_FragColor.b = ((icolor >> 8) & 0xFF) / 256.0f; gl_FragColor.a = 1.0f; if(f_texcoord.x > 2000 || f_texcoord.y > 2000.0){ gl_FragColor.r = f_texcoord.x / width; gl_FragColor.b = f_texcoord.y / height; } }