• Advertisement
Sign in to follow this  

[java] JOGL glColor methods not working properly

This topic is 4290 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement