First of all, thanks for the reply and let me say that I don't need to have this solved for now.
Second, I have tried what you suggested, but with no success. I only got 0s as results from the sub_data_read_1ui function for all valid buffer's indices. The data in the SSBO should be ok, because when I use it for rendering the rendered frame seems to be ok.
Maybe, I overlooked something, so this is the code:
gh_gpu_buffer.map(counts_buffer, "GL_READ_ONLY")
io.output("counts_buffer.txt")
local total = 0
for i = 0, 16 * 16 * 16 - 1 do
local buffer_offset_bytes = 4 * i
local count = gh_gpu_buffer.sub_data_read_1ui(counts_buffer, buffer_offset_bytes)
if (count > 0) then
io.write(count .. "\n")
end
total = total + count
end
io.write("Atoms = " .. total)
io.close()
gh_gpu_buffer.unmap(counts_buffer)
If you wanted to implement a working example, you could let me know and I would test it.