Sign in to follow this  
Solid_Spy

Point lights won't work!

Recommended Posts

Solid_Spy    708
For some reason, whenever i use directional lights, they seem to work just fine, but point lights don't.

Heres the code for the directional light:

[CODE]class light
{
public:
int x;
int y;
int z;
int red;
int green;
int blue;
D3DLIGHT9 l;
light(int a, int b, int c, int d, int e, int f, int g)
{
x = a;
y = b;
z = c;
red = d;
green = e;
blue = f;
l.Type = D3DLIGHT_DIRECTIONAL; // make the light type 'directional light'
l.Diffuse = D3DXCOLOR(1.0f, 0.0f, 1.0f, 1.0f); // set the light's color
l.Ambient = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
l.Specular = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
}
};[/CODE]


I modified it for a point light instead, but it won't work [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img]:

[CODE]class light
{
public:
int x;
int y;
int z;
int red;
int green;
int blue;
D3DLIGHT9 l;
light(int a, int b, int c, int d, int e, int f, int g)
{
x = a;
y = b;
z = c;
red = d;
green = e;
blue = f;
l.Type = D3DLIGHT_POINT; // make the light type 'directional light'
l.Diffuse = D3DXCOLOR(1.0f, 0.0f, 1.0f, 1.0f); // set the light's color
l.Ambient = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
l.Specular = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
l.Range = 20;
}
};
[/CODE]

All i see is black. I even tried changing the range values, and that does nothing. Please help me! Edited by Solid_Spy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this