Code example for GLSurfaceView

Methods: setEGLConfigChoosersetEGLContextClientVersion

0
        	createSurfaceView(); 
    } 
     
    protected void createSurfaceView() 
    { 
        mSurfaceView = new GLSurfaceView(this);
         
        ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
        if(checkOpenGLVersion) {
        	ConfigurationInfo info = am.getDeviceConfigurationInfo();
        	if(info.reqGlEsVersion < 0x20000)
        		throw new Error("OpenGL ES 2.0 is not supported by this device");
        } 
        mSurfaceView.setEGLContextClientVersion(2);
         
        mLayout = new FrameLayout(this);
        mLayout.addView(mSurfaceView);
         
        if(mMultisamplingEnabled)
        	createMultisampleConfig(); 
         
        setContentView(mLayout);
    } 
     
    protected void createMultisampleConfig() { 
    	final int EGL_COVERAGE_BUFFERS_NV = 0x30E0;
    	final int EGL_COVERAGE_SAMPLES_NV = 0x30E1;
    	 
        mSurfaceView.setEGLConfigChooser(new GLSurfaceView.EGLConfigChooser() {
			public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
				int[] configSpec = new int[] { 
						EGL10.EGL_RED_SIZE, 5,
						EGL10.EGL_GREEN_SIZE, 6,
						EGL10.EGL_BLUE_SIZE, 5,
Stop searching for code, let great code find you!  Add Codota to your java IDE