For a homework assignment, I need to implement a floodfill algorithm. My code is already structured, but I can't seem to figure out why my glReadPixels section isn't working. I was hoping someone could take a look at what I'm doing and let me know if I'm incorrect in its usage.
// I fetch pixels like so:
glReadPixels(100, 250, 150, 150, GL_RGB, GL_UNSIGNED_BYTE, clip_pixels);
// I index the result using:
in_rect_pos = (in_rect_y * in_rect_w) + in_rect_x;
// in_rect_* is a point w/ its origin at (100, 250)
GLubyte *pixel_at_pos = clip_pixels + (in_rect_pos * GL_PACK_ALIGNMENT);
But I'm not getting the correct values, and I really don't even know how to debug this.