Skip to content
This repository

GLSL Gotchas 

mattdesl edited this page · 11 revisions

Here are some gotchas to be aware of when working with GLSL on various platforms.


  • Array declaration is broken on Snow Leopard (1)

Android, iOS, WebGL

  • Specify precision where possible. Low precision is useful for colors (0.0 - 1.0). More info here.
  • Be mindful of step() as it may create branching (although it really shouldn't). Benchmark with smoothstep() to see if performance improves.
  • 'For' loops may cause problems on certain Android devices (1)
  • On WebGL, you don't need #ifdef GL_ES as it will always return true
  • Many more optimizations listed here
Something went wrong with that request. Please try again.