JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
com.jogamp.opengl.util.glsl.ShaderCode Class Reference

Convenient shader code class to use and instantiate vertex or fragment programs. More...

Collaboration diagram for com.jogamp.opengl.util.glsl.ShaderCode:

Public Member Functions

 ShaderCode (final int type, final int count, final CharSequence[][] source)
 
 ShaderCode (final int type, final int count, final int binFormat, final Buffer binary)
 
int id ()
 returns the uniq shader id as an integer More...
 
int shaderType ()
 
String shaderTypeStr ()
 
int shaderBinaryFormat ()
 
Buffer shaderBinary ()
 
CharSequence[][] shaderSource ()
 
boolean isValid ()
 
IntBuffer shader ()
 
boolean compile (final GL2ES2 gl)
 
boolean compile (final GL2ES2 gl, final PrintStream verboseOut)
 
void destroy (final GL2ES2 gl)
 
boolean equals (final Object obj)
 
int hashCode ()
 
String toString ()
 
void dumpSource (final PrintStream out)
 
int insertShaderSource (final int shaderIdx, final String tag, final int fromIndex, final CharSequence data)
 Adds data after the line containing tag. More...
 
int replaceInShaderSource (final String oldName, final String newName)
 Replaces oldName with newName in all shader sources. More...
 
int insertShaderSource (final int shaderIdx, int position, final CharSequence data)
 Adds data at position in shader source for shader shaderIdx. More...
 
int insertShaderSource (final int shaderIdx, final int position, final Class<?> context, final String path) throws IOException
 Adds shader source located in path, either relative to the context class or absolute as-is at position in shader source for shader shaderIdx. More...
 
final int addGLSLVersion (final GL2ES2 gl)
 Add GLSL version at the head of this shader source code. More...
 
final int addDefaultShaderPrecision (final GL2ES2 gl, int pos)
 Adds default precision to source code at given position if required, i.e. More...
 
final int defaultShaderCustomization (final GL2ES2 gl, final boolean preludeVersion, final boolean addDefaultPrecision)
 Default customization of this shader source code. More...
 
final int defaultShaderCustomization (final GL2ES2 gl, final boolean preludeVersion, final String esDefaultPrecision)
 Default customization of this shader source code. More...
 

Static Public Member Functions

static ShaderCode create (final GL2ES2 gl, final int type, final int count, final Class<?> context, final String[] sourceFiles, final boolean mutableStringBuilder)
 Creates a complete ShaderCode object while reading all shader source of sourceFiles, which location is resolved using the context class, see readShaderSource(Class, String). More...
 
static ShaderCode create (final GL2ES2 gl, final int type, final int count, final Uri[] sourceLocations, final boolean mutableStringBuilder)
 Creates a complete ShaderCode object while reading all shader sources from Uri sourceLocations via readShaderSource(Uri, boolean). More...
 
static ShaderCode create (final int type, final int count, final Class<?> context, int binFormat, final String binaryFile)
 Creates a complete ShaderCode object while reading the shader binary of binaryFile, which location is resolved using the context class, see readShaderBinary(Class, String). More...
 
static ShaderCode create (final int type, final int count, int binFormat, final Uri binLocation)
 Creates a complete ShaderCode object while reading the shader binary from Uri binLocations via readShaderBinary(Uri). More...
 
static String getFileSuffix (final boolean binary, final int type)
 Returns a unique suffix for shader resources as follows: More...
 
static String getBinarySubPath (final int binFormat)
 Returns a unique relative path for binary shader resources as follows: More...
 
static ShaderCode create (final GL2ES2 gl, final int type, final int count, final Class<?> context, final String srcRoot, final String[] srcBasenames, final String srcSuffixOpt, final String binRoot, final String binBasename, final String binSuffixOpt, final boolean mutableStringBuilder)
 Convenient creation method for instantiating a complete ShaderCode object either from source code using create(GL2ES2, int, int, Class, String[]), or from a binary code using create(int, int, Class, int, String), whatever is available first. More...
 
static ShaderCode create (final GL2ES2 gl, final int type, final int count, final Class<?> context, final String srcRoot, final String[] srcBasenames, final String binRoot, final String binBasename, final boolean mutableStringBuilder)
 Simplified variation of create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean). More...
 
static ShaderCode create (final GL2ES2 gl, final int type, final Class<?> context, final String srcRoot, final String binRoot, final String basename, final String srcSuffixOpt, final String binSuffixOpt, final boolean mutableStringBuilder)
 Simplified variation of create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean). More...
 
static ShaderCode create (final GL2ES2 gl, final int type, final Class<?> context, final String srcRoot, final String binRoot, final String basename, final boolean mutableStringBuilder)
 Simplified variation of create(GL2ES2, int, Class, String, String, String, String, String, boolean). More...
 
static String shaderTypeStr (final int type)
 
static void readShaderSource (final Class<?> context, final URLConnection conn, final StringBuilder result) throws IOException
 Reads shader source located in conn. More...
 
static CharSequence readShaderSource (final Class<?> context, final String path, final boolean mutableStringBuilder) throws IOException
 Reads shader source located in path, either relative to the context class or absolute as-is. More...
 
static CharSequence readShaderSource (final Uri sourceLocation, final boolean mutableStringBuilder) throws IOException
 Reads shader source located from Uri#absolute Uri sourceLocation. More...
 
static ByteBuffer readShaderBinary (final Class<?> context, final String path) throws IOException
 Reads shader binary located in path, either relative to the context class or absolute as-is. More...
 
