本文整理汇总了Java中android.opengl.EGL14.eglGetCurrentContext方法的典型用法代码示例。如果您正苦于以下问题:Java EGL14.eglGetCurrentContext方法的具体用法?Java EGL14.eglGetCurrentContext怎么用?Java EGL14.eglGetCurrentContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.EGL14
的用法示例。
在下文中一共展示了EGL14.eglGetCurrentContext方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: surfaceCreated
import android.opengl.EGL14; //导入方法依赖的package包/类
private void surfaceCreated(boolean reInitCtx) {
mState.set(STATE_READY);
mThreadId = Thread.currentThread().getId();
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
if (reInitCtx && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
mEGLContext = EGL14.eglGetCurrentContext();
}
synchronized (mRenderListenerLock) {
Iterator<GLRender.GLRenderListener> it = mGLRenderListenerList.iterator();
while (it.hasNext()) {
GLRender.GLRenderListener listener = it.next();
listener.onReady();
}
}
}
示例2: setInputTextureId
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* 设置输入纹理
* <p>
* 必须在GL线程调用
*
* @param surface
* @param texId
*/
public final void setInputTextureId(final Object surface, final int texId) {
if (!(surface instanceof Surface)
&& !(surface instanceof SurfaceTexture)
&& !(surface instanceof SurfaceHolder)) {
throw new RuntimeException("unsupported window type:" + surface);
}
synchronized (mSync) {
if (mRequestRelease) return;
mSharedContext = EGL14.eglGetCurrentContext();
mTextureId = texId;
mSurface = surface;
mRequestSetEglContext = true;
mSync.notifyAll();
try {
mSync.wait();
} catch (final InterruptedException e) {
}
}
}
示例3: OffscreenImage
import android.opengl.EGL14; //导入方法依赖的package包/类
public OffscreenImage(Bitmap bitmap) {
mWidth = bitmap.getWidth();
mHeight = bitmap.getHeight();
// 初始化EGL环境
mEgl = new EGLEnvironment(EGL14.eglGetCurrentContext(), false);
// 创建离屏缓冲
mInputSurface = mEgl.createOffscreen(mWidth, mHeight);
// 设置渲染环境可用
mInputSurface.makeCurrent();
BitmapInput bitmapInput = new BitmapInput(bitmap);
mPipeline = new RenderPipeline();
mPipeline.onSurfaceCreated(null, null);
mPipeline.setStartPointRender(bitmapInput);
}
示例4: onDraw
import android.opengl.EGL14; //导入方法依赖的package包/类
@Override
public void onDraw(int textureId, FloatBuffer cubeBuffer, FloatBuffer textureBuffer) {
// Draw on screen surface
super.onDraw(textureId, cubeBuffer, textureBuffer);
if (mIsRecording) {
// create encoder surface
if (mCodecInput == null) {
mEGLCore = new EglCore(EGL14.eglGetCurrentContext(), EglCore.FLAG_RECORDABLE);
mCodecInput = new WindowSurface(mEGLCore, mVideoEncoder.getSurface(), false);
}
// Draw on encoder surface
mCodecInput.makeCurrent();
super.onDraw(textureId, cubeBuffer, textureBuffer);
if (mIsRecording) {//super.onDraw maybe executed stopRecording
mCodecInput.swapBuffers();
mVideoEncoder.frameAvailableSoon();
}
}
// Make screen surface be current surface
mEGL.eglMakeCurrent(mEGLDisplay, mEGLScreenSurface, mEGLScreenSurface, mEGLContext);
}
示例5: logCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* Writes the current display, context, and surface to the log.
*/
public static void logCurrent(String msg) {
EGLDisplay display;
EGLContext context;
EGLSurface surface;
display = EGL14.eglGetCurrentDisplay();
context = EGL14.eglGetCurrentContext();
surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
", surface=" + surface);
}
示例6: InputSurface
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* @param surface 来自MediaCodec.createInputSurface()
*/
public InputSurface(Surface surface) {
if (surface == null) {
throw new NullPointerException();
}
mSurface = surface;
// 初始化EGL环境
mEgl = new EGLEnvironment(EGL14.eglGetCurrentContext(), false);
// 创建离屏缓冲
mInputSurface = mEgl.createFromSurface(surface);
// 设置渲染环境可用
mInputSurface.makeCurrent();
}
示例7: draw
import android.opengl.EGL14; //导入方法依赖的package包/类
void draw() {
EGLDisplay mSavedEglDisplay = EGL14.eglGetCurrentDisplay();
EGLSurface mSavedEglDrawSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
EGLSurface mSavedEglReadSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_READ);
EGLContext mSavedEglContext = EGL14.eglGetCurrentContext();
{
AndroidUntil.checkGlError("draw_S");
if (mRecorderImpl.isFirstSetup()) {
mRecorderImpl.startSwapAsync();
mRecorderImpl.makeCurrent();
AndroidUntil.checkGlError("initGL_S");
mProgram = AndroidUntil.createProgram();
maPositionHandle = GLES20.glGetAttribLocation(mProgram, "position");
maTextCodeHandle = GLES20.glGetAttribLocation(mProgram, "inputTextureCoordinate");
muSamplerHandle = GLES20.glGetUniformLocation(mProgram, "uSampler");
muPosMtxHandle = GLES20.glGetUniformLocation(mProgram, "uPosMtx");
Matrix.scaleM(mSymmetryMtx, 0, -1, 1, 1);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
GLES20.glDisable(GLES20.GL_CULL_FACE);
GLES20.glDisable(GLES20.GL_BLEND);
AndroidUntil.checkGlError("initGL_E");
} else {
mRecorderImpl.makeCurrent();
}
GLES20.glViewport(0, 0, mVideoWidth, mVideoHeight);
GLES20.glClearColor(0f, 0f, 0f, 1f);
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glUseProgram(mProgram);
mNormalVtxBuf.position(0);
GLES20.glVertexAttribPointer(maPositionHandle,
3, GLES20.GL_FLOAT, false, 4 * 3, mNormalVtxBuf);
GLES20.glEnableVertexAttribArray(maPositionHandle);
mCameraVertexCoordinatesBuffer.position(0);
GLES20.glVertexAttribPointer(maTextCodeHandle,
2, GLES20.GL_FLOAT, false, 4 * 2, mCameraVertexCoordinatesBuffer);
GLES20.glEnableVertexAttribArray(maTextCodeHandle);
GLES20.glUniform1i(muSamplerHandle, 0);
GLES20.glUniformMatrix4fv(muPosMtxHandle, 1, false, mNormalMtx, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mFboTexId);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
mRecorderImpl.swapBuffers();
AndroidUntil.checkGlError("draw_E");
}
if (!EGL14.eglMakeCurrent(
mSavedEglDisplay,
mSavedEglDrawSurface,
mSavedEglReadSurface,
mSavedEglContext)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
示例8: getSharedContext
import android.opengl.EGL14; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
private EGLContext getSharedContext() {
return EGL14.eglGetCurrentContext();
}
示例9: logCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
public static void logCurrent(String msg) {
EGLDisplay display = EGL14.eglGetCurrentDisplay();
EGLContext context = EGL14.eglGetCurrentContext();
EGLSurface surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
Log.i("EglCore", "Current EGL (" + msg + "): display=" + display + ", context=" + context + ", surface=" + surface);
}