public final class Shader extends NativeObject
| Modifier and Type | Class and Description |
|---|---|
static class |
Shader.ShaderSource
Shader source describes a shader object in OpenGL.
|
static class |
Shader.ShaderType
Type of shader.
|
handleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded| Modifier | Constructor and Description |
|---|---|
|
Shader()
Creates a new shader, initialize() must be called
after this constructor for the shader to be usable.
|
protected |
Shader(Shader s)
Do not use this constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSource(Shader.ShaderType type,
java.lang.String name,
java.lang.String source,
java.lang.String defines,
java.lang.String language)
Adds source code to a certain pipeline.
|
void |
addUniformBinding(UniformBinding binding) |
void |
clearUniformsSetByCurrentFlag()
Removes the "set-by-current-material" flag from all uniforms.
|
NativeObject |
createDestructableClone()
Creates a shallow clone of this GL Object.
|
void |
deleteObject(java.lang.Object rendererObject)
Deletes the GL object from the GPU when it is no longer used.
|
Attribute |
getAttribute(VertexBuffer.Type attribType) |
java.util.ArrayList<Uniform> |
getBoundUniforms() |
ShaderBufferBlock |
getBufferBlock(java.lang.String name)
Gets or creates a buffer block by the name.
|
ListMap<java.lang.String,ShaderBufferBlock> |
getBufferBlockMap()
Get the buffer blocks map.
|
java.util.Collection<Shader.ShaderSource> |
getSources() |
Uniform |
getUniform(java.lang.String name) |
ListMap<java.lang.String,Uniform> |
getUniformMap() |
long |
getUniqueId()
Returns a unique ID for this NativeObject.
|
void |
removeBufferBlock(java.lang.String name)
Removes a buffer block by the name.
|
void |
removeUniform(java.lang.String name) |
void |
resetLocations()
Usually called when the shader itself changes or during any
time when the variable locations need to be refreshed.
|
void |
resetObject()
Called by the object manager to reset all object IDs.
|
void |
resetUniformsNotSetByCurrent()
Resets all uniforms that do not have the "set-by-current-material" flag
to their default value (usually all zeroes or false).
|
void |
setUpdateNeeded()
Internal use only.
|
java.lang.String |
toString() |
clearUpdateNeeded, clone, deleteNativeBuffers, dispose, getId, getWeakRef, isUpdateNeeded, setIdpublic Shader()
protected Shader(Shader s)
s - (not null)public void addSource(Shader.ShaderType type, java.lang.String name, java.lang.String source, java.lang.String defines, java.lang.String language)
type - The pipeline to controlname - a name for the new shader objectsource - The shader source code (in GLSL).defines - Preprocessor defines (placed at the beginning of the shader)language - The shader source language, currently accepted is GLSL###
where ### is the version, e.g. GLSL100 = GLSL 1.0, GLSL330 = GLSL 3.3, etc.public void addUniformBinding(UniformBinding binding)
public Uniform getUniform(java.lang.String name)
public ShaderBufferBlock getBufferBlock(java.lang.String name)
name - the buffer block's name.public void removeUniform(java.lang.String name)
public void removeBufferBlock(java.lang.String name)
name - the buffer block's name.public Attribute getAttribute(VertexBuffer.Type attribType)
public ListMap<java.lang.String,ShaderBufferBlock> getBufferBlockMap()
public java.util.ArrayList<Uniform> getBoundUniforms()
public java.util.Collection<Shader.ShaderSource> getSources()
public java.lang.String toString()
toString in class NativeObjectpublic void clearUniformsSetByCurrentFlag()
resetUniformsNotSetByCurrent() will reset
all uniforms that do not have the "set-by-current-material" flag
to their default value (usually all zeroes or false).public void resetUniformsNotSetByCurrent()
clearUniformsSetByCurrentFlag().public void resetLocations()
public void setUpdateNeeded()
NativeObjectsetUpdateNeeded in class NativeObjectpublic void resetObject()
resetObject in class NativeObjectpublic void deleteObject(java.lang.Object rendererObject)
NativeObjectdeleteObject in class NativeObjectrendererObject - The renderer to be used to delete the objectpublic NativeObject createDestructableClone()
NativeObjectcreateDestructableClone in class NativeObjectpublic long getUniqueId()
NativeObjectgetUniqueId in class NativeObject