static ByteBuffer readShaderBinary (final Uri binLocation) throws IOException
 Reads shader binary located from Uri#absolute Uri binLocation. More...
 
static String createExtensionDirective (final String extensionName, final String behavior)
 Creates a GLSL extension directive. More...
 
static final boolean requiresDefaultPrecision (final GL2ES2 gl)
 Returns true, if GLSL version requires default precision, i.e. More...
 
static final boolean requiresGL3DefaultPrecision (final GL2ES2 gl)
 Returns true, if GL3 GLSL version requires default precision, i.e. More...
 

Static Public Attributes

static final boolean DEBUG_CODE = Debug.isPropertyDefined("jogl.debug.GLSLCode", true)
 
static final String SUFFIX_VERTEX_SOURCE = "vp"
 Unique resource suffix for GL2ES2#GL_VERTEX_SHADER in source code: {@value} More...
 
static final String SUFFIX_VERTEX_BINARY = "bvp"
 Unique resource suffix for GL2ES2#GL_VERTEX_SHADER in binary: {@value} More...
 
static final String SUFFIX_GEOMETRY_SOURCE = "gp"
 Unique resource suffix for GL3#GL_GEOMETRY_SHADER in source code: {@value} More...
 
static final String SUFFIX_GEOMETRY_BINARY = "bgp"
 Unique resource suffix for GL3#GL_GEOMETRY_SHADER in binary: {@value} More...
 
static final String SUFFIX_COMPUTE_SOURCE = "cp"
 Unique resource suffix for GL3ES3#GL_COMPUTE_SHADER in source code: {@value} More...
 
static final String SUFFIX_COMPUTE_BINARY = "bcp"
 Unique resource suffix for GL3ES3#GL_COMPUTE_SHADER in binary: {@value} More...
 
static final String SUFFIX_TESS_CONTROL_SOURCE = "tcp"
 Unique resource suffix for GL4#GL_TESS_CONTROL_SHADER in source code: {@value} More...
 
static final String SUFFIX_TESS_CONTROL_BINARY = "btcp"
 Unique resource suffix for GL4#GL_TESS_CONTROL_SHADER in binary: {@value} More...
 
static final String SUFFIX_TESS_EVALUATION_SOURCE = "tep"
 Unique resource suffix for GL4#GL_TESS_EVALUATION_SHADER in source code: {@value} More...
 
static final String SUFFIX_TESS_EVALUATION_BINARY = "btep"
 Unique resource suffix for GL4#GL_TESS_EVALUATION_SHADER in binary: {@value} More...
 
static final String SUFFIX_FRAGMENT_SOURCE = "fp"
 Unique resource suffix for GL2ES2#GL_FRAGMENT_SHADER in source code: {@value} More...
 
static final String SUFFIX_FRAGMENT_BINARY = "bfp"
 Unique resource suffix for GL2ES2#GL_FRAGMENT_SHADER in binary: {@value} More...
 
static final String SUB_PATH_NVIDIA = "nvidia"
 Unique relative path for binary shader resources for NVIDIA: {@value} More...
 
static final String es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n"
 Default precision of ES2 for vertex-shader: {@value es2_default_precision_vp}. More...
 
static final String es2_default_precision_fp = "\nprecision mediump float;\nprecision mediump int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n"
 Default precision of ES2 for fragment-shader: {@value es2_default_precision_fp}. More...
 
static final String es3_default_precision_vp = es2_default_precision_vp
 Default precision of ES3 for vertex-shader: {@value es3_default_precision_vp}. More...
 
static final String es3_default_precision_fp = es3_default_precision_vp
 Default precision of ES3 for fragment-shader: {@value es3_default_precision_fp}, same as for vertex-shader, i.e es3_default_precision_vp, due to ES 3.x requirements of using same precision for uniforms! More...
 
static final String gl3_default_precision_vp_gp = "\nprecision highp float;\nprecision highp int;\n"
 Default precision of GLSL ≥ 1.30 as required until < 1.50 for vertex-shader or geometry-shader: {@value gl3_default_precision_vp_gp}. More...
 
static final String gl3_default_precision_fp = "\nprecision highp float;\nprecision mediump int;\n/*precision mediump sampler2D;*/\n"
 Default precision of GLSL ≥ 1.30 as required until < 1.50 for fragment-shader: {@value gl3_default_precision_fp}. More...
 
static final String REQUIRE = "require"
 Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}. More...
 
static final String ENABLE = "enable"
 Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}. More...
 
static final String DISABLE = "disable"
 Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}. More...
 
static final String WARN = "warn"
 Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}. More...
 

Detailed Description

Convenient shader code class to use and instantiate vertex or fragment programs.

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.

Definition at line 75 of file ShaderCode.java.

Constructor & Destructor Documentation

◆ ShaderCode() [1/2]

com.jogamp.opengl.util.glsl.ShaderCode.ShaderCode ( final int  type,
final int  count,
final CharSequence  source[][] 
)
Parameters
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
sourceCharSequence array containing the shader sources, organized as source[count][strings-per-shader]. May be either an immutable String - or mutable StringBuilder array.
Exceptions
IllegalArgumentExceptionif count and source.length do not match

Definition at line 144 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShaderCode() [2/2]

com.jogamp.opengl.util.glsl.ShaderCode.ShaderCode ( final int  type,
final int  count,
final int  binFormat,
final Buffer  binary 
)
Parameters
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
binarybinary buffer containing the shader binaries,

