#version 460 in vec2 f_texcoord; layout(packed, binding=0) buffer image { uint color[]; } ; // No local name for this one out vec4 outcolor; uniform uint width; uniform uint height; vec3 extract_color(uint raw_color){ vec3 ogl_color; ogl_color.r = ((raw_color & 0x000000ff) >> 0) / 255.0f; ogl_color.g = ((raw_color & 0x0000ff00) >> 8) / 255.0f; ogl_color.b = ((raw_color & 0x00ff0000) >> 16) / 255.0f; return ogl_color; } void main(void) { uint tex_x = uint(f_texcoord.x * float(width)); uint tex_y = uint(f_texcoord.y * float(height)); if(tex_y >= height) tex_y = height - 1; uint pixnum = tex_y * width + tex_x; outcolor.rgb = extract_color(color[pixnum]); outcolor.a = 1.0f; }