Code example for GLSurfaceView

Methods: setEGLConfigChoosersetEGLContextClientVersionsetRenderer

0
 
		final boolean supportsEs2 = 
			configurationInfo.reqGlEsVersion >= 0x20000 || isProbablyEmulator();
 
		if (supportsEs2) {
			glSurfaceView = new GLSurfaceView(this);
 
			if (isProbablyEmulator()) { 
				// Avoids crashes on startup with some emulator images. 
				glSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
			} 
 
			glSurfaceView.setEGLContextClientVersion(2);
			glSurfaceView.setRenderer(new RendererWrapper(this));
			rendererSet = true;
			setContentView(glSurfaceView);
		} else { 
			// Should never be seen in production, since the manifest filters 
			// unsupported devices. 
			Toast.makeText(this, "This device does not support OpenGL ES 2.0.",
Experience pair programming with AI  Get Codota for Java