public class ShaderRenderer extends Object implements Disposable
| Modifier and Type | Field and Description |
|---|---|
protected SpriteBatch |
batch |
protected String |
fragmentShaderInclude |
protected int |
h |
protected ShaderProgram |
shader |
protected Texture[] |
tex |
protected int |
textureCount |
protected FileHandle |
vertexShader |
protected int |
w |
| Constructor and Description |
|---|
ShaderRenderer(String shaderFileName,
int width,
int height)
Create a shader render from an existing shader file.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addEmptyTexture(int width,
int height,
String textureIdentifier)
|
int |
addTexture(String texturePath,
String textureIdentifier)
Adds a new texture from an image to the OpenGL pipeline.
|
int |
addTexture(Texture t,
String n) |
void |
dispose()
Release the used resources properly.
|
void |
render(int posX,
int posY,
float time)
Render the shader.
|
void |
setTexture(Texture colorBufferTexture,
int id) |
void |
setUniform(String uniform,
boolean value)
Sets an uniform pair (key, value) that is passed to the shader
|
void |
setUniform(String uniform,
float value)
Sets an uniform pair (key, value) that is passed to the shader
|
void |
setUniform(String uniform,
float[] values)
Sets an uniform pair (key, value) that is passed to the shader
|
void |
setUniform(String uniform,
int value)
Set an uniform pair (key, value) that is passed to the shader.
|
void |
setUniform(String uniform,
Vector2 values)
Sets an uniform pair (key, value) that is passed to the shader
|
void |
setUniform(String uniform,
Vector3 values)
Sets an uniform pair (key, value) that is passed to the shader
|
protected final String fragmentShaderInclude
protected ShaderProgram shader
protected Texture[] tex
protected int textureCount
protected SpriteBatch batch
protected int w
protected int h
protected FileHandle vertexShader
public ShaderRenderer(String shaderFileName, int width, int height)
shaderFileName - the shader file name to rendererwidth - the shader widthheight - the shader heightpublic void render(int posX,
int posY,
float time)
posX - X center position of the texture shader to drawposY - Y center position of the texture shader to drawtime - the time information to pass to the shaderpublic void setUniform(String uniform, int value)
uniform - the uniform variable to changevalue - the value of the variable, intpublic void setUniform(String uniform, boolean value)
uniform - The uniform variable to changevalue - The value of the variable, booleanpublic void setUniform(String uniform, float value)
uniform - The uniform variable to changevalue - The value of the variable, floatpublic void setUniform(String uniform, float[] values)
uniform - The uniform variable to changevalues - The value of the variable, vec2public void setUniform(String uniform, Vector2 values)
uniform - The uniform variable to changevalues - The value of the variable, vec2public void setUniform(String uniform, Vector3 values)
uniform - The uniform variable to changevalues - The value of the variable, vec3public int addEmptyTexture(int width,
int height,
String textureIdentifier)
width - The width of the texture to createheight - The height of the texture to createtextureIdentifier - The uniform name passed to the shaderpublic int addTexture(String texturePath, String textureIdentifier)
texturePath - The image to load as a texturetextureIdentifier - The identifier uniform that will be passed to the shaderpublic void dispose()
dispose in interface Disposablepublic void setTexture(Texture colorBufferTexture, int id)
Copyright © 2014-2016 gdx2d - https://github.com/hevs-isi/gdx2d