Definition at line 178 of file ShaderCode.java.

Member Function Documentation

◆ addDefaultShaderPrecision()

final int com.jogamp.opengl.util.glsl.ShaderCode.addDefaultShaderPrecision ( final GL2ES2  gl,
int  pos 
)

Adds default precision to source code at given position if required, 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.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
gla GL context, which must have been made current once
posposition within this mutable shader source.
Returns
the index after the inserted data, maybe 0 if nothing has be inserted.

Definition at line 1319 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addGLSLVersion()

final int com.jogamp.opengl.util.glsl.ShaderCode.addGLSLVersion ( final GL2ES2  gl)

Add GLSL version at the head of this shader source code.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
gla GL context, which must have been made current once
Returns
the index after the inserted data, maybe 0 if nothing has be inserted.

Definition at line 1303 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compile() [1/2]

boolean com.jogamp.opengl.util.glsl.ShaderCode.compile ( final GL2ES2  gl)

Definition at line 808 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ compile() [2/2]

boolean com.jogamp.opengl.util.glsl.ShaderCode.compile ( final GL2ES2  gl,
final PrintStream  verboseOut 
)

Definition at line 811 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [1/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final GL2ES2  gl,
final int  type,
final Class<?>  context,
final String  srcRoot,
final String  binRoot,
final String  basename,
final boolean  mutableStringBuilder 
)
static

Simplified variation of create(GL2ES2, int, Class, String, String, String, String, String, boolean).

Example:

  Your std JVM layout (plain or within a JAR):

     org/test/glsl/MyShaderTest.class
     org/test/glsl/shader/vertex.vp
     org/test/glsl/shader/fragment.fp
     org/test/glsl/shader/bin/nvidia/vertex.bvp
     org/test/glsl/shader/bin/nvidia/fragment.bfp

  Your Android APK layout:

     classes.dex
     assets/org/test/glsl/shader/vertex.vp
     assets/org/test/glsl/shader/fragment.fp
     assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
     assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
     ...

  Your invocation in org/test/glsl/MyShaderTest.java:

     ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
                                        "shader", "shader/bin", "vertex", true);
     ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
                                        "shader", "shader/bin", "fragment", true);
     ShaderProgram sp0 = new ShaderProgram();
     sp0.add(gl, vp0, System.err);
     sp0.add(gl, fp0, System.err);
     st.attachShaderProgram(gl, sp0, true);
Parameters
glcurrent GL object to determine whether a shader compiler is available (if source is used), or to determine the shader binary format (if binary is used).
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
contextclass used to help resolving the source and binary location
srcRootrelative root path for basename optional
binRootrelative root path for basename
mutableStringBuilderif 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.
basenamesbasename w/o path or suffix relative to srcRoot and binRoot for the shader's source and binary code.
mutableStringBuilderif 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.
Exceptions
IllegalArgumentExceptionif count is not 1

Definition at line 768 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [2/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final GL2ES2  gl,
final int  type,
final Class<?>  context,
final String  srcRoot,
final String  binRoot,
final String  basename,
final String  srcSuffixOpt,
final String  binSuffixOpt,
final boolean  mutableStringBuilder 
)
static

Simplified variation of create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean).

Example:

  Your std JVM layout (plain or within a JAR):

     org/test/glsl/MyShaderTest.class
     org/test/glsl/shader/vertex.vp
     org/test/glsl/shader/fragment.fp
     org/test/glsl/shader/bin/nvidia/vertex.bvp
     org/test/glsl/shader/bin/nvidia/fragment.bfp

  Your Android APK layout:

     classes.dex
     assets/org/test/glsl/shader/vertex.vp
     assets/org/test/glsl/shader/fragment.fp
     assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
     assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
     ...

  Your invocation in org/test/glsl/MyShaderTest.java:

     ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, this.getClass(),
                                        "shader", "shader/bin", "vertex", null, null, true);
     ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, this.getClass(),
                                        "shader", "shader/bin", "fragment", null, null, true);
     ShaderProgram sp0 = new ShaderProgram();
     sp0.add(gl, vp0, System.err);
     sp0.add(gl, fp0, System.err);
     st.attachShaderProgram(gl, sp0, true);
Parameters
glcurrent GL object to determine whether a shader compiler is available (if source is used), or to determine the shader binary format (if binary is used).
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
contextclass used to help resolving the source and binary location
srcRootrelative root path for basename optional
binRootrelative root path for basename
basenamebasename w/o path or suffix relative to srcRoot and binRoot for the shader's source and binary code.
srcSuffixOptoptional custom suffix for shader's source file, if null getFileSuffix(boolean, int) is being used.
binSuffixOptoptional custom suffix for shader's binary file, if null getFileSuffix(boolean, int) is being used.
mutableStringBuilderif 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.
Exceptions
IllegalArgumentExceptionif count is not 1
See also
#create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean)
Since
2.3.2

Definition at line 702 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [3/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final GL2ES2  gl,
final int  type,
final int  count,
final Class<?>  context,
final String  srcRoot,
final String[]  srcBasenames,
final String  binRoot,
final String  binBasename,
final boolean  mutableStringBuilder 
)
static

Simplified variation of create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean).

Convenient creation method for instantiating a complete ShaderCode object either from source code using create(GL2ES2, int, int, Class, String[]), or from a binary code using create(int, int, Class, int, String), whatever is available first.

