Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is there any GLES #define?

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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_ES will 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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading