Jump to content
  • Advertisement
Sign in to follow this  
dotX

lights cant be enabled...

This topic is 5100 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

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
Advertisement
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
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
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
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
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
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
You don't have to set a material. The default one is white. It's recommended you do set one though, just so you can diagnose things better.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!