Graphics Programs Reference
In-Depth Information
The precision specified for float will be used as the default precision for all vari-
ables based on a floating-point value. Similarly, the precision specified for int will
be used as the default precision for all integer-based variables.
It is not mandatory to specify precision qualifiers for variables in vertex shaders, be-
cause they have a pre-defined default precision for int and float types. However,
in fragment shaders, although (at least) medium precision is supported for float
types, (unlike vertex shaders) it is not set as the default precision. This means that
every fragment shader must explicitly declare a default precision for float types.
ES 2.0 allows us to determine the availability of high precision for the float type,
and, if it is not available, we can fall back to medium precision by setting it as the
default precision for all float types in a fragment shader. To determine whether
high precision is supported in the fragment shader, we need to find out whether the
GL_FRAGMENT_PRECISION_HIGH preprocessor macro is defined (as shown in
Listing 3-14 ).
Figure 3-9 . Fragment shading
GL POINT BASIC Application
Shader code ( _pointVertexShaderCode , _pointFragmentShader-
Code ) inside the Renderer class ( GL POINT BASIC/src/com/apress/
android/glpointbasic/GLES20Renderer.java ) must be compiled into
 
Search WWH ::




Custom Search