View Full Version : How can i have my program return an RGB value dependant upon where the mouse is?

04-30-2001, 11:43 AM
Thanks in advance.

04-30-2001, 11:45 AM
I mean dependant upon which pixel the mouse is over.

04-30-2001, 12:17 PM
The easiest way I can think of right off hand would be to read back the frame buffer and find our for yourself http://www.opengl.org/discussion_boards/ubb/wink.gif
There's a feedback buffer but from what I read that's supposed to be a little tricky and expensive, so I'd do

GLubyte rgb[3];
glReadPixels(mouseX, mouseY, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, &rgb[0]);