A documented example of how to use this code is available
here and
here.
Support for GL4#GL_TESS_CONTROL_SHADER and GL4#GL_TESS_EVALUATION_SHADER
was added since 2.2.1.
| Modifier and Type | Field and Description |
|---|---|
| public static final boolean | |
| public static final String | DISABLE
Behavior for GLSL extension directive, see |
| public static final String | ENABLE
Behavior for GLSL extension directive, see |
| public static final String | es2_default_precision_fp
Default precision of |
| public static final String | es2_default_precision_vp
Default precision of |
| public static final String | es3_default_precision_fp
Default precision of |
| public static final String | es3_default_precision_vp
Default precision of |
| public static final String | gl3_default_precision_fp
Default precision of GLSL ≥ 1.30 as required until < 1.50 for |
| public static final String | gl3_default_precision_vp_gp
Default precision of GLSL ≥ 1.30 as required until < 1.50 for |
| protected int | |
| protected static int | |
| public static final String | REQUIRE
Behavior for GLSL extension directive, see |
| protected IntBuffer | |
| protected Buffer | |
| protected int | |
| protected CharSequence[][] | |
| protected int | |
| public static final String | SUB_PATH_NVIDIA
Unique relative path for binary shader resources for |
| public static final String | SUFFIX_COMPUTE_BINARY
Unique resource suffix for |
| public static final String | SUFFIX_COMPUTE_SOURCE
Unique resource suffix for |
| public static final String | SUFFIX_FRAGMENT_BINARY
Unique resource suffix for |
| public static final String | SUFFIX_FRAGMENT_SOURCE
Unique resource suffix for |
| public static final String | SUFFIX_GEOMETRY_BINARY
Unique resource suffix for |
| public static final String | SUFFIX_GEOMETRY_SOURCE
Unique resource suffix for |
| public static final String | SUFFIX_TESS_CONTROL_BINARY
Unique resource suffix for |
| public static final String | SUFFIX_TESS_CONTROL_SOURCE
Unique resource suffix for |
| public static final String | SUFFIX_TESS_EVALUATION_BINARY
Unique resource suffix for |
| public static final String | SUFFIX_TESS_EVALUATION_SOURCE
Unique resource suffix for |
| public static final String | SUFFIX_VERTEX_BINARY
Unique resource suffix for |
| public static final String | SUFFIX_VERTEX_SOURCE
Unique resource suffix for |
| protected boolean | |
| public static final String | WARN
Behavior for GLSL extension directive, see |
| Access | Constructor and Description |
|---|---|
| public | ShaderCode(final int type, final int
number of shaders count, final CharSequence[][] CharSequence array containing the shader sources, organized as source)source[count][strings-per-shader].
May be either an immutable String - or mutable StringBuilder array.
|
| public | ShaderCode(final int type, final int
number of shaders count, final int binFormat, final Buffer binary buffer containing the shader binaries, binary)
|
| Modifier and Type | Method and Description |
|---|---|
| public final int | Returns: the index after the inserted data, maybe 0 if nothing has be inserted.a GL context, which must have been made current once gl, int position within this mutable shader source. pos)Adds default precision to source code at given position if required, i.e.
|
| public final int | Returns: the index after the inserted data, maybe 0 if nothing has be inserted.a GL context, which must have been made current once gl)Add GLSL version at the head of this shader source code. |
| public boolean | |
| public boolean | |
| public static ShaderCode | create(final GL2ES2
current GL object to determine whether a shader compiler is available. If null, no validation is performed. gl, final int type, final int number of shaders count, final Class<?> class used to help resolving the source location context, final String[] array of source locations, organized as sourceFiles, final boolean sourceFiles[count] -> shaderSources[count][1]if mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Creates a complete |
| public static ShaderCode | create(final GL2ES2
current GL object to determine whether a shader compiler is available. If null, no validation is performed. gl, final int type, final int number of shaders count, final Uri[] sourceLocations, final boolean if mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Creates a complete |
| public static ShaderCode | create(final int type, final int
number of shaders count, final Class<?> class used to help resolving the source location context, int a valid native binary format as they can be queried by binFormat, final String ShaderUtil#getShaderBinaryFormats(GL).array of source locations, organized as binaryFile)sourceFiles[count]Creates a complete |
| public static ShaderCode | create(final int type, final int
number of shaders count, int a valid native binary format as they can be queried by binFormat, final Uri ShaderUtil#getShaderBinaryFormats(GL).Uri binary locationCreates a complete |
| public static ShaderCode | create(final GL2ES2
current GL object to determine whether a shader compiler is available (if gl, final int type, final int source is used),
or to determine the shader binary format (if binary is used).number of shaders count, final Class<?> class used to help resolving the source and binary location context, final String relative root path for srcRoot, final String[] srcBasenames optionalbasenames w/o path or suffix relative to srcBasenames, final String srcRoot for the shader's source codeoptional custom suffix for shader's source file,
if srcSuffixOpt, final String null getFileSuffix(boolean, int) is being used.relative root path for binRoot, final String binBasenamesbasename w/o path or suffix relative to binBasename, final String binRoot for the shader's binary codeoptional custom suffix for shader's binary file,
if binSuffixOpt, final boolean null getFileSuffix(boolean, int) is being used.if mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Convenient creation method for instantiating a complete |
| public static ShaderCode | create(final GL2ES2
current GL object to determine whether a shader compiler is available (if gl, final int type, final int source is used),
or to determine the shader binary format (if binary is used).number of shaders count, final Class<?> class used to help resolving the source and binary location context, final String relative root path for srcRoot, final String[] srcBasenames optionalbasenames w/o path or suffix relative to srcBasenames, final String srcRoot for the shader's source coderelative root path for binRoot, final String binBasenamesbasename w/o path or suffix relative to binBasename, final boolean binRoot for the shader's binary codeif mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Simplified variation of |
| public static ShaderCode | create(final GL2ES2
current GL object to determine whether a shader compiler is available (if gl, final int type, final Class<?> source is used),
or to determine the shader binary format (if binary is used).class used to help resolving the source and binary location context, final String relative root path for srcRoot, final String basename optionalrelative root path for binRoot, final String basenamebasename w/o path or suffix relative to basename, final String srcRoot and binRoot
for the shader's source and binary code.optional custom suffix for shader's source file,
if srcSuffixOpt, final String null getFileSuffix(boolean, int) is being used.optional custom suffix for shader's binary file,
if binSuffixOpt, final boolean null getFileSuffix(boolean, int) is being used.if mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Simplified variation of |
| public static ShaderCode | create(final GL2ES2
current GL object to determine whether a shader compiler is available (if gl, final int type, final Class<?> source is used),
or to determine the shader binary format (if binary is used).class used to help resolving the source and binary location context, final String relative root path for srcRoot, final String basename optionalrelative root path for binRoot, final String basename, final boolean basename
Simplified variation of |
| public static String | |
| public final int | Returns: the index after the inserted data, maybe 0 if nothing has be inserted.a GL context, which must have been made current once gl, final boolean if true preludeVersion, final boolean GLContext#getGLSLVersionString() is preluded, otherwise not.if addDefaultPrecision)true default precision source code line(s) are added, i.e.
es2_default_precision_vp, es2_default_precision_fp,
gl3_default_precision_vp_gp, gl3_default_precision_fp or none,
depending on the GLSL version being used.Default customization of this shader source code. |
| public final int | Returns: the index after the inserted data, maybe 0 if nothing has be inserted.a GL context, which must have been made current once gl, final boolean if true preludeVersion, final String GLContext#getGLSLVersionString() is preluded, otherwise not.optional default precision source code line(s) preluded if not null and if esDefaultPrecision)GL#isGLES().
You may use es2_default_precision_fp for fragment shader and es2_default_precision_vp for vertex shader.Default customization of this shader source code. |
| public void | |
| public void | |
| public boolean | equals(final Object
the reference object with which to compare. obj)Overrides java. |
| public static String | getBinarySubPath(final int binFormat)
Returns a unique relative path for binary shader resources as follows: |
| public static String | getFileSuffix(final boolean
true for a binary resource, false for a source resource binary, final int type)Returns a unique suffix for shader resources as follows: |
| private static synchronized int | |
| public int | |
| public int | |
| public int | Returns: index after the inserteddatathe shader index to be used. shaderIdx, final String search string tag, final int start search fromIndex, final CharSequence tag begininig with this indexthe text to be inserted. Shall end with an EOL '\n' character. data)Adds |
| public int | Returns: index after the inserteddatathe shader index to be used. shaderIdx, int in shader source segments of shader position, final CharSequence shaderIdx, -1 will append datathe text to be inserted. Shall end with an EOL '\n' character data)Adds |
| public int | Returns: index after the inserted code.the shader index to be used. shaderIdx, final int in shader source segments of shader position, final Class<?> shaderIdx, -1 will append dataclass used to help resolve the source location context, final String location of shader source path)Adds shader source located in |
| public boolean | |
| public static ByteBuffer | readShaderBinary(final Class<?>
class used to help resolve the source location context, final String location of shader binary path)Reads shader binary located in |
| public static ByteBuffer | readShaderBinary(final Uri
Uri location of shader binaryReads shader binary located from |
| private static int | readShaderSource(final Class<?> context, final URLConnection conn, final StringBuilder result, int lineno)
|
| public static void | readShaderSource(final Class<?>
class used to help resolve the source location, may be context, final URLConnection nullthe conn, final StringBuilder URLConnection of the shader sourceStringBuilder sink for the resulting shader source codeReads shader source located in |
| public static CharSequence | readShaderSource(final Class<?>
class used to help resolve the source location context, final String location of shader source path, final boolean if mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Reads shader source located in |
| public static CharSequence | readShaderSource(final Uri
Uri location of shader sourceif mutableStringBuilder)true method returns a mutable StringBuilder instance
which can be edited later on at the costs of a String conversion when passing to
GL2ES2#glShaderSource(int, int, String[], IntBuffer).
If false method returns an immutable String instance,
which can be passed to GL2ES2#glShaderSource(int, int, String[], IntBuffer)
at no additional costs.Reads shader source located from |
| public int | Returns: the number of replacementsthe to be replace string oldName, final String the replacement string newName)Replaces |
| public static final boolean | requiresDefaultPrecision(final GL2ES2 gl)
Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. |
| public static final boolean | requiresGL3DefaultPrecision(final GL2ES2 gl)
Returns true, if GL3 GLSL version requires default precision, i.e. GLSL [1.30 .. |
| public IntBuffer | |
| public Buffer | |
| public int | |
| public CharSequence[][] | |
| public int | |
| public String | |
| public static String | |
| public String |