Can't use Blue Color Value in OpenGL 11

Viewed 35

If i try to use GL11.glColor4f(85, 255, 0, 1) it works perfectly fine but as soon as i try to use the blue color value (GL11.glColor4f(85, 255, 255, 1) it just doesn't color at all.

1 Answers

glColor4f expects values between 0 and 1, so that (0,0,0) is black and (1,1,1) is white. If you pass values greater than 1 they are getting clamped. Thus glColor4f(85, 255, 255, 1) will produce a white color. You should instead use

glColor4f(85/255., 1, 0, 1) 
glColor4f(85/255., 1, 1, 1) 
Related