Methods Summary |
---|
final void | assertValidGLState()
GLEnvironment glEnv = mFilterContext.getGLEnvironment();
if (glEnv == null || !glEnv.isContextActive()) {
if (GLEnvironment.isAnyContextActive()) {
throw new RuntimeException("Applying effect in wrong GL context!");
} else {
throw new RuntimeException("Attempting to apply effect without valid GL context!");
}
}
|
public static android.media.effect.EffectContext | createWithCurrentGlContext()Creates a context within the current GL context.
Binds the EffectContext to the current OpenGL context. All subsequent calls to the
EffectContext must be made in the GL context that was active during creation.
When you have finished using a context, you must call {@link #release()}. to dispose of all
resources associated with this context.
EffectContext result = new EffectContext();
result.initInCurrentGlContext();
return result;
|
public EffectFactory | getFactory()Returns the EffectFactory for this context.
The EffectFactory returned from this method allows instantiating new effects within this
context.
return mFactory;
|
private void | initInCurrentGlContext()
if (!GLEnvironment.isAnyContextActive()) {
throw new RuntimeException("Attempting to initialize EffectContext with no active "
+ "GL context!");
}
GLEnvironment glEnvironment = new GLEnvironment();
glEnvironment.initWithCurrentContext();
mFilterContext.initGLEnvironment(glEnvironment);
|
public void | release()Releases the context.
Releases all the resources and effects associated with the EffectContext. This renders the
context and all the effects bound to this context invalid. You must no longer use the context
or any of its bound effects after calling release().
Note that this method must be called with the proper EGL context made current, as the
EffectContext and its effects may release internal GL resources.
mFilterContext.tearDown();
mFilterContext = null;
|
final void | restoreGLState()
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, mOldState[GL_STATE_FBO]);
GLES20.glUseProgram(mOldState[GL_STATE_PROGRAM]);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, mOldState[GL_STATE_ARRAYBUFFER]);
|
final void | saveGLState()
GLES20.glGetIntegerv(GLES20.GL_FRAMEBUFFER_BINDING, mOldState, GL_STATE_FBO);
GLES20.glGetIntegerv(GLES20.GL_CURRENT_PROGRAM, mOldState, GL_STATE_PROGRAM);
GLES20.glGetIntegerv(GLES20.GL_ARRAY_BUFFER_BINDING, mOldState, GL_STATE_ARRAYBUFFER);
|