The source and binary location names are expected w/o suffixes which are resolved and appended using getFileSuffix(boolean, int).

Additionally, the binary resource is expected within a subfolder of binRoot which reflects the vendor specific binary format, see getBinarySubPath(int). All ShaderUtil#getShaderBinaryFormats(GL) are being iterated using the binary subfolder, the first existing resource is being used.

Example:

  Your std JVM layout (plain or within a JAR):

     org/test/glsl/MyShaderTest.class
     org/test/glsl/shader/vertex.vp
     org/test/glsl/shader/fragment.fp
     org/test/glsl/shader/bin/nvidia/vertex.bvp
     org/test/glsl/shader/bin/nvidia/fragment.bfp

  Your Android APK layout:

     classes.dex
     assets/org/test/glsl/shader/vertex.vp
     assets/org/test/glsl/shader/fragment.fp
     assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
     assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
     ...

  Your invocation in org/test/glsl/MyShaderTest.java:

     ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
                                        "shader", new String[] { "vertex" }, "shader/bin", "vertex", true);
     ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
                                        "shader", new String[] { "vertex" }, "shader/bin", "fragment", true);
     ShaderProgram sp0 = new ShaderProgram();
     sp0.add(gl, vp0, System.err);
     sp0.add(gl, fp0, System.err);
     st.attachShaderProgram(gl, sp0, true);

A simplified entry point is create(GL2ES2, int, Class, String, String, String, boolean).

The location is finally being resolved using the context class, see readShaderBinary(Class, String).

Parameters
glcurrent GL object to determine whether a shader compiler is available (if source is used), or to determine the shader binary format (if binary is used).
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
contextclass used to help resolving the source and binary location
srcRootrelative root path for srcBasenames optional
srcBasenamesbasenames w/o path or suffix relative to srcRoot for the shader's source code
binRootrelative root path for binBasenames
binBasenamebasename w/o path or suffix relative to binRoot for the shader's binary code
mutableStringBuilderif 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.
Exceptions
IllegalArgumentExceptionif count and srcBasenames.length do not match
See also
#create(GL2ES2, int, int, Class, String, String[], String, String, String, String, boolean)
#readShaderSource(Class, String)
getFileSuffix(boolean, int)
ShaderUtil::getShaderBinaryFormats(GL)
getBinarySubPath(int)

Definition at line 635 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [4/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final GL2ES2  gl,
final int  type,
final int  count,
final Class<?>  context,
final String  srcRoot,
final String[]  srcBasenames,
final String  srcSuffixOpt,
final String  binRoot,
final String  binBasename,
final String  binSuffixOpt,
final boolean  mutableStringBuilder 
)
static

Convenient creation method for instantiating a complete ShaderCode object either from source code using create(GL2ES2, int, int, Class, String[]), or from a binary code using create(int, int, Class, int, String), whatever is available first.

The source and binary location names are expected w/o suffixes which are resolved and appended using the given srcSuffixOpt and binSuffixOpt if not null, otherwise getFileSuffix(boolean, int) determines the suffixes.

Additionally, the binary resource is expected within a subfolder of binRoot which reflects the vendor specific binary format, see getBinarySubPath(int). All ShaderUtil#getShaderBinaryFormats(GL) are being iterated using the binary subfolder, the first existing resource is being used.

Example:

  Your std JVM layout (plain or within a JAR):

     org/test/glsl/MyShaderTest.class
     org/test/glsl/shader/vertex.vp
     org/test/glsl/shader/fragment.fp
     org/test/glsl/shader/bin/nvidia/vertex.bvp
     org/test/glsl/shader/bin/nvidia/fragment.bfp

  Your Android APK layout:

     classes.dex
     assets/org/test/glsl/shader/vertex.vp
     assets/org/test/glsl/shader/fragment.fp
     assets/org/test/glsl/shader/bin/nvidia/vertex.bvp
     assets/org/test/glsl/shader/bin/nvidia/fragment.bfp
     ...

  Your invocation in org/test/glsl/MyShaderTest.java:

     ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, 1, this.getClass(),
                                        "shader", new String[] { "vertex" }, null,
                                        "shader/bin", "vertex", null, true);
     ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, 1, this.getClass(),
                                        "shader", new String[] { "vertex" }, null,
                                        "shader/bin", "fragment", null, true);
     ShaderProgram sp0 = new ShaderProgram();
     sp0.add(gl, vp0, System.err);
     sp0.add(gl, fp0, System.err);
     st.attachShaderProgram(gl, sp0, true);

A simplified entry point is create(GL2ES2, int, Class, String, String, String, boolean).

The location is finally being resolved using the context class, see readShaderBinary(Class, String).

Parameters
glcurrent GL object to determine whether a shader compiler is available (if source is used), or to determine the shader binary format (if binary is used).
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
contextclass used to help resolving the source and binary location
srcRootrelative root path for srcBasenames optional
srcBasenamesbasenames w/o path or suffix relative to srcRoot for the shader's source code
srcSuffixOptoptional custom suffix for shader's source file, if null getFileSuffix(boolean, int) is being used.
binRootrelative root path for binBasenames
binBasenamebasename w/o path or suffix relative to binRoot for the shader's binary code
binSuffixOptoptional custom suffix for shader's binary file, if null getFileSuffix(boolean, int) is being used.
mutableStringBuilderif 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.
Exceptions
IllegalArgumentExceptionif count and srcBasenames.length do not match
See also
#create(GL2ES2, int, int, Class, String[])
#create(int, int, Class, int, String)
#readShaderSource(Class, String)
getFileSuffix(boolean, int)
ShaderUtil::getShaderBinaryFormats(GL)
getBinarySubPath(int)
Since
2.3.2

