本文整理汇总了Java中android.media.effect.EffectContext.createWithCurrentGlContext方法的典型用法代码示例。如果您正苦于以下问题:Java EffectContext.createWithCurrentGlContext方法的具体用法?Java EffectContext.createWithCurrentGlContext怎么用?Java EffectContext.createWithCurrentGlContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.effect.EffectContext
的用法示例。
在下文中一共展示了EffectContext.createWithCurrentGlContext方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onDrawFrame
import android.media.effect.EffectContext; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
if (!mInitialized) {
//Only need to do this once
mEffectContext = EffectContext.createWithCurrentGlContext();
mTexRenderer.init();
loadTextures();
mInitialized = true;
}
if (mCurrentEffect != R.id.none) {
//if an effect is chosen initialize it and apply it to the texture
initEffect();
applyEffect();
}
renderResult();
}
示例2: onDrawFrame
import android.media.effect.EffectContext; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
if (!mInitialized) {
//Only need to do this once
mEffectContext = EffectContext.createWithCurrentGlContext();
init();
loadTextures();
mInitialized = true;
}
if (mEffectChanged) {
initEffect();
applyEffect();
mEffectChanged = false;
}
renderResult();
}
示例3: onDrawFrame
import android.media.effect.EffectContext; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl) {
if (!mInitialized) {
// Only need to do this once
mEffectContext = EffectContext.createWithCurrentGlContext();
mTexRenderer.init();
loadTextures();
mInitialized = true;
}
if (mCurrentEffect != R.id.none) {
// if an effect is chosen initialize it and apply it to the texture
initEffect();
applyEffect();
}
renderResult();
if (saveFrame) {
saveBitmap(takeScreenshot(gl));
}
}
示例4: getEffect
import android.media.effect.EffectContext; //导入方法依赖的package包/类
protected Effect getEffect(String name) {
Effect effect = null;
if (context == null) {
context = EffectContext.createWithCurrentGlContext();
}
effect = context.getFactory().createEffect(name);
effect.setParameter("tile_size", DEFAULT_TILE_SIZE);
effects.put(this, effect);
return effect;
}
示例5: onDrawFrame
import android.media.effect.EffectContext; //导入方法依赖的package包/类
@Override
public void onDrawFrame(GL10 gl10) {
if(effectContext==null) {
effectContext = EffectContext.createWithCurrentGlContext();
}
if(effect!=null){
effect.release();
}
if(null == effectType){
effectType = EffectFactory.EFFECT_DOCUMENTARY;
}
grayScaleEffect(effectType);
square.draw(textures[1]);
}
示例6: onSurfaceCreated
import android.media.effect.EffectContext; //导入方法依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
TypedValue a = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.colorBackground, a, true);
if (a.type >= TypedValue.TYPE_FIRST_COLOR_INT
&& a.type <= TypedValue.TYPE_LAST_COLOR_INT) {
mBackgroundColor = new GLColor(a.data);
} else {
mBackgroundColor = new GLColor(Color.WHITE);
}
// We have a 2d (fake) scenario, disable all unnecessary tests. Deep are
// necessary for some 3d effects
GLES20.glDisable(GL10.GL_DITHER);
GLESUtil.glesCheckError("glDisable");
GLES20.glDisable(GL10.GL_CULL_FACE);
GLESUtil.glesCheckError("glDisable");
GLES20.glEnable(GL10.GL_DEPTH_TEST);
GLESUtil.glesCheckError("glEnable");
GLES20.glDepthMask(false);
GLESUtil.glesCheckError("glDepthMask");
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GLESUtil.glesCheckError("glDepthFunc");
// Recreate the effect contexts
recycle();
synchronized (mLock) {
mEffectContext = EffectContext.createWithCurrentGlContext();
mEffectsFactory = new Effects(mContext, mEffectContext);
mBordersFactory = new Borders(mContext, mEffectContext);
recreateContext();
boolean singleTexture = mTransitionType.equals(Transitions.TRANSITIONS.NO_TRANSITION);
mTextureManager = new SimpleTextureManager(mContext, mEffect, mBorder, singleTexture);
mTransition = Transitions.createTransition(mContext, mTextureManager, mTransitionType);
}
mRecycled = false;
}
示例7: onSurfaceCreated
import android.media.effect.EffectContext; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
if (DEBUG) Log.d(TAG, "onSurfaceCreated [" + mInstance + "]");
mWidth = -1;
mHeight = -1;
mMeasuredHeight = -1;
mStatusBarHeight = 0;
mLastTransition = System.currentTimeMillis();
// We have a 2d (fake) scenario, disable all unnecessary tests. Deep are
// necessary for some 3d effects
GLES20.glDisable(GL10.GL_DITHER);
GLESUtil.glesCheckError("glDisable");
GLES20.glDisable(GL10.GL_CULL_FACE);
GLESUtil.glesCheckError("glDisable");
GLES20.glEnable(GL10.GL_DEPTH_TEST);
GLESUtil.glesCheckError("glEnable");
GLES20.glDepthMask(false);
GLESUtil.glesCheckError("glDepthMask");
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GLESUtil.glesCheckError("glDepthFunc");
// Create an effect context
if (mEffectContext != null) {
mEffectContext.release();
}
mEffectContext = EffectContext.createWithCurrentGlContext();
// Create the texture manager and recycle the old one
if (mTextureManager == null) {
// Precalculate the window size for the PhotoPhaseTextureManager. In onSurfaceChanged
// the best fixed size will be set. The disposition size is simple for a better
// performance of the internal arrays
final Configuration conf = mContext.getResources().getConfiguration();
int orientation = mContext.getResources().getConfiguration().orientation;
int w = (int) AndroidHelper.convertDpToPixel(mContext, conf.screenWidthDp);
int h = (int) AndroidHelper.convertDpToPixel(mContext, conf.screenHeightDp);
Rect dimensions = new Rect(0, 0, w, h);
int cc = (orientation == Configuration.ORIENTATION_PORTRAIT)
? Preferences.Layout.getPortraitDisposition(mContext).size()
: Preferences.Layout.getLandscapeDisposition(mContext).size();
// Recycle the current texture manager and create a new one
recycle();
mTextureManager = new PhotoPhaseTextureManager(
mContext, mHandler, mEffectContext, mDispatcher, cc, dimensions);
} else {
mTextureManager.updateEffectContext(mEffectContext);
}
// Schedule dispositions random recreation (if need it)
scheduleDispositionRecreation();
}