Printing out the color value

Hi

I have a program which im testing and id like to know what is the best way to print out the value of a color to the screen. I am using the GLUT API.

the function that im trying to use is called:
glutGetColor(y, GLUT_RED)
where int y is the value that is sent through from the y mouse coordinate.
id like to print out the color where ever the mouse is situated in the window. but it just prints out -1. i know that the value of ‘y’ in the glutGetColor() has to do with a cell call? so can i just send through the mouse coordinate into that place? it seems like it doesnt work.

the function im using to get the mouse coordinate is:
glutPassiveMotionFunc(int x, int y)

any help would be wonderful!
thanks

i quickly checked that glutGetColor() functions and seems like operating on color indices! do you have a color index window?

I don’t know glutGetColor function, you may use glReadPixels that seems to do what you want to do.

dletozeun: … you may use glReadPixels that seems to do what you want to do.
actually yeah thats better. never heard of glutGetColor either.

make sure you treat your pixels like the format you read them in, thats maybe the problem.

I don’t know what a color index window is, any help?
i will try to use the glReadPixels now. Thank you for the help

I came right, thank you