Skip to main content
gamedev.net
🔒 Locked

Lighting question

Started by Phynix 1 reply 700+ views
Original Post
Phynix
Phynix
I have a question about lighting. In my code, i create a triangle. And I also have a light. But here is the problem: The light only works as expected when the x and z values are the same as the triangle's. Otherwise, there is barely any light coming - even when the light is still above the triangle, but not above a vertex. The y difference between triangle and light is 1.0. Is this supposed to happen? How do I fix it?
Hodgman
Hodgman
Is the light directional, point or spot?
What attenuation values are you using?
Phynix
Phynix
I think the light is a point light (I haven't set a vector direction)...and what is an attenuation?

These are just the values that i use:

<code>

GLfloat LightAmbient[]= { 0.0f, 0.0f, 0.0f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { -100.0f, 0.1f, 99.0f, 1.0f };

glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);


</code>

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.