#version 430 core struct particle_t { vec2 pos; vec2 dir; }; struct cell_t { float pheromone; float result; int population; }; layout(binding = 0, rgba8) writeonly uniform image2D canvas; uniform int map_width; uniform int map_height; uniform float display_population_value; uniform float display_pheromone_value; layout(std430, binding = 1) coherent buffer particles_buffer { particle_t particles[]; }; layout(std430, binding = 2) coherent buffer map_buffer { cell_t map[]; }; layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in; void main(){ uint x = gl_GlobalInvocationID.x; uint y = gl_GlobalInvocationID.y; if(x >= map_width || y >= map_height){ return; } uint cell_id = y * map_width + x; cell_t cell = map[cell_id]; imageStore(canvas, ivec2(gl_GlobalInvocationID.xy), vec4(cell.population/display_population_value, cell.pheromone/display_pheromone_value, // 0, 0, 1)); }