[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Pixel Colors



Still about GTK and Mesa, this is a obvious mistake that I
made that might be usefull to someone else, 

I just found why the glReadPixels OpenGL function was
giving me the wrong colors for my pixels: because GTK puts 
the origin at the top and OpenGl puts the origin at the bottom...

So instead of:

GLfloat colors[3];
glReadPixels (event->x, event->y, 1, 1, GL_RGB, GL_FLOAT, colors);

I have to use instead:

GLfloat colors[3];
glReadPixels (event->x, widget->allocation.height - event->y,
1, 1, GL_RGB, GL_FLOAT, colors);

Carlos



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]