I think the color values are values between 0 (rgb = 0) and 1 (rgb =
255).
And, if i'm reading your code correctly, the 'red', 'green' and 'blue'
values in your code-example have values between 0 and 255 (in fixed
format: 0.0, 1.0, 2.0 --> 255.0).
http://www.khronos.org/opengles/documentation/opengles1_0/html/glColor.html

Try this as your last statement:
surface.glColor4x(red/255, green/255, blue/255)



On May 18, 8:53 am, "Alistair." <alistair.rutherf...@googlemail.com>
wrote:
> Anyone used glColor4x much?
>
> I am passing colours into a line draw rtn in the usual format '4
> bytes: alpha, red, green, blue.'
>
> my call to to set the colour attempts to modify the RRGGBB parts into
> fixed format values.
>
>         int red = (color&0x00FF0000);
>         int green = (color&0x0000FF00)<<8;
>         int blue = (color&0x000000FF)<<16;
>
>         surface.glColor4x(red, green, blue, 0);
>
> I am getting screwy colours from this. I have searched but there
> aren't many examples of this call kicking around and used in this way.
> I am obviously doing something dumb. Do I have to format the rgb
> values as percentages somehow?
>
> 'surface' is defined as GL10 btw.
>
> Al.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to