Yes you are right. 1111 is white, sorry I was confused. :)
So, I have tried to implement the color-picking solution, without
fortune, because I always get 0000 from glReadPixels... and I don't
understand why... Maybe I can't read from the frame buffer? I'm using
Android 2.2 and 2.1. :(
This is my code, where x and y are the coordinates of point on the
screen where I touch.
ByteBuffer buff = ByteBuffer.allocateDirect(4);
buff.order(ByteOrder.nativeOrder());
byte [] array = new byte[4];
gl.glReadPixels(x, y, 1, 1, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE,
buff);
buff.get(array);
Log.d("DEBUG", "" + array[0] + " - " + array[1] + " - " +
array[2]
+ " - " + array[3]);
On 29 Nov, 19:52, Phil Endecott <[email protected]> wrote:
> > gl.glColor4f(colorCount, 0, 0, 1);
> > markers.get(i).draw();
> > colorCount++;
> > but unfortunately it doesn't work. The color remains always white
> > (0,0,0,1) in RGBA.
>
> White is 1,1,1,1.
>
> The colour components passed to glColor4f are floats and should range
> between 0 and 1. So colorCount++ is probably not what you want.
> Maybe it will work if you do colorCount+=0.01. But I suggest using
> glColour4ub (if that's available in the Java binding) as that lets you
> pass bytes and you know you'll get the exact same values back without
> any float-to-int conversion issues.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en