This is the section of the code:
With the above code, the surface shade continuously changes as the cube is being rotated but not the way I was expecting. As an example, the top surface continuously change the color from completel black to complete white gradually as the cube rotates on the y-axis.gl.glEnable(GL10.GL_LIGHTING);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity();
gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, lightPositionBuffer);
gl.glTranslatef(0.0f, -1.2f, -10);And Into The Screen 6.0
gl.glRotatef(xrot, 1.0f, 0.0f, 0.0f);
gl.glRotatef(yrot, 0.0f, 1.0f, 0.0f);
model.draw(gl); // Draw the cube
If I move glLightfv() to just before draw(), then as expected, the surface doesn't change at all during rotation since the light position receives the same transformation as the scene itself.
What am I doing wrong?




