Hello, I am using an integer texture attachment to perform picking. My texture is defined as:
texPickerMain = GLUtil.glGenTexture(gl);
gl.glBindTexture(gl.GL_TEXTURE_2D, texPickerMain);
gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_R32I, canvasWidth, canvasHeight, 0, gl.GL_RED_INTEGER, gl.GL_INT, null);
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST);
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST);
gl.glFramebufferTexture2D(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT1, gl.GL_TEXTURE_2D, texPickerMain, 0);
In my fragment shader I have
layout(location = 1) out int pickerId;
During my draw I am drawing to attachments 0 and 1 and then blitting this to my default renderer.
I would like to be able to set pickerId such that it is transparent(?). Basically, I want to draw on the screen but have the users mouse pass through when I readpixels to what is behind it.
My readPixels call is:
gl.glReadBuffer(gl.GL_COLOR_ATTACHMENT1);
gl.glReadPixels(mouseX, canvasHeight - mouseY, 1, 1, gl.GL_RED_INTEGER, gl.GL_INT, 0);
Note: I have tried making out pickerId an ivec4 and setting alpha to 0 and that did not seem to make a difference. I also need 32 bits in my pickerId as I need to pack as much information as possible in to the pickerId to map it back afterwards.