Jump to content

Image of the Day

Everything is fine. 

#screenshotsaturday #indiedev #gamedev https://t.co/98BAKUInyo
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Point lights won't work!

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Solid_Spy   Members   

708
Like
0Likes
Like

Posted 11 December 2012 - 08:03 PM

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:

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);
}
};


I modified it for a point light instead, but it won't work Posted Image:

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;
}
};

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

Edited by Solid_Spy, 11 December 2012 - 08:05 PM.


#2 Solid_Spy   Members   

708
Like
1Likes
Like

Posted 11 December 2012 - 08:34 PM

I... am so... stupid. Sorry guys, i forgot to add the position :P lol

#3 NumberXaero   Prime Members   

2573
Like
1Likes
Like

Posted 11 December 2012 - 08:34 PM

I dont see the directional light being given a direction vector, and I dont see anywhere where youve given the point light a position. Did you set either?




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.