Made a new question as suggested, follow up to that one.
I was experimenting with texture declaration to find solution and thats how I done that before (unsigned int
):
glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_3D, m_texture);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, width, height, depth, 0, GL_RGBA_INTEGER,
GL_UNSIGNED_INT, NULL);
glGenerateMipap(GL_TEXTURE_3D);
glGenSamplers(1, &m_sampler);
glSamplerParameteri(m_sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glSamplerParameteri(m_sampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
And for that using imagestore
for int
/unsigned int
didnt work despite correct binding for writing as uimage
, rgba32ui
, uvec4
format and for reading as usampler
, uvec4
format. Of course also binding sampler
object for reading.
But I added two lines:
glGenTextures(1, &m_texture);
glBindTexture(GL_TEXTURE_3D, m_texture);
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA32UI, width, height, depth, 0, GL_RGBA_INTEGER,
GL_UNSIGNED_INT, NULL);
glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); //
glTexParameteri( GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); //
glGenerateMipmap(GL_TEXTURE_3D);
glGenSamplers(1, &m_sampler);
glSamplerParameteri(m_sampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glSamplerParameteri(m_sampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glSamplerParameteri(m_sampler, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
And now it seems to work. Still need to bind sampler
thought. But I fail to see any logic in this. I use sampler objects to set texture filtering not glTexParameteri
functions.
Float
textures work with sampler
objects as in first block of code. Anyone can explain?