Point sprites and fog a... deadly combination?

For whatever reason, fog and point sprites don’t mix. Even one extremely small point sprite shown while fog is enabled will slow my app down considerably. Without fog, everything runs nice and smooth.

I’m using the “Hybrid Graphics OpenGL ES 1.1 implementations” for “x86 PCs running Win2000/XP.”

Maybe you should use attenuation maps for fogs. Fog calculations can be quite expensive.


The fact that the application slows down considerably when enabling fog has probably more to do with the internal shader cache than the actual cost of the fog computations.

You see, our implementation has a runtime compiler for the pixel pipeline and a cache to store a certain amount of pixel pipeline programs generated by the compiler. Altering the state affecting the pixel pipeline causes a recompilation unless a program with the same relevant state is already found in the cache. If all the required programs do not fit in the cache, one might get recompilations each frame.

We’re planning to upgrade the pipeline cache to be auto-growable. Hopefully the next release will contain this optimization. In the meantime, and in general too, make sure you do the following tricks:

  • Ensure you’re not doing any unnecessary state changes, especially ones that affect the pixel pipeline. These might cause a recompilation and fill up the cache.
  • Sort your rendering calls according to the state if you can. This way you’ll minimize the amount of state changes, which in turn will reduce the time spent in the compiler.

Hope this helps.

PS. You might want to check out our community forums at http://forum.hybrid.fi . We’ll post notifications of our new releases there - and lots of other stuff as well!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.