Sign in to follow this  
dotX

lights cant be enabled...

Recommended Posts

dotX    122
every time i enable a light...it gets disabled by it self...i dont know why... :( even when i put this code in my Render() function which is called to render a frame...it gets disbled...
if(! _lights->Item[ 0 ]->Enabled )
{
    // there is a break point in next line so i know whether
    // the light is enabled or not.
    _ligts->Item[ 0 ]->Enabled = true;
}
i initialized the light using same way as in directx9 sdk light sample to make sure there is no mistake...but it still gets disabled and everything is black... :( ...there is no normal problem... also...when i disable them...everything looks white...strange... all samples in directx9 sdk works ok... anyone knows what causes this problem to happen? thanx...

Share this post


Link to post
Share on other sites
Supernat02    604
Another stupid question: Did you copy the code directly from the editor, because you have _lights and _ligts both in the code.

Chris

Share this post


Link to post
Share on other sites
rohitgonsalves    121
Don't you get a compile time error.

(! _lights->Item[ 0 ]->Enabled
_ligts->Item[ 0 ]->Enabled = true;
^
^



Whatever it may be do you have used these two,

SetLight(DWORD , CONST D3DLIGHT9 *pLight)
and then
LightEnable( DWORD index ,BOOL bEnable)

Share this post


Link to post
Share on other sites
Syrillix    122
another thing to check - have you setup a material? if you dont, it wont matter how many lights you enable it'll still be black.

Share this post


Link to post
Share on other sites
Sr_Guapo    876
Did you actually Commit() the light (let DX know it exists before enabling it)? That may not causr the problem, but it still needs to be done...

Share this post


Link to post
Share on other sites
__Daedalus__    480
The problem could also be with the way you are configuring your D3DLIGHT9 structure. Also, if you have *very* low polygon meshes (for example, that you are using to test) they won't light up very well at all. Are you setting a material though? As Syrillix says, if you don't do that, everything will be black regardless.

Share this post


Link to post
Share on other sites
dotX    122
that _ligt was a miss-spell...sorry... :D

well...i read all replays..thanx for replaying...i didnt set a material...so may be thats the problem...

but...as i remember...i didnt need to set a material to render a teapot...may be i forgot...i will try now...

i did all other stuff correctly...like calling Commit() for the light i just setup...

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