gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Disco Lights... not really wanted [solved]

#144336 - Noda - Wed Oct 31, 2007 7:22 pm

Hello, I have (again) another strange problem with lights: on the DS I'm having the effect of a disco light (going in all direction with shutting on/off all the time, like if the light was moving), but I don't get why??

I'm using 1 static light:
Code:

glLight(0, RGB15(31, 31, 31) , 0, 0, floattov10(-1));


I'm using 3D on both screens, and apply the light to my 2 objects with the attributes:
Code:

glPolyFmt(POLY_ID(1) | POLY_ALPHA(31) | POLY_CULL_BACK | POLY_FORMAT_LIGHT0);


and I set up the material before each object:
Code:

    glMaterialf(GL_AMBIENT, RGB15(0, 0, 0));
    glMaterialf(GL_DIFFUSE, RGB15(16, 16, 16));
    glMaterialf(GL_SPECULAR, BIT(15) | RGB15(31,31,31));
    glMaterialf(GL_EMISSION, RGB15(0, 0, 0));


Is there something wrong with that? Does anyone had this problem?

Thanks.


Last edited by Noda on Tue Nov 06, 2007 5:39 pm; edited 1 time in total

#144545 - Noda - Sat Nov 03, 2007 6:09 pm

Nobody with an idea?

I've made some tests: if I move the glLight() definition in the main render loop (and not leave it only at init), I have about 2 seconds where the light is correct but I see it slowly moving (whereas it sould not!!) and then, goes disco! :(

Maybe this is a problem with my projection/view setup, is there any restrictions (apart from the reflection) about lights or things that I may have forgot to set up?

#144742 - thegamefreak0134 - Tue Nov 06, 2007 11:30 am

Hmm... I see standard language issues popping up all over the place, but I've been in Standard C mode for two months in school (no C++, we're forbidden for the first semester) so this may be fine in C++ and I may be full of beans. When you're using floating point functions, it's best to make sure to pass the arguments as 1.0 vs 1. For some reason, a lot of compilers won't do the cast like you would expect, and you get strange errors like this that make no sense at all. Try that.

If that doesn't do it (I don't have very high hopes, it's a nit-picky thing) then you might want to post your whole code. I think I know what it might be, but I can't tell what order you are doing your drawing in.

-gamefreak
_________________
What if the hokey-pokey really is what it's all about?

[url=http:/www.darknovagames.com/index.php?action=recruit&clanid=1]Support Zeta on DarkNova![/url]

#144743 - PypeBros - Tue Nov 06, 2007 11:44 am

something wrong with your normals could do something like that ?
_________________
SEDS: Sprite Edition on DS :: modplayer

#144752 - Noda - Tue Nov 06, 2007 5:38 pm

Found the problem!

A simple glLoadIdentity() after the initial glMatrixMode(GL_MODEL_VIEW) fixed the problem ;)