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;
}
lights cant be enabled...
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...
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...
Another stupid question: Did you copy the code directly from the editor, because you have _lights and _ligts both in the code.
Chris
Chris
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)
(! _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)
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.
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...
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.
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...
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...
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement