Graphics Reference
In-Depth Information
glGetIntegerv ( GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs );
glGetIntegerv ( GL_MAX_VERTEX_UNIFORM_VECTORS,
&maxVertexUniforms );
glGetIntegerv ( GL_MAX_VARYING_VECTORS,
&maxVaryings );
glGetIntegerv ( GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS,
&maxVertexTextureUnits );
glGetIntegerv ( GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS,
&maxCombinedTextureUnits );
Precision Qualifiers
This section briefly reviews precision qualifiers, which are covered in
depth in Chapter 5, “OpenGL ES Shading Language.” Precision qualifiers
can be used to specify the precision of any floating-point or integer-based
variable. The keywords for specifying the precision are lowp , mediump ,
and  highp . Some examples of declarations with precision qualifiers are
shown here:
highp vec4 position;
out lowp vec4 color;
mediump float specularExp;
highp int oneConstant;
In addition to precision qualifiers, default precision may be employed.
That is, if a variable is declared without having a precision qualifier, it will
have the default precision for that type. The default precision qualifier
is specified at the top of a vertex or fragment shader using the following
syntax:
precision highp float;
precision mediump int;
The precision specified for float will be used as the default precision
for all variables based on a floating-point value. Likewise, the precision
specified for int will be used as the default precision for all integer-based
variables. In the vertex shader, if no default precision is specified, the
default precision for both int and float is highp .
For operations typically performed in a vertex shader, the precision
qualifier that will most likely be needed is highp . For instance, operations
that transform a position with a matrix, transform normals and texture
coordinates, or generate texture coordinates will need to be done with
highp precision. Color computations and lighting equations can most
likely be done with mediump precision. Again, this decision will depend
 
 
Search WWH ::




Custom Search