Using Color.rgb() doesnt work for full 0...255 range

Posted by superflyninja on Stack Overflow See other posts from Stack Overflow or by superflyninja
Published on 2012-10-10T15:31:20Z Indexed on 2012/10/10 15:37 UTC
Read the original article Hit count: 109

Filed under:
|

I'm writing an android game using opengl. I'm using:

colour = Color.rgb(theR,theG,theB);

(all ints) to store the color of a rectangle. Then I parse out the RGB to render the rectangle:

colorR = Color.red(color);
colorG = Color.green(color);
colorB = Color.blue(color);

For example for color 53,130,255 this should result in a blue but on my app it results in a white. If i use 1,1,1 i get white. If i use 0,0,0 i get black. If i use 0,1,0 I get green etc. So it looks like any value over one is treated as 1 and so i am not getting the full 0...255 range. I tried using Color.argb and color = Color.parseColor(theColor) where the Color is a string. I'm using this in an opengles app. I have a class to display a rectangle of color. This definitely works fine as the correct size rectangle is rendered, just not a color using values above 1. I also use textures and everything displays fine. any ideas? thanks a million

© Stack Overflow or respective owner

Related posts about android

Related posts about opengl-es