lighting problem when using glColor3b

Started by iimmortal, March 01, 2006, 11:05:53

Previous topic - Next topic

iimmortal

Hi all,

i noticed a problem when setting up my lighting model like this:

   //licht!
   FloatBuffer ambient = BufferUtils.createFloatBuffer(4).put(new float[] { 1.0f, 1.0f, 1.0f, 1.0f   });
   ambient.rewind();
   FloatBuffer diffuse = BufferUtils.createFloatBuffer(4).put(new float[] { 0.7f, 0.7f, 0.7f, 1.0f   });
   diffuse.rewind();
   FloatBuffer specular = BufferUtils.createFloatBuffer(4).put(new float[] { 0.7f, 0.7f, 0.7f, 1.0f   });
   specular.rewind();
   
   GL11.glEnable(GL11.GL_LIGHTING);
   GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT,ambient);
   
   GL11.glEnable(GL11.GL_COLOR_MATERIAL);
   GL11.glColorMaterial(GL11.GL_FRONT,GL11.GL_AMBIENT_AND_DIFFUSE);
   
   // Nice light blue
   GL11.glClearColor(0.0f, 0.0f, 05.f,1.0f);

and after that giving my verteces a color with glColor3b. the color was never shown. when i changed it to glColor3f the colors did show and where are no problems anymore.

is this normal behavour?

i am using an nvidea card with drivers and am on windows xp.

an example of the way i setup some triangles

       // Top of Tail section left
//   GL11.glColor3b((byte)255,(byte)0,(byte)0);
   GL11.glColor3f(1.0f,0.0f,0.0f);
   GL11.glVertex3f(0.0f,0.5f,-40.0f);
   GL11.glVertex3f(3.0f, 0.5f, -57.0f);
   GL11.glVertex3f(0.0f, 25.0f, -65.0f);

WiESi

Did you already try glColor3ub?

WiESi

iimmortal


WiESi

I have the feeling that none of that stuff with signed primitives works correctly under Java. Wouldn't it be a good idea to remove those functions?

WiESi

darkprophet

Thats weird...

Cause colours shouldn't work at all with lighting...

WiESi

Quote from: "darkprophet"Thats weird...

Cause colours shouldn't work at all with lighting...

When you enable GL_COLOR_MATERIAL it works and that's exactly what iimmortal did.

WiESi