3D picking in OpenGL
No replies to this topic
Members - Reputation: 122
Posted 09 October 2001 - 08:20 PM
I know there are several ways of doing 3d picking in OpenGL. I want to implement the color coding method, where you render the scene again (only this time using a diferent color for each object) to the back buffer, and not swapping buffers. The problem I have is with the pixel formats when getting a pixel from the buffer. I use the following code: glReadPixels(x,y,1,1,GL_RGB,GL_UNSIGNED_BYTE,(void *)pixel); When the display is set to 32bits, the code works perfect, but if the display is set to 16/8bits, I get random values, no relation to the real value at all.