View Full Version : Only Want to Light HUD

lost hope
11-08-2001, 08:27 PM
Hi -
I got another question http://www.opengl.org/discussion_boards/ubb/wink.gif I am trying to draw a 3D scene with a single light enabled, switch to ortho mode, draw a menu with a different light shining on it, and then switch back to perspective mode. However, I cannot seem to get the light to shine on the menu at all (except at random positions in the world, where I assume it is getting light from the first source)? Does anyone happen to have any pseudo code/ideas as to how I might go about doing this (I am mainly concerned with the ordering of operations)? I am not sure if I should enable/position the second light before or after I have switched into ortho mode, and I am unsure if when in ortho mode, the light position should be in screen pixels or in the usual relative units. I appologize if I have explained this unclearly. Any help would be appreciated, though.
-lost hope

Spiral Man
11-08-2001, 08:37 PM
does the menu really have to be lit? it might be better just to disable lighting entirely, draw the menu, and enable lighting again. if you need to do it the way you described, try disabling the single light that is in your scene before you draw the menu, but make sure that you enable it again when you draw the next frame http://www.opengl.org/discussion_boards/ubb/smile.gif

lost hope
11-08-2001, 08:44 PM
Heh... no, I suppose it does not have to be lit. But I was hoping to constantly pan the light across the menu for a visually stimulating effect. Only problem it, I can get no effect to appear!

11-08-2001, 09:47 PM
Do you have correct normals specified when drawing your menu?

lost hope
11-08-2001, 09:59 PM
I have enabled GL_NORMALIZE. Shouldn't that generate the appropriate normals for me? I thought that it would, as currently I have none defined explicitly.

11-09-2001, 01:25 AM
No it doesn't. You have to send them yourself. Enabling normalization tells OpenGL to make sure your normals are of length 1.0 when calculating lighting. This can cure problems you get when your modelview matrix introduces scaling of the normals you send.