当前位置: 首页>>代码示例>>Java>>正文


Java EGL10.EGL_NO_SURFACE属性代码示例

本文整理汇总了Java中javax.microedition.khronos.egl.EGL10.EGL_NO_SURFACE属性的典型用法代码示例。如果您正苦于以下问题:Java EGL10.EGL_NO_SURFACE属性的具体用法?Java EGL10.EGL_NO_SURFACE怎么用?Java EGL10.EGL_NO_SURFACE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.microedition.khronos.egl.EGL10的用法示例。


在下文中一共展示了EGL10.EGL_NO_SURFACE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createWindowSurface

public EGLSurface createWindowSurface(
        EGL10 egl,
        EGLDisplay display,
        EGLConfig config,
        Object nativeWindow)
{
    mEglSurface = null;
    try {
        mEglSurface = egl.eglCreateWindowSurface(display, config, nativeWindow, null);
        if (EGL10.EGL_NO_SURFACE == mEglSurface) {
            throwEglException(egl, "eglCreateWindowSurface");
        }
    } catch (IllegalArgumentException e) {
        Log.e(ConstantsUI.TAG, "eglCreateWindowSurface", e);
        throw new RuntimeException("eglCreateWindowSurface", e);
    }
    return mEglSurface;
}
 
开发者ID:nextgis,项目名称:android_nextgis_mobile,代码行数:18,代码来源:MapGlView.java

示例2: release

public void release() {
    mEGL.eglDestroySurface(mEGLDisplay, mEGLSurface);
    if (mEGLDisplay != EGL10.EGL_NO_DISPLAY) {
        mEGL.eglMakeCurrent(mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_CONTEXT);
        mEGL.eglDestroyContext(mEGLDisplay, mEGLContext);
        //EGL14.eglReleaseThread();
        mEGL.eglTerminate(mEGLDisplay);
    }

    mEGLDisplay = EGL10.EGL_NO_DISPLAY;
    mEGLConfig = null;
    mEGLContext = EGL10.EGL_NO_CONTEXT;
    mEGLSurface = EGL10.EGL_NO_SURFACE;

    mWidth = mHeight = -1;
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:17,代码来源:ImageEglSurface.java

示例3: destroySurfaceImp

private void destroySurfaceImp() {
    if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
        mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_CONTEXT);
        GLTextureView view = mGLSurfaceViewWeakRef.get();
        if (view != null) {
            view.mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
        }
        mEglSurface = null;
    }
}
 
开发者ID:pavelsemak,项目名称:alpha-movie,代码行数:12,代码来源:GLTextureView.java

示例4: createSurface

public GL createSurface(Surface surface) {
  if (mEgl == null)
    throw new RuntimeException("egl not initialized");
  if (mEglDisplay == null)
    throw new RuntimeException("eglDisplay not initialized");
  if (mEglConfig == null)
    throw new RuntimeException("mEglConfig not initialized");

  if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
    mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
    mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
  }

  mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl, mEglDisplay, mEglConfig, surface);

  if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) {
    int error = mEgl.eglGetError();
    if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
      Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW.");
      return null;
    }
    throwEglException("createWindowSurface", error);
  }

  if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
    throwEglException("eglMakeCurrent");
  }

  GL gl = mEglContext.getGL();

  return gl;
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:32,代码来源:EGL.java

示例5: makeCurrent

@Override
public void makeCurrent() {
  checkIsNotReleased();
  if (eglSurface == EGL10.EGL_NO_SURFACE) {
    throw new RuntimeException("No EGLSurface - can't make current");
  }
  synchronized (EglBase.lock) {
    if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
      throw new RuntimeException(
          "eglMakeCurrent failed: 0x" + Integer.toHexString(egl.eglGetError()));
    }
  }
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:13,代码来源:EglBase10.java

示例6: releaseSurface

@Override
public void releaseSurface() {
  if (eglSurface != EGL10.EGL_NO_SURFACE) {
    egl.eglDestroySurface(eglDisplay, eglSurface);
    eglSurface = EGL10.EGL_NO_SURFACE;
  }
}
 
开发者ID:Piasy,项目名称:VideoCRE,代码行数:7,代码来源:EglBase10.java

示例7: shutdownEGL

@WorkerThread
private void shutdownEGL() {
    LogUtil.d(TAG, "shutdownEGL");
    egl10.eglMakeCurrent(eglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
    egl10.eglDestroyContext(eglDisplay, eglContext);
    egl10.eglDestroySurface(eglDisplay, eglSurface);
    egl10.eglTerminate(eglDisplay);
    eglContext = EGL10.EGL_NO_CONTEXT;
    eglSurface = EGL10.EGL_NO_SURFACE;
    eglDisplay = EGL10.EGL_NO_DISPLAY;
}
 
开发者ID:TedaLIEz,项目名称:ParsingPlayer,代码行数:11,代码来源:VideoRenderThread.java

示例8: destroySurface

public void destroySurface() {
	if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
		mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
				EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
		mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay,
				mEglSurface);
		mEglSurface = null;
	}
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:9,代码来源:GLWallpaperService.java

