I want to write my ssbo values into a texture3d.
When looking for the best way to do this… I think that the best method is to use a compute shader using the imageStore method (requires 4.2, which I am sure to set).
I dont have my code checked in, and not in front of my, so my pseudo code might not be exactly representative of what I am trying… but this is what I have so far. Nothing throws errors, but i dont think its working correctly.
On the c++ side:
glBindImageTexture(0, mtexture->getId(), 0, GL_TRUE, 0, GL_WRITE_ONLY, GL_RGBA8);
On the shader side (writing into texels):
layout (binding=0, RGBA8) writeonly uniform image3D tex3D;
void main(){
...
imageStore(tex3D, ivec3(x,y,z), vec4(1.0,0.0,0.0,1.0));
}
Then I bind this 3d texture as a sampler into another shader:
gl::ScopedTextureBind scoped3dTexb(mtexture);
And trying to sample it (in uv space):
uniform sampler3D uTexture;
In the end, not getting red, as I would expect… just black.
Using the glBindImageTexture as I dont think that the cinder ScopedTextureBind does the same thing. Is there a cinder method to bind image? Possibly my use of the raw gl call is wrong (it’s almost a certainty), and someone can point me to the correct way to use that? I’ve tried multiple configurations of binding and uniform layouts. But haven’t found a solution.
Otherwise, any direction on getting this to work is greatly appreciated. Thank you.