Definition at line 508 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [5/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final GL2ES2  gl,
final int  type,
final int  count,
final Class<?>  context,
final String[]  sourceFiles,
final boolean  mutableStringBuilder 
)
static

Creates a complete ShaderCode object while reading all shader source of sourceFiles, which location is resolved using the context class, see readShaderSource(Class, String).

Parameters
glcurrent GL object to determine whether a shader compiler is available. If null, no validation is performed.
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
contextclass used to help resolving the source location
sourceFilesarray of source locations, organized as sourceFiles[count] -> shaderSources[count][1]
mutableStringBuilderif 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.
Exceptions
IllegalArgumentExceptionif count and sourceFiles.length do not match
See also
#readShaderSource(Class, String)

Definition at line 218 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [6/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final GL2ES2  gl,
final int  type,
final int  count,
final Uri[]  sourceLocations,
final boolean  mutableStringBuilder 
)
static

Creates a complete ShaderCode object while reading all shader sources from Uri sourceLocations via readShaderSource(Uri, boolean).

Parameters
glcurrent GL object to determine whether a shader compiler is available. If null, no validation is performed.
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
sourceLocationsarray of Uri source locations, organized as sourceFiles[count] -> shaderSources[count][1]
mutableStringBuilderif 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.
Exceptions
IllegalArgumentExceptionif count and sourceFiles.length do not match
See also
readShaderSource(Uri, boolean)
Since
2.3.2

Definition at line 265 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [7/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final int  type,
final int  count,
final Class<?>  context,
int  binFormat,
final String  binaryFile 
)
static

Creates a complete ShaderCode object while reading the shader binary of binaryFile, which location is resolved using the context class, see readShaderBinary(Class, String).

Parameters
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
contextclass used to help resolving the source location
binFormata valid native binary format as they can be queried by ShaderUtil#getShaderBinaryFormats(GL).
sourceFilesarray of source locations, organized as sourceFiles[count]
See also
#readShaderBinary(Class, String)
ShaderUtil::getShaderBinaryFormats(GL)

Definition at line 306 of file ShaderCode.java.

Here is the call graph for this function:

◆ create() [8/8]

static ShaderCode com.jogamp.opengl.util.glsl.ShaderCode.create ( final int  type,
final int  count,
int  binFormat,
final Uri  binLocation 
)
static

Creates a complete ShaderCode object while reading the shader binary from Uri binLocations via readShaderBinary(Uri).

Parameters
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
countnumber of shaders
binFormata valid native binary format as they can be queried by ShaderUtil#getShaderBinaryFormats(GL).
binLocationsUri binary location
See also
readShaderBinary(Uri)
ShaderUtil::getShaderBinaryFormats(GL)
Since
2.3.2

Definition at line 337 of file ShaderCode.java.

Here is the call graph for this function:

◆ createExtensionDirective()

static String com.jogamp.opengl.util.glsl.ShaderCode.createExtensionDirective ( final String  extensionName,
final String  behavior 
)
static

Creates a GLSL extension directive.

Prefer ENABLE over REQUIRE, since the latter will force a failure if not supported.

Parameters
extensionName
behaviorshall be either REQUIRE, ENABLE, DISABLE or WARN
Returns
the complete extension directive

Definition at line 1291 of file ShaderCode.java.

◆ defaultShaderCustomization() [1/2]

final int com.jogamp.opengl.util.glsl.ShaderCode.defaultShaderCustomization ( final GL2ES2  gl,
final boolean  preludeVersion,
final boolean  addDefaultPrecision 
)

Default customization of this shader source code.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
gla GL context, which must have been made current once
preludeVersionif true GLContext#getGLSLVersionString() is preluded, otherwise not.
addDefaultPrecisionif 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.
Returns
the index after the inserted data, maybe 0 if nothing has be inserted.
See also
addGLSLVersion(GL2ES2)
addDefaultShaderPrecision(GL2ES2, int)

Definition at line 1401 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ defaultShaderCustomization() [2/2]

final int com.jogamp.opengl.util.glsl.ShaderCode.defaultShaderCustomization ( final GL2ES2  gl,
final boolean  preludeVersion,
final String  esDefaultPrecision 
)

Default customization of this shader source code.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
gla GL context, which must have been made current once
preludeVersionif true GLContext#getGLSLVersionString() is preluded, otherwise not.
esDefaultPrecisionoptional default precision source code line(s) preluded if not null and if GL#isGLES(). You may use es2_default_precision_fp for fragment shader and es2_default_precision_vp for vertex shader.
Returns
the index after the inserted data, maybe 0 if nothing has be inserted.
See also
addGLSLVersion(GL2ES2)
addDefaultShaderPrecision(GL2ES2, int)

Definition at line 1427 of file ShaderCode.java.

Here is the call graph for this function:

◆ destroy()

void com.jogamp.opengl.util.glsl.ShaderCode.destroy ( final GL2ES2  gl)

Definition at line 831 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpSource()

void com.jogamp.opengl.util.glsl.ShaderCode.dumpSource ( final PrintStream  out)

Definition at line 874 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equals()

boolean com.jogamp.opengl.util.glsl.ShaderCode.equals ( final Object  obj)

Definition at line 849 of file ShaderCode.java.

