GLSL - rendering to integer texture - uint vs float

Hi,

I am renderring some uint to a GL_LUMINANCE32UI_EXT texture attached to an FBO. Opengl 4.3, GLSL compiler 4.2.

In the fragment shader, if I declared the output as out uint v_idOut, the only thing I get in the buffer is zero.
But If I declared the output as out float v_idOut, then I get the correct integers in my GL_LUMINANCE32UI_EXT texture.

Since the whole process only involve uint, I’d like to avoid using float (and possibly avoid some dodgy conversion). Is there any way I can use out uint v_idOut ?

Frank

OK, it was actually rendering fine all along, I just wasn’t visualizing correctly, due to the fact that I was using texture2D (which seems to have lost the ability to handle integer texture in some recent version) instead of texture.

Sorry about the noise,
Frank

(1)First:
glGenFramebuffers(1,&fbo);
glBindFramebuffer(GL_FRAMEBUFFER,fbo);
glGenTextures(1,&colorTexture);
glBindTexture(GL_TEXTURE_2D,colorTexture);
glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA32UI,RANGE,RANGE,0,GL_RGBA_INTEGER,GL_UNSIGNED_INT,NULL);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,colorTexture,0);

(2)then in fragment shader:
#version 440

layout(location = 0) out uvec4 rgba0;

void main()
{
uint p=111u;

rgba0=uvec4(p,p,p,p);
return;

}

(3)last read from texture into memory:
glBindFramebuffer(GL_FRAMEBUFFER,fbo);
glReadBuffer(GL_COLOR_ATTACHMENT0);
unsigned int colorTextureInMemArr[RANGERANGE4];
memset(colorTextureInMemArr,0,sizeof((colorTextureInMemArr,0,sizeof));
glReadPixels(0,0,RANGE,RANGE,GL_RGBA,GL_UNSIGNED_INT,colorTextureInMemArr);

But colorTextureInMemArr is all 0… Can you tell me where is wrong or how to solve it? Thank you

Please try glReadPixels(0,0,RANGE,RANGE,GL_RGBA_INTEGER,GL_UNSIGNED_INT,colorTextureInMemArr); in case GL_RGBA involved a fixed point conversion.