Store arbitrary data in color buffer outputs

I am currently writing a compute shader, and I need to store arbitrary data to a buffer. The idea is to perform a massive agent simulation on the GPU. Each agent is pretty simple : position + angle.
However it does not seem possible (yet ?) to store arbitrary data to a buffer in TD.
As such, I decided to try using color buffers to store my data. However it seems that all my float values are being clamp between 0 and 1, which is sensible for colors but not quite what I want.
Here is a small snippet of the glsl part of my code which stores the simulation output :

     vec4 data_out;
    data_out.w = 0.0; // No need for w
    data_out.z = agent.angle; 
    data_out.xy = new_pos;

    imageStore(sTDComputeOutputs[0], ivec2(gl_GlobalInvocationID.xy),  TDOutputSwizzle(data_out));

Finally, is anyone aware of where I could find the documentation of functions such as imageStore, texelFetch, etc. ? The wiki is not quite I would call a developer documentation… :frowning:

I think you just need to set the output format to 32-bit float (RGBA). For documentation I suggest Write a GLSL TOP - Derivative and googling within imageStore - OpenGL 4 Reference Pages

1 Like

Thanks I would have never thought at looking at pixel format !
Ok so those functions are from OpenGL, thanks I’ll look at Khronos documentation.