Code example for GLSurfaceView.EGLConfigChooser

Methods: chooseConfig

0
			if (mEglConfig == null) {
				// Log.d("EglHelper" + instanceId, "getting new config"); 
				// We can now initialize EGL for that display 
				int[] version = new int[2];
				mEgl.eglInitialize(mEglDisplay, version);
				mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);
			} else { 
				// Log.d("EglHelper" + instanceId, "reusing config"); 
			} 
 
			if (mEglContext == null) {
				// Log.d("EglHelper" + instanceId, "creating new context"); 
				// Create an OpenGL ES context. This must be done only once, an OpenGL context is a somewhat heavy object. 
				mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
				if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
					throw new RuntimeException("createContext failed");
				} 
			} else { 
				// Log.d("EglHelper" + instanceId, "reusing context"); 
			}