Original Post
Hi, I've got a problem with a light position, after I was trying a few sperated tests then things started to get stranger and stranger, and I more confused. As the next screen shows I used a basic light source above 4 objects, now when I rotate (on X) an object at 90* and 270* the light lits the top, and when the object is at 0* or 180* then the light fades away. screenshot The normals are correct. I'm getting totally clueless why this is happening with a resulting combo of 90* and 270* against 180* and 0*. Part of this test source: [Edited by - R3D on February 19, 2007 3:40:37 AM]
Private Sub Render_Scene()
glClear clrDepthBufferBit Or clrColorBufferBit
glLoadIdentity
gluLookAt 0, 0, -10, 0, 0, 0, 0, 1, 0
Dim lPosition(4) As Single
lPosition(0) = 0#
lPosition(1) = 3#
lPosition(2) = 0#
lPosition(3) = 0#
glLightfv GL_LIGHT0, GL_POSITION, lPosition(0)
glPushMatrix
glTranslatef lPosition(0), lPosition(1), lPosition(2)
glColor3f 0.9, 0.9, 0#
Render_CubeTest
glPopMatrix
glPushMatrix
glTranslatef 3#, 0#, 0#
glRotatef 90, 1#, 0#, 0#
glColor3f 0.7, 0#, 0#
Render_CubeTest
glPopMatrix
glPushMatrix
glTranslatef 1#, 0#, 0#
glRotatef 180, 1#, 0#, 0#
glColor3f 0.7, 0#, 0#
Render_CubeTest
glPopMatrix
glPushMatrix
glTranslatef -1#, 0#, 0#
glRotatef 270, 1#, 0#, 0#
glColor3f 0.7, 0#, 0#
Render_CubeTest
glPopMatrix
glPushMatrix
glTranslatef -3#, 0#, 0#
glRotatef 0, 1#, 0#, 0#
glColor3f 0.7, 0#, 0#
Render_CubeTest
glPopMatrix
SwapBuffers hDCx
End Sub
Private Sub Render_CubeTest()
Dim i As Byte
glBegin GL_TRIANGLES
For i = 0 To 11
glNormal3f CUBE.vn(i * 3).x, _
CUBE.vn(i * 3).y, _
CUBE.vn(i * 3).z
glVertex3f CUBE.v(i * 3).x, _
CUBE.v(i * 3).y, _
CUBE.v(i * 3).z
glNormal3f CUBE.vn((i * 3) + 1).x, _
CUBE.vn((i * 3) + 1).y, _
CUBE.vn((i * 3) + 1).z
glVertex3f CUBE.v((i * 3) + 1).x, _
CUBE.v((i * 3) + 1).y, _
CUBE.v((i * 3) + 1).z
glNormal3f CUBE.vn((i * 3) + 2).x, _
CUBE.vn((i * 3) + 2).y, _
CUBE.vn((i * 3) + 2).z
glVertex3f CUBE.v((i * 3) + 2).x, _
CUBE.v((i * 3) + 2).y, _
CUBE.v((i * 3) + 2).z
Next i
glEnd
End Sub