iDevGames Forums

Full Version: dynamic lighting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I dynamically create a point light at a position for some lighting effects. Then after a few seconds I turn it off. Works fine on the 3G phone.

Turns out on OS 3.0 on the 3G S phone, the animation will stall a couple seconds when I do that. Its irritating too because the animation is really smooth otherwise. The offending call is simply: glEnable(GL_LIGHT1); Well, do that for any light. If I take that out, then there is no stall in the animation. I figure most applications might call this once in the beginning and they do not experience the problem.

I suppose that I can disable dynamic lighting on the 3G S. But I don't want to do that. Already have that code to check the phone hardware and disable it but sort of like dynamic lights etc.

Seems like 3.0 on the 3G S has lots of problems beyond my control.
I don't have a 3GS and I don't know the technical details but I've read that fixed-function GL is compiled into shaders on the fly for that hardware, which can cause hiccups when new states are encountered.

I'm pretty sure Apple is aware of this and working to improve it, but you might want to submit a bug report and example project just the same. I guess a workaround is to use an entirely separate shader based render path for the 3GS, but I don't know how practical that is.
If you can cause a stall for "a couple seconds", something is wrong. What does Shark say is happening during the stall?
Well, I posted an update that checks for 3G S and turns off the dynamic lighting stuff I did. No more problems. I'm curious about 3.1 but I'd have to blow my computer out for it ... have to wait.

The dynamic lighting just round robins from light 1-6 for the explosions. After about three seconds it disables the particular light. The simulator and the 3G phone did not have the problem. I thought that it might be related to blending but I commented that out and the issue was still happening. Sometimes there was a black screen flash but only on the 3G S phone. ( everything drawn would turn to black / gray scale ... when I enable the lighting ) If I enable the light twice it should not be a problem?

I wonder if the delay is a compile on the fly? ( internal shader ? )

It was another family members phone I was borrowing. So, I had to fix it fast. Though, I did run the opengl es profiler which just showed a huge frame rate drop when I turned on the light.

I'll try shark and the performance tools when I get the phone again.
Reference URL's