getting a single value back from the shader/gpu

Hi,
I am displaying some slices of a 3d texture. In order to obtain the pixel coordinate in my original 3d image volume that is pointed to by the mouse i have used an offscreen render of an integer coded texture. Just a sequntial numbering of the pixels. This worked well but can i do this in a neater way? I use two shaders at the moment and they are identical except one renders the integer coded pixel number to an integer buffer. It would seem simpler with one shader, but is there a way to do this?
My understanding is i cannot render to both an rgba and an integer RBO from the same shader.
Is the only way to get a variable of the frag shader through rendering or is there something i have missed?

Thanks
Soren

My understanding is i cannot render to both an rgba and an integer RBO from the same shader.

… says who? There’s absolutely no reason you can’t render to both. You just need to set the proper glDrawBuffers and glBindFragDataLocation stuff correctly, so that the integer output is piped to the integer buffer.

Thanks!
That is good news.
Looking at my fifth edition superbible I think it boils down to me misunderstanding a sentence on frame buffer completeness and unsupported combinations of internal formats.

In any case I will give this a shot after work - thanks again.

Soren