ios/mac shader - shared glsl source - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: ios/mac shader - shared glsl source (/thread-9053.html)
ios/mac shader - shared glsl source - OptimisticMonkey - Jun 13, 2011 02:09 PM
I would like to use the same shader in my mac app as in my iOS app - the only difference is the presence of the precision qualifiers.
Is there an easy approach to #define the precision qualifiers so that I can share the same shader source for both mac and iOS?
(OSC mentioned how to do this before, but I can't remember the details)
Thanks in advance for any help
RE: ios/mac shader - shared glsl source - OneSadCookie - Jun 13, 2011 03:50 PM
glShaderSource takes an array of strings that are concatenated together, so, on iOS, set string 0 to
and on desktop, to
... and put your own source in string 1.
Where you need to declare global precision, you can use the GL_ES predefined macro to conditionalize:
RE: ios/mac shader - shared glsl source - OptimisticMonkey - Jun 17, 2011 08:59 AM
Thanks OSC - That worked perfectly!