RexOnRoids
RexOnRoids

Reputation: 14040

Can I get the color of the pixel at a Touch Point on an EAGLView

I want to get the color of the Pixel at a specific Touch Point on an EAGLView. Is this possible, and if so, how?

Upvotes: 1

Views: 872

Answers (2)

nschmidt
nschmidt

Reputation: 2395

You can read a pixel with

unsigned int pixel;
glReadPixels( x, y, 1, 1, GL_RGBA, GL_UNSIGNED_INT, &pixel);

Depending on the format of your framebuffer you may have to use different values for the format and type parameters.

Upvotes: 5

Brad Larson
Brad Larson

Reputation: 170319

You should be able to get the raw bitmap data using something similar to what is used in this question. From there, you can extract the byte values for the color elements at the point the touch occurred.

Upvotes: 0

Related Questions