Here is the call graph for this function:

◆ getBinarySubPath()

static String com.jogamp.opengl.util.glsl.ShaderCode.getBinarySubPath ( final int  binFormat)
static

Returns a unique relative path for binary shader resources as follows:

Exceptions
GLExceptionif binFormat is not supported
See also
#create(GL2ES2, int, Class, String, String, String, boolean)

Definition at line 412 of file ShaderCode.java.

Here is the caller graph for this function:

◆ getFileSuffix()

static String com.jogamp.opengl.util.glsl.ShaderCode.getFileSuffix ( final boolean  binary,
final int  type 
)
static

Returns a unique suffix for shader resources as follows:

Parameters
binarytrue for a binary resource, false for a source resource
typeeither GL2ES2#GL_VERTEX_SHADER, GL2ES2#GL_FRAGMENT_SHADER, GL3#GL_GEOMETRY_SHADER, GL4#GL_TESS_CONTROL_SHADER, GL4#GL_TESS_EVALUATION_SHADER or GL3ES3#GL_COMPUTE_SHADER.
Exceptions
GLExceptionif type is not supported
See also
#create(GL2ES2, int, Class, String, String, String, boolean)

Definition at line 383 of file ShaderCode.java.

Here is the caller graph for this function:

◆ hashCode()

int com.jogamp.opengl.util.glsl.ShaderCode.hashCode ( )

Definition at line 857 of file ShaderCode.java.

◆ id()

int com.jogamp.opengl.util.glsl.ShaderCode.id ( )

returns the uniq shader id as an integer

Definition at line 777 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertShaderSource() [1/3]

int com.jogamp.opengl.util.glsl.ShaderCode.insertShaderSource ( final int  shaderIdx,
final int  position,
final Class<?>  context,
final String  path 
) throws IOException

Adds shader source located in path, either relative to the context class or absolute as-is at position in shader source for shader shaderIdx.

Final location lookup is performed via ClassLoader#getResource(String) and ClassLoader#getSystemResource(String), see IOUtil#getResource(Class, String).

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
shaderIdxthe shader index to be used.
positionin shader source segments of shader shaderIdx, -1 will append data
contextclass used to help resolve the source location
pathlocation of shader source
Returns
index after the inserted code.
Exceptions
IOException
IllegalStateExceptionif the shader source's CharSequence is immutable, i.e. not of type StringBuilder
See also
IOUtil::getResource(Class, String)

Definition at line 1084 of file ShaderCode.java.

Here is the call graph for this function:

◆ insertShaderSource() [2/3]

int com.jogamp.opengl.util.glsl.ShaderCode.insertShaderSource ( final int  shaderIdx,
final String  tag,
final int  fromIndex,
final CharSequence  data 
)

Adds data after the line containing tag.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
shaderIdxthe shader index to be used.
tagsearch string
fromIndexstart search tag begininig with this index
datathe text to be inserted. Shall end with an EOL '
' character.
Returns
index after the inserted data
Exceptions
IllegalStateExceptionif the shader source's CharSequence is immutable, i.e. not of type StringBuilder

Definition at line 927 of file ShaderCode.java.

Here is the caller graph for this function:

◆ insertShaderSource() [3/3]

int com.jogamp.opengl.util.glsl.ShaderCode.insertShaderSource ( final int  shaderIdx,
int  position,
final CharSequence  data 
)

Adds data at position in shader source for shader shaderIdx.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
shaderIdxthe shader index to be used.
positionin shader source segments of shader shaderIdx, -1 will append data
datathe text to be inserted. Shall end with an EOL '
' character
Returns
index after the inserted data
Exceptions
IllegalStateExceptionif the shader source's CharSequence is immutable, i.e. not of type StringBuilder

Definition at line 1032 of file ShaderCode.java.

◆ isValid()

boolean com.jogamp.opengl.util.glsl.ShaderCode.isValid ( )

Definition at line 804 of file ShaderCode.java.

Here is the caller graph for this function:

◆ readShaderBinary() [1/2]

static ByteBuffer com.jogamp.opengl.util.glsl.ShaderCode.readShaderBinary ( final Class<?>  context,
final String  path 
) throws IOException
static

Reads shader binary located in path, either relative to the context class or absolute as-is.

Final location lookup is perfomed via ClassLoader#getResource(String) and ClassLoader#getSystemResource(String), see IOUtil#getResource(Class, String).

Parameters
contextclass used to help resolve the source location
pathlocation of shader binary
Exceptions
IOException
See also
IOUtil::getResource(Class, String)

Definition at line 1220 of file ShaderCode.java.

Here is the caller graph for this function:

◆ readShaderBinary() [2/2]

static ByteBuffer com.jogamp.opengl.util.glsl.ShaderCode.readShaderBinary ( final Uri  binLocation) throws IOException
static

Reads shader binary located from Uri#absolute Uri binLocation.

Parameters
binLocationUri location of shader binary
Exceptions
IOException
Since
2.3.2

Definition at line 1239 of file ShaderCode.java.

◆ readShaderSource() [1/3]

static CharSequence com.jogamp.opengl.util.glsl.ShaderCode.readShaderSource ( final Class<?>  context,
final String  path,
final boolean  mutableStringBuilder 
) throws IOException
static

Reads shader source located in path, either relative to the context class or absolute as-is.

Final location lookup is performed via ClassLoader#getResource(String) and ClassLoader#getSystemResource(String), see IOUtil#getResource(Class, String).