示例9: destroySurfaceImp

private void destroySurfaceImp() {
    if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
        mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_CONTEXT);
        GLSurfaceView view = mGLSurfaceViewWeakRef.get();
        if (view != null) {
            view.mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
        }
        mEglSurface = null;
    }
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:12,代码来源:GLSurfaceView.java

示例10: destroySurfaceImp

private void destroySurfaceImp() {
    if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {
        mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_SURFACE,
                EGL10.EGL_NO_CONTEXT);
        GLTextureView view = mGLTextureViewWeakRef.get();
        if (view != null) {
            view.mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay, mEglSurface);
        }
        mEglSurface = null;
    }
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:12,代码来源:GLTextureView.java

示例11: createSurface

/**
 * Create an egl surface for the current SurfaceHolder surface. If a surface
 * already exists, destroy it before creating the new surface.
 *
 * @return true if the surface was created successfully.
 */
public boolean createSurface() {
    if (LOG_EGL) {
        Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
    }
    /*
     * Check preconditions.
     */
    if (mEgl == null) {
        throw new RuntimeException("egl not initialized");
    }
    if (mEglDisplay == null) {
        throw new RuntimeException("eglDisplay not initialized");
    }
    if (mEglConfig == null) {
        throw new RuntimeException("mEglConfig not initialized");
    }

    /*
     *  The window size has changed, so we need to create a new
     *  surface.
     */
    destroySurfaceImp();

    /*
     * Create an EGL surface we can render into.
     */
    GLTextureView view = mGLSurfaceViewWeakRef.get();
    if (view != null) {
        mEglSurface = view.mEGLWindowSurfaceFactory.createWindowSurface(mEgl,
                mEglDisplay, mEglConfig, view.getSurfaceTexture());
    } else {
        mEglSurface = null;
    }

    if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) {
        int error = mEgl.eglGetError();
        if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
            Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW.");
        }
        return false;
    }

    /*
     * Before we can issue GL commands, we need to make sure
     * the context is current and bound to a surface.
     */
    if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
        /*
         * Could not make the context current, probably because the underlying
         * SurfaceView surface has been destroyed.
         */
        logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", mEgl.eglGetError());
        return false;
    }

    return true;
}
 
开发者ID:pavelsemak,项目名称:alpha-movie,代码行数:63,代码来源:GLTextureView.java

示例12: initGL

