thanks, I had some very similar code that wasn't working, so I'll try your version.
My code was:
Code:
TRgb CGame01::getColour(TReal x, TReal y) {
TInt r, g, b, a;
GLuint aPixel;
TRgb pixel_colour;
glReadPixels( x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &aPixel );
r = aPixel >> 0; // get the red value of the pixel
g = aPixel >> 8;
b = aPixel >> 16;
a = aPixel >> 24;
pixel_colour = TRgb(r, g, b);
return pixel_colour;
}
And I was having troubles extracting the individual rgb values, so your version looks better.
The only problem I see is that the player is moving along x and z, whereas you (and other code i have seen) asks for x and y. Is it possible to use the z value?