glReadBuffer fails

Hi all,

i am developing under Linux ubuntu 2.6.32-22-generic x86_64
and this call sequence fails:

// get read buffer and reset it
GLint m_currentReadbuf = 0;
glGetIntegerv(GL_READ_BUFFER, &m_currentReadbuf);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
glReadPixels(0,0,edge,edge,GL_RGB,GL_UNSIGNED_BYTE,result);
glReadBuffer(m_currentReadbuf);

-> it fails at the last line with “Invalid Operation”
Does anyone know why it is not possible to set
a readbuffer to a value that was previously called?
Is it an error ( not here http://www.opengl.org/sdk/docs/man/xhtml/glReadBuffer.xml ) to set a readbuffer to its current value?

Best regards,
Hendrik

ReadBuffer doesn’t always have to contain a valid value in the current context. It has to accept only valid values.

So, if someone selected GL_BACK, while working with the default FB, you can’t just put it back while having an FBO active.

Edit: I’m completely mistaken here. Sorry for this confuse.
Tell us what is the active value of READ_FRAMEBUFFER_BINDING and what value are you actually getting for the current ReadBuffer.