Advertisement

Light problem

Started by August 28, 2000 07:09 AM
2 comments, last by Zredna 24 years, 2 months ago
I''m trying to create a 3d fp engine, and I want to put some light in it. But I''ve got some problems. I want the light to stay where I placed it no matter where the player are (that seems logic), but I can''t even see where the light are. I''ve placed the glLightfv; glEnable; in the draw screen function after the glRotatef; glTranslatef; stuff and before the glBegin(GL_QUADS); stuff. But when I open the game the light is fucked up. When a corner of a rectangle not is on the screen the light for the rest of the rectangle gets fucked up, and sometimes when I face in one direction there''s alot of light and when i face in another direction there''s no light at all the same place where there was alot of light before. Does anyone know what i''m doing wrong? Thanx Zredna p.s. Do I have to do some trick to get shades or will they come automaticly when I get the light to work?
Do you give openGL the normal?? Are the normal correct???? And the materials????

If yes, yes and yes, try to get an example that creates and manages lights and compare it to your code.

cya

PROgrammer
Advertisement
Sorry shadows are up to you.

Take care of you parameters and go check out Opengl.org and nehe.gamedev.net to see more informations about lighing.



-* So many things to do, so little time to spend. *-
-* So many things to do, so little time to spend. *-
You are experiencing this problem cause you probably didn''t specified the normals to OGL.
You have to do it in the manner you find in Nehe''s tutorials. If you have to do it automatically you must calculate them for each poly, nad them normalize the values.
You can do it using glEnable(GL_NORMALIZE) to normalize the unnormalized normals.
I hope this help.

//-------------
Making Funny Garbage Codes on
http://members.xoom.it/NinjaCross
//-------------A straight line may be the shortest distance between two points, but it is by no means the most interesting.http://members.xoom.it/NinjaCross

This topic is closed to new replies.

Advertisement