GPUImage icon indicating copy to clipboard operation
GPUImage copied to clipboard

Tips on porting GLSL filters?

Open drewmca opened this issue 14 years ago • 1 comments

Do you have any advice on porting over GLSL filters used in other implementations found across the web? In particular, I'm trying to work with a film grain filter found at this location:

http://www.staunsholm.dk/THREE/jsdoc/overview-summary-ShaderUtils.js.html

Any advice you have for a good starting point (documentation, what variables are necessary, how to translate between a JS implementation vs one that works here, etc.) would be greatly appreciated.

drewmca avatar Aug 01 '12 02:08 drewmca

I describe some techniques for this in my class on OpenGL ES 2.0 that I taught, which is part of my iTunes U course:

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewCourse?id=497193807&s=143441&ls=1

There should be links in that iTunes U material to download the class notes, which also describe a little bit of this.

For WebGL shaders, there's little that needs to be done to make them compatible with OpenGL ES 2.0, since they use a shading language that's compatible with 2.0. Desktop OpenGL can be a little trickier, because the older OpenGL versions have many built-in variables that aren't present on OpenGL ES 2.0. These need to be replaced with appropriate attributes. Also, you'll need to add precision qualifiers, because those were lacking in pre-3.2 OpenGL shaders.

BradLarson avatar Aug 02 '12 20:08 BradLarson