Original Post
Greetings, I'm attempting to use glReadPixels() to get the color of the object I've just drawn. (I'm trying to use this to determine which object was selected). I have two problems in doing this. 1 - I'm using VBOs. Is there an easy way to temporarily change the color of the object? The only thing I can think of would be to create a copy of the color buffer, set it to the desired color, generate and bind the buffer, use it, then delete it. This seems rather cumbersome and was wondering if there was a better way. 2 - I can't seem to get the correct values back from glReadPixels(). I have a different rendering path that is called when a mouse is clicked, causing all objects to be drawn with a color that corresponds to an ID number, lights turned off, etc. However, when I read the buffer I get back, it is the colors that correspond to the normally drawn items. I've tried combinations of glReadBuffer(GL_FRONT/BACK), glFlush(), glFinish, SwapBuffers(), etc, but always with the same results.