lights cant be enabled...

Started by
8 comments, last by RenderTarget 19 years, 9 months ago
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...
Advertisement
Stupid question: Do you call SetRenderState(D3DRS_LIGHTING, TRUE);?
yeah i did enable it in device render state...
Another stupid question: Did you copy the code directly from the editor, because you have _lights and _ligts both in the code.

Chris
Chris ByersMicrosoft DirectX MVP - 2005
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)
MOV AL, 0x00MOV AL, ME
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.
Get busy livin' or get busy dyin'... - Shawshank RedemptionIf a man is talking in the forest, and no woman is around to hear him, is he still wrong? - UnknownFulcrum
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...
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
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...
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.
[sub]My spoon is too big.[/sub]

This topic is closed to new replies.

Advertisement