public abstract class ShaderProgram
extends java.lang.Object
setupShaderUsage() as first method inside your
implementation of the render(float[]) render()} method.
createProgram(int, int)
you can just call this method and do not need to worry about binding shaders.
SimpleShaderProgram
| Modifier and Type | Field and Description |
|---|---|
protected int |
colorDataSize |
protected int |
colorStrideBytes |
protected int |
positionDataSize |
protected int |
positionStrideBytes |
protected int |
shaderProgramHandle |
| Constructor and Description |
|---|
ShaderProgram(OpenGLShader vertexShader,
OpenGLShader fragmentShader) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
bindAttributes() |
abstract int |
getModelViewMatrixHandle() |
abstract int |
getProjectionMatrixHandle() |
int |
getShaderProgramHandle() |
void |
render(float[] position)
Only render a simple position.
|
void |
render(java.nio.FloatBuffer vertexBuffer,
java.nio.ByteBuffer indexBuffer) |
void |
render(java.nio.FloatBuffer vertexBuffer,
java.nio.FloatBuffer colorBuffer,
java.nio.ByteBuffer indexBuffer)
Full loaded render function.
|
void |
setModelViewMatrix(float[] modelViewMatrix) |
void |
setProjectionMatrix(float[] projectionMatrix) |
protected void |
setupShaderUsage()
Sets some basic settings for shader usage.
|
protected final int positionDataSize
protected final int colorDataSize
protected final int positionStrideBytes
protected final int colorStrideBytes
protected final int shaderProgramHandle
public ShaderProgram(OpenGLShader vertexShader, OpenGLShader fragmentShader)
public abstract int getProjectionMatrixHandle()
public abstract int getModelViewMatrixHandle()
protected abstract void bindAttributes()
public int getShaderProgramHandle()
public void render(java.nio.FloatBuffer vertexBuffer,
java.nio.FloatBuffer colorBuffer,
java.nio.ByteBuffer indexBuffer)
vertexBuffer - position vertex informationcolorBuffer - color informationindexBuffer - indexpublic void render(java.nio.FloatBuffer vertexBuffer,
java.nio.ByteBuffer indexBuffer)
public void render(float[] position)
render(FloatBuffer, FloatBuffer, ByteBuffer) but you can override this one directly
as shown in SimpleShaderProgramposition - The position to be renderedpublic void setProjectionMatrix(float[] projectionMatrix)
public void setModelViewMatrix(float[] modelViewMatrix)
protected void setupShaderUsage()
renderer() method.