printf in GLSL?

Unfortunately it’s not possible directly. One possible solution though, that I end up using a lot (but I’m sure it’s pretty common among GLSL developers) is to “print” values as colors, in place of your intended final result.

Of course this has many limitations; for one, you have to make sure that your value maps in a (0,1.0) range. Functions as mod, fract etc. turn out useful in these cases. But, in general, this is what I see as the “printf” equivalent in GLSL.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)