I’m working with a codebase that supports OpenGL and OpenGL ES.
Is there any GLES define I can use to write conditional code? Something like:
#ifdef __GLES
//
#else
//
#endif
>Solution :
Yes. GLSL ES 1.00 specification defines under section 3.4 "Preprocessor":
The following predefined macros are available
__LINE__
__FILE__
__VERSION__
GL_ES
GL_ESwill be defined and set to 1. This is not true for the non-ES OpenGL Shading Language, so it can
be used to do a compile time test to see whether a shader is running on ES.
So you can check for GL_ES.