Parameters
contextclass used to help resolve the source location
pathlocation of shader source
mutableStringBuilderif 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.
Exceptions
IOException
See also
IOUtil::getResource(Class, String)

Definition at line 1174 of file ShaderCode.java.

◆ readShaderSource() [2/3]

static void com.jogamp.opengl.util.glsl.ShaderCode.readShaderSource ( final Class<?>  context,
final URLConnection  conn,
final StringBuilder  result 
) throws IOException
static

Reads shader source located in conn.

Parameters
contextclass used to help resolve the source location, may be null
connthe URLConnection of the shader source
resultStringBuilder sink for the resulting shader source code
Exceptions
IOException

Definition at line 1150 of file ShaderCode.java.

◆ readShaderSource() [3/3]

static CharSequence com.jogamp.opengl.util.glsl.ShaderCode.readShaderSource ( final Uri  sourceLocation,
final boolean  mutableStringBuilder 
) throws IOException
static

Reads shader source located from Uri#absolute Uri sourceLocation.

Parameters
sourceLocationUri location of shader source
mutableStringBuilderif 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.
Exceptions
IOException
Since
2.3.2

Definition at line 1196 of file ShaderCode.java.

◆ replaceInShaderSource()

int com.jogamp.opengl.util.glsl.ShaderCode.replaceInShaderSource ( final String  oldName,
final String  newName 
)

Replaces oldName with newName in all shader sources.

In case oldName and newName are equal, no action is performed.

Note: The shader source to be edit must be created using a mutable StringBuilder.

Parameters
oldNamethe to be replace string
newNamethe replacement string
Returns
the number of replacements
Exceptions
IllegalStateExceptionif the shader source's CharSequence is immutable, i.e. not of type StringBuilder

Definition at line 984 of file ShaderCode.java.

◆ requiresDefaultPrecision()

static final boolean com.jogamp.opengl.util.glsl.ShaderCode.requiresDefaultPrecision ( final GL2ES2  gl)
static

Returns true, if GLSL version requires default precision, i.e.

