Opengl lights

BlitzMax Forums/OpenGL Module/Opengl lights

KronosUK(Posted 2006) [#1]
I seem to have alot of trouble with gl lighting. Specifically unless I position a light every cycle wiith Lightfv(GL_LIGHT0,GL_POSITION,Light_Position) the lighting is screwed up, constantly changing when I rotate the camera.

Should I be able to position a light only once outside of the main loop and not have to worry about it.? Can anyone clarify.

Thanks


ImaginaryHuman(Posted 2006) [#2]
I think that when you Flip() you automatically clear everything including lights and have to respecify them? not sure.


Odds On(Posted 2006) [#3]
To clarify, yes, you do have to position the lights every frame. This is because OpenGL runs in 'Immediate Mode' and all the vertices and lighting calculations etc. have to be redrawn and recalculated every loop (or every time you call glClear(...)).


KronosUK(Posted 2006) [#4]
Ok thanks for the info