本文整理汇总了Java中android.opengl.EGL14.eglMakeCurrent方法的典型用法代码示例。如果您正苦于以下问题:Java EGL14.eglMakeCurrent方法的具体用法?Java EGL14.eglMakeCurrent怎么用?Java EGL14.eglMakeCurrent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.opengl.EGL14
的用法示例。
在下文中一共展示了EGL14.eglMakeCurrent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: release
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* Discards all resources held by this class, notably the EGL context. This must be
* called from the thread where the context was created.
* <p>
* On completion, no context will be current.
*/
public void release() {
if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) {
// Android is unusual in that it uses a reference-counted EGLDisplay. So for
// every eglInitialize() we need an eglTerminate().
EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT);
EGL14.eglDestroyContext(mEGLDisplay, mEGLContext);
EGL14.eglReleaseThread();
EGL14.eglTerminate(mEGLDisplay);
}
mEGLDisplay = EGL14.EGL_NO_DISPLAY;
mEGLContext = EGL14.EGL_NO_CONTEXT;
mEGLConfig = null;
}
示例2: createGLESWithPBuffer
import android.opengl.EGL14; //导入方法依赖的package包/类
public EGLSurface createGLESWithPBuffer(EGLConfigAttrs attrs,EGLContextAttrs ctxAttrs,int width,int height){
EGLConfig config=getConfig(attrs.surfaceType(EGL14.EGL_PBUFFER_BIT));
if(config==null){
log("getConfig failed : "+EGL14.eglGetError());
return null;
}
EGLContext eglContext=createContext(config,EGL14.EGL_NO_CONTEXT,ctxAttrs);
if(eglContext==EGL14.EGL_NO_CONTEXT){
log("createContext failed : "+EGL14.eglGetError());
return null;
}
EGLSurface eglSurface=createPBufferSurface(config,width,height);
if(eglSurface==EGL14.EGL_NO_SURFACE){
log("createWindowSurface failed : "+EGL14.eglGetError());
return null;
}
if(!EGL14.eglMakeCurrent(mEGLDisplay,eglSurface,eglSurface,eglContext)){
log("eglMakeCurrent failed : "+EGL14.eglGetError());
return null;
}
return eglSurface;
}
示例3: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* change context to draw this window surface
* @return
*/
private boolean makeCurrent(final EGLSurface surface) {
// if (DEBUG) Log.v(TAG, "makeCurrent:");
if (mEglDisplay == null) {
if (DEBUG) Log.d(TAG, "makeCurrent:eglDisplay not initialized");
}
if (surface == null || surface == EGL14.EGL_NO_SURFACE) {
final int error = EGL14.eglGetError();
if (error == EGL14.EGL_BAD_NATIVE_WINDOW) {
Log.e(TAG, "makeCurrent:returned EGL_BAD_NATIVE_WINDOW.");
}
return false;
}
// attach EGL renderring context to specific EGL window surface
if (!EGL14.eglMakeCurrent(mEglDisplay, surface, surface, mEglContext)) {
Log.w(TAG, "eglMakeCurrent:" + EGL14.eglGetError());
return false;
}
return true;
}
示例4: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
@Override
public void makeCurrent() {
checkIsNotReleased();
if (eglSurface == EGL14.EGL_NO_SURFACE) {
throw new RuntimeException("No EGLSurface - can't make current");
}
synchronized (EglBase.lock) {
if (!EGL14.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
throw new RuntimeException(
"eglMakeCurrent failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
}
}
}
示例5: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent(draw,read) failed");
}
}
示例6: release
import android.opengl.EGL14; //导入方法依赖的package包/类
public void release() {
if (EGL14.eglGetCurrentContext().equals(mEGLContext)) {
EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
}
EGL14.eglDestroySurface(mEGLDisplay, mEGLSurface);
EGL14.eglDestroyContext(mEGLDisplay, mEGLContext);
mSurface.release();
mEGLDisplay = null;
mEGLContext = null;
mEGLSurface = null;
mSurface = null;
}
示例7: makeNothingCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* Makes no context current.
*/
public void makeNothingCurrent() {
if (!EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
示例8: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* Makes our EGL context current, using the supplied surface for both "draw" and "read".
*/
public void makeCurrent(EGLSurface eglSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
示例9: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* Makes our EGL context current, using the supplied "draw" and "read" surfaces.
*/
public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) {
if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
// called makeCurrent() before create?
Log.d(TAG, "NOTE: makeCurrent w/o display");
}
if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent(draw,read) failed");
}
}
示例10: detachCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
@Override
public void detachCurrent() {
synchronized (EglBase.lock) {
if (!EGL14.eglMakeCurrent(
eglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT)) {
throw new RuntimeException(
"eglDetachCurrent failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
}
}
}
示例11: destroyGL
import android.opengl.EGL14; //导入方法依赖的package包/类
private void destroyGL(EglHelper egl){
mGLThreadFlag=false;
EGL14.eglMakeCurrent(egl.getDisplay(), EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
EGL14.eglDestroyContext(egl.getDisplay(),egl.getDefaultContext());
EGL14.eglTerminate(egl.getDisplay());
}
示例12: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
/**
* Makes our EGL context and surface current.
*/
public void makeCurrent() {
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
示例13: 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");
}
}
示例14: makeUnCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
public void makeUnCurrent() {
if (!EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
EGL14.EGL_NO_CONTEXT)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}
示例15: makeCurrent
import android.opengl.EGL14; //导入方法依赖的package包/类
public void makeCurrent() {
if (!EGL14.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) {
throw new RuntimeException("eglMakeCurrent failed");
}
}