This may seem a bit silly, but I can’t realize how I have to enter the desired color in glColor4f. I mean, it needs 4 floats between 0.0 ~ 1.0, and all the colors I find are in hexadecimal or in rgb (which are between 0 ~ 255).
How do I have to make the conversion to adquire the desired color using glColor4f?
I have already tried doing something like this:
glColor4f(1/248, 1/50, 1/99);
But it doesn’t make the trick.
I’m using JAVA and OpenGL-ES
‘C’ does integer arithmatic in integers
1/248will round down to zero, you need to use floating point values. ie1.0/248.0But since you want to convert 8bit RGB into 0-1 you need to do
(float)R/255.0edit: in whatever language glColor4f() expects a value in the range 0-1 where 0 is black and 1 is full color. To convert a 0-255 value into the range 0-1 you have to divide by 255, not take the reciprocal.