#if defined(GL_ES_VERSION_2_0)
TCollection_AsciiString aPrefix (theCtx->hasHighp
? "precision highp float;\n"
- : "precision mediump float;\n");
+ "precision highp int;\n"
+ : "precision mediump float;\n"
+ "precision mediump int;\n");
aSource = aHeader + aPrefix + aSource;
#else
aSource = aHeader + aSource;
#define occTexture2D texture2D
#endif
+#ifdef GL_ES
+ #define THE_PREC_ENUM lowp // enumerations should fit into lowp range
+#else
+ #define THE_PREC_ENUM
+#endif
+
// Vertex attributes
#ifdef VERTEX_SHADER
THE_ATTRIBUTE vec4 occVertex;
const int OccLightType_Spot = 3; //!< spot light source
// Light sources
-uniform vec4 occLightAmbient; //!< Cumulative ambient color
-uniform int occLightSourcesCount; //!< Total number of light sources
+uniform vec4 occLightAmbient; //!< Cumulative ambient color
+uniform THE_PREC_ENUM int occLightSourcesCount; //!< Total number of light sources
int occLight_Type (in int theId); //!< Type of light source
int occLight_IsHeadlight (in int theId); //!< Is light a headlight?
vec4 occLight_Diffuse (in int theId); //!< Diffuse intensity for specified light source
float occBackMaterial_Shininess(void); //!< Specular exponent
float occBackMaterial_Transparency(void); //!< Transparency coefficient
-uniform vec4 occColor; //!< color value (in case of disabled lighting)
-uniform int occDistinguishingMode; //!< Are front and back faces distinguished?
-uniform int occTextureEnable; //!< Is texture enabled?
-uniform sampler2D occActiveSampler; //!< Current active sampler
-uniform float occPointSize; //!< point size
+uniform vec4 occColor; //!< color value (in case of disabled lighting)
+uniform THE_PREC_ENUM int occDistinguishingMode; //!< Are front and back faces distinguished?
+uniform THE_PREC_ENUM int occTextureEnable; //!< Is texture enabled?
+uniform sampler2D occActiveSampler; //!< Current active sampler
+uniform float occPointSize; //!< point size
// clipping planes state
const int OccEquationCoords_View = 0; //!< view-space clipping plane
const int OccEquationCoords_World = 1; //!< world-space clipping plane
//! Parameters of clipping planes
-uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];
-uniform int occClipPlaneSpaces [THE_MAX_CLIP_PLANES];
-uniform int occClipPlaneCount; //!< Total number of clip planes
+uniform vec4 occClipPlaneEquations[THE_MAX_CLIP_PLANES];
+uniform THE_PREC_ENUM int occClipPlaneSpaces [THE_MAX_CLIP_PLANES];
+uniform THE_PREC_ENUM int occClipPlaneCount; //!< Total number of clip planes
// This file includes implementation of common functions and properties accessors
// arrays of light sources
-uniform ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types
-uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters
+uniform THE_PREC_ENUM ivec2 occLightSourcesTypes[THE_MAX_LIGHTS]; //!< packed light sources types
+uniform vec4 occLightSources[THE_MAX_LIGHTS * 4]; //!< packed light sources parameters
// light source properties accessors
int occLight_Type (in int theId) { return occLightSourcesTypes[theId].x; }