Jump to content
  • Advertisement
Sign in to follow this  
greytone

Nvidia = Light, ATI = No Light - Same code

This topic is 4843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm hoping someone has come across this before and can help me out, I have a Light Manager class that I have been working on that works great on machines running Nvidia Cards, tested it on 3. But fails to light anything on machines running with ATI cards (everything renders black). I'm using point lights, and all the machines I tested on had the SDK installed.

Share this post


Link to post
Share on other sites
Advertisement
Nvidia has a reputation for being a little more liberal in their drivers. The best way to figure it out would be to check the debug output. If that doesn't give you any clues, post the pertinent code here.

Share this post


Link to post
Share on other sites


This is the light Creation code.

D3DLIGHT9 *newLight = new D3DLIGHT9;

newLight->Type = D3DLIGHT_POINT;

//Create a new light, with some default settings, full diffuse and specular with no ambient.
newLight->Diffuse.r = newLight->Diffuse.g = newLight->Diffuse.b = 1.0f;
newLight->Specular.r = newLight->Specular.g = newLight->Specular.b = 1.0f;
newLight->Ambient.r = newLight->Ambient.g = newLight->Ambient.b = 0.0f;
newLight->Position = D3DXVECTOR3( 0.0f, 0.0f, 0.0f );
newLight->Range = 60.0f;
newLight->Attenuation0 = newLight->Attenuation1 = newLight->Attenuation2 = 0.0f;

//push the light onto our light vector
lights.push_back((D3DLIGHT9*) newLight);

//set and enable the light
myDevice->SetLight((int)lights.size()-1, (D3DLIGHT9 *)lights[((int)lights.size()-1)]);
myDevice->LightEnable((int)lights.size()-1, true);

Im not setup to get the directx debug output, but I guess I should be.

myDevice->SetRenderState(D3DRS_LIGHTING, TRUE);

is called previous to the create function.

Share this post


Link to post
Share on other sites
You're getting a divide by zero error, since your light is "falling off" at 1/(attenuation0 + attentuation1*d + attenuation2*d*d). I guess the nvidia cards automatically adjust for that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!