ios/mac shader - shared glsl source
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
:-)
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
:-)
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:
Code:
#version 100and on desktop, to
Code:
#version 110
#define highp
#define mediump
#define lowp... 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:
Code:
#if defined(GL_ES)
precision highp float;
#endif
Thanks OSC - That worked perfectly!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| passing values from vertex to fragment shader | Sumaleth | 6 | 8,635 |
Feb 18, 2011 01:54 AM Last Post: Holmes |
|
| Changing Uniform Variables for a Single Shader | reapz | 3 | 4,473 |
Jul 15, 2010 01:29 AM Last Post: dazza |
|
| Vertex shader particle billboarding question | TomorrowPlusX | 3 | 4,760 |
Sep 15, 2008 06:46 AM Last Post: TomorrowPlusX |
|
| GLSL Shader getting corrupted | Weebull | 4 | 3,844 |
Jun 23, 2008 03:43 PM Last Post: Weebull |
|
| Per-pixel shader? | kelvin | 15 | 7,517 |
Mar 9, 2008 07:42 PM Last Post: kelvin |
|

