Skip to main content
gamedev.net
🔒 Locked

Nvidia = Light, ATI = No Light - Same code

Started by greytone 3 replies 750+ views
Original Post
greytone
greytone
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.
circlesoft
circlesoft
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.
greytone
greytone


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.
bjle
bjle
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.

Topic Locked

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

Sign in to reply to this topic.