BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.24k stars 4.61k forks source link

write custom filter #2603

Closed alyfreym closed 5 years ago

alyfreym commented 5 years ago

I started writing my shader when I use the round () function, I get an error - Fragment shader compile log: ERROR: 0:1: Invalid call of undeclared identifier 'round'. I understand that this error does not apply to GPUImage. Well, can somebody tell me why the mathematical function is not available?

BradLarson commented 5 years ago

The fragment shaders you write use the OpenGL Shading Language, which has a limited number of built-in functions. round() is unfortunately not one of those. For OpenGL ES 2.0 (as used on iOS), you can take a look at the quick reference card here:

https://www.khronos.org/opengles/sdk/docs/reference_cards/OpenGL-ES-2_0-Reference-card.pdf

and see the available built-in shader functions on the last page.