Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mlady

macrumors member
Original poster
Sep 18, 2008
31
0
Hi,

I want to use something like this:
Code:
	GLvoid* pixelColor[4];
	glReadPixels(x, y, 1, 1, GL_RGBA, GL_FLOAT, &pixelColor);
	NSLog(@"%f %f %f",pixelColor[0],pixelColor[1],pixelColor[2]);
And this is inside my render function.

No matter if I clear the background or whatever is on background it's giving me same (disordered) values.

I wanted to use glReadBuffer(), but it seems Xcode does not know this method. How many buffers are in iPhone?

basically I want to use this in my 2d racing game to determine, if still inside the track.

Anyone can help?
Thanks
 

mlady

macrumors member
Original poster
Sep 18, 2008
31
0
just got it working!
Should be:
Code:
	Byte pixelColor[4];

	glReadPixels(x,y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixelColor[0]);
	
	NSLog(@"%d %d %d",pixelColor[0],pixelColor[1],pixelColor[2]);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.