why specular light is not running?

Posted by nkint on Game Development See other posts from Game Development or by nkint
Published on 2011-01-08T14:10:57Z Indexed on 2011/01/08 14:59 UTC
Read the original article Hit count: 229

Filed under:
|

hi, i'm on JOGL this is my method for lighting:

private void lights(GL gl) {
    float[] LightPos = {0.0f, 0.0f, -1.0f, 1.0f};
    float[] LightAmb = {0.2f, 0.2f, 0.2f, 1.0f};
    float[] LightDif = {0.6f, 0.6f, 0.6f, 1.0f};
    float[] LightSpc = {0.9f, 0.9f, 0.9f, 1.0f};

    gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, LightPos, 0);
    gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, LightAmb, 0);
    gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, LightDif, 0);
    gl.glLightfv(GL.GL_LIGHT1, GL.GL_SPECULAR, LightSpc, 0);

    gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, LightSpc, 0);

    gl.glEnable(GL.GL_LIGHT0);
    gl.glEnable(GL.GL_LIGHT1);
    gl.glShadeModel(GL.GL_SMOOTH);
    gl.glEnable(GL.GL_LIGHTING);  
}

and i see my objects flat, no specular light.. any ideas?

ps. to render my objects:

gl.glColor3f(1f,0f,0f);
gl.glBegin(GL.GL_TRIANGLES);
for(Triangle t : tubeModel.getTriangles()) {
    gl.glVertex3f(t.v1.x, t.v1.y, t.v1.z);
    gl.glVertex3f(t.v2.x, t.v2.y, t.v2.z);
    gl.glVertex3f(t.v3.x, t.v3.y, t.v3.z);
}
gl.glEnd();

© Game Development or respective owner

Related posts about opengl

Related posts about lighting