Back to project page FxCameraApp.
The source code is released under:
MIT License
If you think the Android project FxCameraApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.af.experiments.FxCameraApp.ogles; /*from w w w. j a v a2 s . c om*/ import android.opengl.GLSurfaceView; import android.util.Log; import javax.microedition.khronos.egl.EGL10; import javax.microedition.khronos.egl.EGLConfig; import javax.microedition.khronos.egl.EGLContext; import javax.microedition.khronos.egl.EGLDisplay; import static javax.microedition.khronos.egl.EGL10.EGL_NONE; import static javax.microedition.khronos.egl.EGL10.EGL_NO_CONTEXT; public class DefaultContextFactory implements GLSurfaceView.EGLContextFactory { private static final String TAG = "DefaultContextFactory"; private int mEGLContextClientVersion; public DefaultContextFactory() {} public DefaultContextFactory(final int version) { mEGLContextClientVersion = version; } private static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; @Override public EGLContext createContext(final EGL10 egl, final EGLDisplay display, final EGLConfig config) { final int[] attrib_list; if (mEGLContextClientVersion != 0) { attrib_list = new int[]{ EGL_CONTEXT_CLIENT_VERSION, mEGLContextClientVersion, EGL_NONE }; } else { attrib_list = null; } return egl.eglCreateContext(display, config, EGL_NO_CONTEXT, attrib_list); } @Override public void destroyContext(final EGL10 egl, final EGLDisplay display, final EGLContext context) { if (!egl.eglDestroyContext(display, context)) { Log.e(TAG, "display:" + display + " context: " + context); throw new RuntimeException("eglDestroyContex" + egl.eglGetError()); } } }