Original Post
🔒 Locked
Colour Picking..
Advertisement
all you need to do is:
unsigned char pixels[3]; // Red, Green, Blue
glReadPixels( xcenter, ycenter, 1, 1, GL_RGB, GL_BYTE, (void*)&pixel);
this reads the pixel at ''xcenter'', ''ycenter'' and puts it in the ''pixels'' arrary.
if you want to do this from the back buffer, you have to first call:
glReadBuffer(GL_BACK);
this will read from the back buffer, but only if you have a double buffered window.
if you can''t get this to work, e-mail me at focus_business@hotmail.com, and i''ll send you the code to do it, as i had the same problem (but using mouse coordinates).
unsigned char pixels[3]; // Red, Green, Blue
glReadPixels( xcenter, ycenter, 1, 1, GL_RGB, GL_BYTE, (void*)&pixel);
this reads the pixel at ''xcenter'', ''ycenter'' and puts it in the ''pixels'' arrary.
if you want to do this from the back buffer, you have to first call:
glReadBuffer(GL_BACK);
this will read from the back buffer, but only if you have a double buffered window.
if you can''t get this to work, e-mail me at focus_business@hotmail.com, and i''ll send you the code to do it, as i had the same problem (but using mouse coordinates).
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement