1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| // Setup The ambient Light
ambientColorLight.emit(gl, lightNumberGL);
diffuseColorLight.emit(gl, lightNumberGL);
specularColorLight.emit(gl, lightNumberGL);
// Setup spot light
if (isSpot) {
gl.glLightfv(this.lightNumberGL, GL.GL_SPOT_DIRECTION, spotDirection, 0);
gl.glLightf(this.lightNumberGL, GL.GL_SPOT_CUTOFF, spotCutoff);
gl.glLightf(this.lightNumberGL, GL.GL_SPOT_EXPONENT, spotExponent);
}
// Position The Light
gl.glLightfv(this.lightNumberGL, GL.GL_POSITION, position, 0);
gl.glEnable(this.lightNumberGL);
if (isShowDebug) {
// save matrice
gl.glPushMatrix();
// gl.glPushAttrib(GL.GL_LIGHTING_BIT);
// gl.glDisable(GL.GL_LIGHTING);
gl.glColor3d(Color.JAUNE.getR(), Color.JAUNE.getV(), Color.JAUNE.getB());
// Move to the translate coordonates
gl.glTranslated(position[0], position[1], position[2]);
// Resize
gl.glScaled(0.1f, 0.1f, 0.1f);
glu.gluSphere(glu.gluNewQuadric(), 1.5f, 16, 8);
// gl.glPopAttrib();
// restore matrice
gl.glPopMatrix();
}
gl.glEnable(GL.GL_DEPTH_TEST);
gl.glEnable(GL.GL_COLOR_MATERIAL); |
Partager