Question

I'm developing a project of 3D maze with OpenGL. Despite my poor knowledge of programming, I managed to build it, add textures and steering with mouse and keyboard (stolen from net in most part, though). Now I'm stuck with lighting.

My idea (similar to famous game SCP-087) was to make a headlight, with a short range of light. I've read a lot about lighting in OpenGL and normals, but light still acts odd and kind of randomly.

I have the functions, that move (translate) my world around the camera. I understand, that if I place my light0 on the beginning of code, before translations in Render() function, that light should be "still placed" with camera, and world shall move around them - that sounds simple. But it doesn't seem to work. Most of walls are lit when I'm standing sideways to them (and completely dark when I turn to them with other side).

My other problem are normals. I'm pretty sure, that my normals aren't specified well, but have no idea how they should look like. I'm using triangle strips for walls (theoretically for improved efficiency, but practically it's just my caprice) and I could nowhere find a solution how normals should be specified for straight walls made of triangle strips (how to attach normals for faces, when I have only two vertices definign a single face, actually). Making one wall of simple quads and attaching four perpendicular, lenght of one unit vectors for one face also didn't make any improvement.

I can neither handle properly parameters of OpenGL state machine, especially attenuation - no changes in code seems to affect final lighting.

I have currently no idea, where to search and what to read about lighting in OpenGL. I would like to make it supersimple, with no additional libraries (except glu.h). Can you give me a hand with this problem or refer me to any useful source of knowledge (simple examples needed...)?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top