Just for sanity’s sake, is this the correct way to create a 3D texture?
Image img = new Image(format, width, height, depth,
new ArrayList<>(depth), colorSpace);
Texture3D tex = new Texture3D(img);
I suspect this might be incorrect, because whenever I read from the texture, the pixel is always returning as black, even though I definitely did write to the texture.
vPosition is a vector between 0 and 1. I have confirmed this by outputing it through gl_FragColor. m_GridSize is the width, height, and depth of the 3D texture m_VoxelMap (which is a cube in my case).
The shader is definitely running, too.
Edit: also, here is the shader I’m using to test the contents of m_VoxelMap on a fullscreen quad:
i might be misunderstanding, but at first glance it looks like you could be passing a generally initialized vec4 (result) as a temp ‘store’ parameter, where (i think) imageStore takes that vec4 as the actual data to be formatted into a texel and stored within m_VoxelMap.
…unless m_VoxeMap is being overwritten elsewhere afterward.
edit:
i could be wrong as result being all 1.0 would likely store opaque white texels, rather than the black being read.
I managed to solve this last night. The problem was that imageLoad and imageStore won’t work unless the texture is additionally bound with glBindImageTexture. Things were setup correctly on my end, it’s just that GLRenderer only binds textures with glBindTexture. I’ve submitted a PR that addresses this.
Thanks for the suggestions guys. I am admittedly very new to this territory.
I’ve renamed this thread to be more search friendly.