Q:

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

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

A:

Most OpenGL functions accept colors as floats, with 0 being minimum intensity, and 1 being maximum intensity.
Just divide your RGB values by 255.f before passing to OpenGL and you should be fine.

