hof267
07-12-2012, 05:56 AM
Hi everyone,
I'm trying to implement selection mechanism using unique colors.
If I try to get color info for a single pixel everything works just fine and I always get correct color.
...
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glReadPixels(x, viewport[3] - y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel);
...
But if I try to get color info for a rectangular group of pixels I don't get correct colors
...
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glReadPixels(x, viewport[3] - y, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
...
According to the gotten results, it seems that some of the pixels are missed somehow...
Any ideas??
I'm trying to implement selection mechanism using unique colors.
If I try to get color info for a single pixel everything works just fine and I always get correct color.
...
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glReadPixels(x, viewport[3] - y, 1, 1, GL_RGB, GL_UNSIGNED_BYTE, pixel);
...
But if I try to get color info for a rectangular group of pixels I don't get correct colors
...
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glReadPixels(x, viewport[3] - y, width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
...
According to the gotten results, it seems that some of the pixels are missed somehow...
Any ideas??