ES2 or GLSL [1.30 .. 1.50[.

Definition at line 1369 of file ShaderCode.java.

Here is the call graph for this function:

◆ requiresGL3DefaultPrecision()

static final boolean com.jogamp.opengl.util.glsl.ShaderCode.requiresGL3DefaultPrecision ( final GL2ES2  gl)
static

Returns true, if GL3 GLSL version requires default precision, i.e.

GLSL [1.30 .. 1.50[.

Definition at line 1377 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shader()

IntBuffer com.jogamp.opengl.util.glsl.ShaderCode.shader ( )

Definition at line 806 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shaderBinary()

Buffer com.jogamp.opengl.util.glsl.ShaderCode.shaderBinary ( )

Definition at line 801 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shaderBinaryFormat()

int com.jogamp.opengl.util.glsl.ShaderCode.shaderBinaryFormat ( )

Definition at line 800 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shaderSource()

CharSequence[][] com.jogamp.opengl.util.glsl.ShaderCode.shaderSource ( )

Definition at line 802 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shaderType()

int com.jogamp.opengl.util.glsl.ShaderCode.shaderType ( )

Definition at line 779 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shaderTypeStr() [1/2]

String com.jogamp.opengl.util.glsl.ShaderCode.shaderTypeStr ( )

Definition at line 780 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shaderTypeStr() [2/2]

static String com.jogamp.opengl.util.glsl.ShaderCode.shaderTypeStr ( final int  type)
static

Definition at line 782 of file ShaderCode.java.

◆ toString()

String com.jogamp.opengl.util.glsl.ShaderCode.toString ( )

Definition at line 861 of file ShaderCode.java.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ DEBUG_CODE

final boolean com.jogamp.opengl.util.glsl.ShaderCode.DEBUG_CODE = Debug.isPropertyDefined("jogl.debug.GLSLCode", true)
static

Definition at line 76 of file ShaderCode.java.

◆ DISABLE

final String com.jogamp.opengl.util.glsl.ShaderCode.DISABLE = "disable"
static

Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}.

Definition at line 1277 of file ShaderCode.java.

◆ ENABLE

final String com.jogamp.opengl.util.glsl.ShaderCode.ENABLE = "enable"
static

Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}.

Definition at line 1275 of file ShaderCode.java.

◆ es2_default_precision_fp

final String com.jogamp.opengl.util.glsl.ShaderCode.es2_default_precision_fp = "\nprecision mediump float;\nprecision mediump int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n"
static

Default precision of ES2 for fragment-shader: {@value es2_default_precision_fp}.

Definition at line 1256 of file ShaderCode.java.

◆ es2_default_precision_vp

final String com.jogamp.opengl.util.glsl.ShaderCode.es2_default_precision_vp = "\nprecision highp float;\nprecision highp int;\n/*precision lowp sampler2D;*/\n/*precision lowp samplerCube;*/\n"
static

Default precision of ES2 for vertex-shader: {@value es2_default_precision_vp}.

Definition at line 1254 of file ShaderCode.java.

◆ es3_default_precision_fp

final String com.jogamp.opengl.util.glsl.ShaderCode.es3_default_precision_fp = es3_default_precision_vp
static

Default precision of ES3 for fragment-shader: {@value es3_default_precision_fp}, same as for vertex-shader, i.e es3_default_precision_vp, due to ES 3.x requirements of using same precision for uniforms!

Definition at line 1265 of file ShaderCode.java.

◆ es3_default_precision_vp

final String com.jogamp.opengl.util.glsl.ShaderCode.es3_default_precision_vp = es2_default_precision_vp
static

Default precision of ES3 for vertex-shader: {@value es3_default_precision_vp}.

Definition at line 1259 of file ShaderCode.java.

◆ gl3_default_precision_fp

final String com.jogamp.opengl.util.glsl.ShaderCode.gl3_default_precision_fp = "\nprecision highp float;\nprecision mediump int;\n/*precision mediump sampler2D;*/\n"
static

Default precision of GLSL ≥ 1.30 as required until < 1.50 for fragment-shader: {@value gl3_default_precision_fp}.

See GLSL Spec 1.30-1.50 Section 4.5.3.

Definition at line 1270 of file ShaderCode.java.

◆ gl3_default_precision_vp_gp

final String com.jogamp.opengl.util.glsl.ShaderCode.gl3_default_precision_vp_gp = "\nprecision highp float;\nprecision highp int;\n"
static

Default precision of GLSL ≥ 1.30 as required until < 1.50 for vertex-shader or geometry-shader: {@value gl3_default_precision_vp_gp}.

See GLSL Spec 1.30-1.50 Section 4.5.3.

Definition at line 1268 of file ShaderCode.java.

◆ REQUIRE

final String com.jogamp.opengl.util.glsl.ShaderCode.REQUIRE = "require"
static

Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}.

Definition at line 1273 of file ShaderCode.java.

◆ SUB_PATH_NVIDIA

final String com.jogamp.opengl.util.glsl.ShaderCode.SUB_PATH_NVIDIA = "nvidia"
static

Unique relative path for binary shader resources for NVIDIA: {@value}

Definition at line 133 of file ShaderCode.java.

◆ SUFFIX_COMPUTE_BINARY

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_COMPUTE_BINARY = "bcp"
static

Unique resource suffix for GL3ES3#GL_COMPUTE_SHADER in binary: {@value}

Since
2.3.2

Definition at line 100 of file ShaderCode.java.

◆ SUFFIX_COMPUTE_SOURCE

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_COMPUTE_SOURCE = "cp"
static

Unique resource suffix for GL3ES3#GL_COMPUTE_SHADER in source code: {@value}

Since
2.3.2

Definition at line 94 of file ShaderCode.java.

◆ SUFFIX_FRAGMENT_BINARY

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_FRAGMENT_BINARY = "bfp"
static

Unique resource suffix for GL2ES2#GL_FRAGMENT_SHADER in binary: {@value}

Definition at line 130 of file ShaderCode.java.

◆ SUFFIX_FRAGMENT_SOURCE

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_FRAGMENT_SOURCE = "fp"
static

Unique resource suffix for GL2ES2#GL_FRAGMENT_SHADER in source code: {@value}

Definition at line 127 of file ShaderCode.java.

◆ SUFFIX_GEOMETRY_BINARY

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_GEOMETRY_BINARY = "bgp"
static

Unique resource suffix for GL3#GL_GEOMETRY_SHADER in binary: {@value}

Definition at line 88 of file ShaderCode.java.

◆ SUFFIX_GEOMETRY_SOURCE

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_GEOMETRY_SOURCE = "gp"
static

Unique resource suffix for GL3#GL_GEOMETRY_SHADER in source code: {@value}

Definition at line 85 of file ShaderCode.java.

◆ SUFFIX_TESS_CONTROL_BINARY

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_TESS_CONTROL_BINARY = "btcp"
static

Unique resource suffix for GL4#GL_TESS_CONTROL_SHADER in binary: {@value}

Since
2.2.1

Definition at line 112 of file ShaderCode.java.

◆ SUFFIX_TESS_CONTROL_SOURCE

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_TESS_CONTROL_SOURCE = "tcp"
static

Unique resource suffix for GL4#GL_TESS_CONTROL_SHADER in source code: {@value}

Since
2.2.1

Definition at line 106 of file ShaderCode.java.

◆ SUFFIX_TESS_EVALUATION_BINARY

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_TESS_EVALUATION_BINARY = "btep"
static

Unique resource suffix for GL4#GL_TESS_EVALUATION_SHADER in binary: {@value}

Since
2.2.1

Definition at line 124 of file ShaderCode.java.

◆ SUFFIX_TESS_EVALUATION_SOURCE

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_TESS_EVALUATION_SOURCE = "tep"
static

Unique resource suffix for GL4#GL_TESS_EVALUATION_SHADER in source code: {@value}

Since
2.2.1

Definition at line 118 of file ShaderCode.java.

◆ SUFFIX_VERTEX_BINARY

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_VERTEX_BINARY = "bvp"
static

Unique resource suffix for GL2ES2#GL_VERTEX_SHADER in binary: {@value}

Definition at line 82 of file ShaderCode.java.

◆ SUFFIX_VERTEX_SOURCE

final String com.jogamp.opengl.util.glsl.ShaderCode.SUFFIX_VERTEX_SOURCE = "vp"
static

Unique resource suffix for GL2ES2#GL_VERTEX_SHADER in source code: {@value}

Definition at line 79 of file ShaderCode.java.

◆ WARN

final String com.jogamp.opengl.util.glsl.ShaderCode.WARN = "warn"
static

Behavior for GLSL extension directive, see createExtensionDirective(String, String), value {@value}.

Definition at line 1279 of file ShaderCode.java.


The documentation for this class was generated from the following file: