Methods Summary |
---|
private native boolean | allocate(GLEnvironment glEnv, java.lang.String vertexShader, java.lang.String fragmentShader)
|
public void | beginDrawing()
if (!beginShaderDrawing()) {
throw new RuntimeException("Could not prepare shader-program for drawing!");
}
|
private native boolean | beginShaderDrawing()
|
private native boolean | compileAndLink()
|
public static android.filterfw.core.ShaderProgram | createIdentity(FilterContext context)
ShaderProgram program = nativeCreateIdentity(getGLEnvironment(context));
program.setTimer();
return program;
|
private native boolean | deallocate()
|
protected void | finalize()
deallocate();
|
private static GLEnvironment | getGLEnvironment(FilterContext context)
GLEnvironment result = context != null ? context.getGLEnvironment() : null;
if (result == null) {
throw new NullPointerException("Attempting to create ShaderProgram with no GL "
+ "environment in place!");
}
return result;
|
public GLEnvironment | getGLEnvironment()
return mGLEnvironment;
|
public java.lang.Object | getHostValue(java.lang.String variableName)
return getUniformValue(variableName);
|
private native java.lang.Object | getUniformValue(java.lang.String name)
|
private static native android.filterfw.core.ShaderProgram | nativeCreateIdentity(GLEnvironment glEnv)
|
public void | process(android.filterfw.core.Frame[] inputs, android.filterfw.core.Frame output)
if (mTimer.LOG_MFF_RUNNING_TIMES) {
mTimer.start("glFinish");
GLES20.glFinish();
mTimer.stop("glFinish");
}
// Get the GL input frames
// TODO: We do the same in the NativeProgram... can we find a better way?!
GLFrame[] glInputs = new GLFrame[inputs.length];
for (int i = 0; i < inputs.length; ++i) {
if (inputs[i] instanceof GLFrame) {
glInputs[i] = (GLFrame)inputs[i];
} else {
throw new RuntimeException("ShaderProgram got non-GL frame as input " + i + "!");
}
}
// Get the GL output frame
GLFrame glOutput = null;
if (output instanceof GLFrame) {
glOutput = (GLFrame)output;
} else {
throw new RuntimeException("ShaderProgram got non-GL output frame!");
}
// Adjust tiles to meet maximum tile size requirement
if (mMaxTileSize > 0) {
int xTiles = (output.getFormat().getWidth() + mMaxTileSize - 1) / mMaxTileSize;
int yTiles = (output.getFormat().getHeight() + mMaxTileSize - 1) / mMaxTileSize;
setShaderTileCounts(xTiles, yTiles);
}
// Process!
if (!shaderProcess(glInputs, glOutput)) {
throw new RuntimeException("Error executing ShaderProgram!");
}
if (mTimer.LOG_MFF_RUNNING_TIMES) {
GLES20.glFinish();
}
|
public void | setAttributeValues(java.lang.String attributeName, float[] data, int componentCount)
if (!setShaderAttributeValues(attributeName, data, componentCount)) {
throw new RuntimeException("Error setting attribute value for attribute '" +
attributeName + "'!");
}
|
public void | setAttributeValues(java.lang.String attributeName, android.filterfw.core.VertexFrame vertexData, int type, int componentCount, int strideInBytes, int offsetInBytes, boolean normalize)
if (!setShaderAttributeVertexFrame(attributeName,
vertexData,
type,
componentCount,
strideInBytes,
offsetInBytes,
normalize)) {
throw new RuntimeException("Error setting attribute value for attribute '" +
attributeName + "'!");
}
|
public void | setBlendEnabled(boolean enable)
if (!setShaderBlendEnabled(enable)) {
throw new RuntimeException("Could not set Blending " + enable + "!");
}
|
public void | setBlendFunc(int sfactor, int dfactor)
if (!setShaderBlendFunc(sfactor, dfactor)) {
throw new RuntimeException("Could not set BlendFunc " + sfactor +","+ dfactor + "!");
}
|
public void | setClearColor(float r, float g, float b)
if (!setShaderClearColor(r, g, b)) {
throw new RuntimeException("Could not set clear color to " + r + "," + g + "," + b + "!");
}
|
public void | setClearsOutput(boolean clears)
if (!setShaderClearsOutput(clears)) {
throw new RuntimeException("Could not set clears-output flag to " + clears + "!");
}
|
public void | setDrawMode(int drawMode)
if (!setShaderDrawMode(drawMode)) {
throw new RuntimeException("Could not set GL draw-mode to " + drawMode + "!");
}
|
public void | setHostValue(java.lang.String variableName, java.lang.Object value)
if (!setUniformValue(variableName, value)) {
throw new RuntimeException("Error setting uniform value for variable '" +
variableName + "'!");
}
|
public void | setMaximumTileSize(int size)
mMaxTileSize = size;
|
private native boolean | setShaderAttributeValues(java.lang.String attributeName, float[] data, int componentCount)
|
private native boolean | setShaderAttributeVertexFrame(java.lang.String attributeName, android.filterfw.core.VertexFrame vertexData, int type, int componentCount, int strideInBytes, int offsetInBytes, boolean normalize)
|
private native boolean | setShaderBlendEnabled(boolean enable)
|
private native boolean | setShaderBlendFunc(int sfactor, int dfactor)
|
private native boolean | setShaderClearColor(float r, float g, float b)
|
private native boolean | setShaderClearsOutput(boolean clears)
|
private native boolean | setShaderDrawMode(int drawMode)
|
private native boolean | setShaderTileCounts(int xCount, int yCount)
|
private native boolean | setShaderVertexCount(int vertexCount)
|
public void | setSourceRect(float x, float y, float width, float height)
setSourceRegion(x, y, x + width, y, x, y + height, x + width, y + height);
|
public void | setSourceRegion(android.filterfw.geometry.Quad region)
setSourceRegion(region.p0.x, region.p0.y,
region.p1.x, region.p1.y,
region.p2.x, region.p2.y,
region.p3.x, region.p3.y);
|
public native boolean | setSourceRegion(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
|
public void | setTargetRect(float x, float y, float width, float height)
setTargetRegion(x, y, x + width, y, x, y + height, x + width, y + height);
|
public void | setTargetRegion(android.filterfw.geometry.Quad region)
setTargetRegion(region.p0.x, region.p0.y,
region.p1.x, region.p1.y,
region.p2.x, region.p2.y,
region.p3.x, region.p3.y);
|
private native boolean | setTargetRegion(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3)
|
private void | setTimer()
mTimer = new StopWatchMap();
|
private native boolean | setUniformValue(java.lang.String name, java.lang.Object value)
|
public void | setVertexCount(int count)
if (!setShaderVertexCount(count)) {
throw new RuntimeException("Could not set GL vertex count to " + count + "!");
}
|
private native boolean | shaderProcess(GLFrame[] inputs, GLFrame output)
|