private void initGL(SurfaceTexture texture) {
    egl10 = (EGL10) EGLContext.getEGL();

    eglDisplay = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
        throw new RuntimeException("eglGetDisplay failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    }

    int[] version = new int[2];
    if (!egl10.eglInitialize(eglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    }

    int[] configsCount = new int[1];
    EGLConfig[] configs = new EGLConfig[1];
    int[] configSpec = {
            EGL10.EGL_RENDERABLE_TYPE,
            EGL_OPENGL_ES2_BIT,
            EGL10.EGL_RED_SIZE, 8,
            EGL10.EGL_GREEN_SIZE, 8,
            EGL10.EGL_BLUE_SIZE, 8,
            EGL10.EGL_ALPHA_SIZE, 8,
            EGL10.EGL_DEPTH_SIZE, 0,
            EGL10.EGL_STENCIL_SIZE, 0,
            EGL10.EGL_NONE
    };

    EGLConfig eglConfig = null;
    if (!egl10.eglChooseConfig(eglDisplay, configSpec, configs, 1, configsCount)) {
        throw new IllegalArgumentException("eglChooseConfig failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    } else if (configsCount[0] > 0) {
        eglConfig = configs[0];
    }
    if (eglConfig == null) {
        throw new RuntimeException("eglConfig not initialized");
    }

    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
    eglContext = egl10.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
    eglSurface = egl10.eglCreateWindowSurface(eglDisplay, eglConfig, texture, null);

    if (eglSurface == null || eglSurface == EGL10.EGL_NO_SURFACE) {
        int error = egl10.eglGetError();
        if (error == EGL10.EGL_BAD_NATIVE_WINDOW) {
            Log.e(TAG, "eglCreateWindowSurface returned EGL10.EGL_BAD_NATIVE_WINDOW");
            return;
        }
        throw new RuntimeException("eglCreateWindowSurface failed " +
                android.opengl.GLUtils.getEGLErrorString(error));
    }

    if (!egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
        throw new RuntimeException("eglMakeCurrent failed " +
                android.opengl.GLUtils.getEGLErrorString(egl10.eglGetError()));
    }
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:59,代码来源:MyCameraRenderer.java

示例13: hasSurface

@Override
public boolean hasSurface() {
  return eglSurface != EGL10.EGL_NO_SURFACE;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:4,代码来源:EglBase10.java

示例14: initGL

private boolean initGL() {
    egl10 = (EGL10) EGLContext.getEGL();

    eglDisplay = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
        FileLog.e("tmessages", "eglGetDisplay failed " + GLUtils.getEGLErrorString(egl10.eglGetError()));
        finish();
        return false;
    }

    int[] version = new int[2];
    if (!egl10.eglInitialize(eglDisplay, version)) {
        FileLog.e("tmessages", "eglInitialize failed " + GLUtils.getEGLErrorString(egl10.eglGetError()));
        finish();
        return false;
    }

    int[] configsCount = new int[1];
    EGLConfig[] configs = new EGLConfig[1];
    int[] configSpec = new int[]{
            EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
            EGL10.EGL_RED_SIZE, 8,
            EGL10.EGL_GREEN_SIZE, 8,
            EGL10.EGL_BLUE_SIZE, 8,
            EGL10.EGL_ALPHA_SIZE, 8,
            EGL10.EGL_DEPTH_SIZE, 0,
            EGL10.EGL_STENCIL_SIZE, 0,
            EGL10.EGL_NONE
    };
    if (!egl10.eglChooseConfig(eglDisplay, configSpec, configs, 1, configsCount)) {
        FileLog.e("tmessages", "eglChooseConfig failed " + GLUtils.getEGLErrorString(egl10.eglGetError()));
        finish();
        return false;
    } else if (configsCount[0] > 0) {
        eglConfig = configs[0];
    } else {
        FileLog.e("tmessages", "eglConfig not initialized");
        finish();
        return false;
    }

    int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE};
    eglContext = egl10.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
    if (eglContext == null) {
        FileLog.e("tmessages", "eglCreateContext failed " + GLUtils.getEGLErrorString(egl10.eglGetError()));
        finish();
        return false;
    }

    if (surfaceTexture instanceof SurfaceTexture) {
        eglSurface = egl10.eglCreateWindowSurface(eglDisplay, eglConfig, surfaceTexture, null);
    } else {
        finish();
        return false;
    }

    if (eglSurface == null || eglSurface == EGL10.EGL_NO_SURFACE) {
        FileLog.e("tmessages", "createWindowSurface failed " + GLUtils.getEGLErrorString(egl10.eglGetError()));
        finish();
        return false;
    }
    if (!egl10.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
        FileLog.e("tmessages", "eglMakeCurrent failed " + GLUtils.getEGLErrorString(egl10.eglGetError()));
        finish();
        return false;
    }

    GLES20.glEnable(GLES20.GL_BLEND);
    GLES20.glDisable(GLES20.GL_DITHER);
    GLES20.glDisable(GLES20.GL_STENCIL_TEST);
    GLES20.glDisable(GLES20.GL_DEPTH_TEST);

    painting.setupShaders();
    checkBitmap();
    painting.setBitmap(bitmap);

    Utils.HasGLError();

    return true;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:80,代码来源:RenderView.java

示例15: createSurface

public GL createSurface(SurfaceHolder holder) {
	/*
	 * The window size has changed, so we need to create a new surface.
	 */
	if (mEglSurface != null && mEglSurface != EGL10.EGL_NO_SURFACE) {

		/*
		 * Unbind and destroy the old EGL surface, if there is one.
		 */
		mEgl.eglMakeCurrent(mEglDisplay, EGL10.EGL_NO_SURFACE,
				EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
		mEGLWindowSurfaceFactory.destroySurface(mEgl, mEglDisplay,
				mEglSurface);
	}

	/*
	 * Create an EGL surface we can render into.
	 */
	mEglSurface = mEGLWindowSurfaceFactory.createWindowSurface(mEgl,
			mEglDisplay, mEglConfig, holder);

	if (mEglSurface == null || mEglSurface == EGL10.EGL_NO_SURFACE) {
		throw new RuntimeException("createWindowSurface failed");
	}

	/*
	 * Before we can issue GL commands, we need to make sure the context is
	 * current and bound to a surface.
	 */
	if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface,
			mEglContext)) {
		throw new RuntimeException("eglMakeCurrent failed.");
	}

	GL gl = mEglContext.getGL();
	if (mGLWrapper != null) {
		gl = mGLWrapper.wrap(gl);
	}

	/*
	 * if ((mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS))!= 0)
	 * { int configFlags = 0; Writer log = null; if ((mDebugFlags &
	 * DEBUG_CHECK_GL_ERROR) != 0) { configFlags |=
	 * GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((mDebugFlags &
	 * DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl =
	 * GLDebugHelper.wrap(gl, configFlags, log); }
	 */
	return gl;
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:49,代码来源:GLWallpaperService.java


注:本文中的javax.microedition.khronos.egl.EGL10.EGL_NO_SURFACE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。