Sign in to follow this  
capn_midnight

[java] JOGL glColor methods not working properly

Recommended Posts

Is anyone else having problems with the various versions of glColor*? I can use glColor3f and glColor4f as expected, but glColor3i and glColor4i are coming up nothing but black. I wanted to use the java.awt.Color class to store color values, but calling gl.glColor3i(color.getRed(), color.getGreen(), color.getBlue()); doesn't work, but immediately switching to gl.glColor3f(color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f); does work. I don't have any specific code, it's just a general problem, defining colors using integers instead of floats fails every time. And yes, I'm making sure that my floats are 0.0 <= f <= 1.0 and my ints are 0 <= i <= 255.

Share this post


Link to post
Share on other sites
Quote:
Original post by capn_midnight
And yes, I'm making sure that my floats are 0.0 <= f <= 1.0 and my ints are 0 <= i <= 255.

The colors do not range from 0 to 255 but from 0 to Integer.MAX_VALUE instead. So 255 is very close to black.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this