0
 
                /* 
                 * Once we're done with GL, we need to call swapBuffers() 
                 * to instruct the system to display the rendered frame 
                 */ 
                egl.eglSwapBuffers(dpy, surface);
 
                /* 
                 * Always check for EGL_CONTEXT_LOST, which means the context 
                 * and all associated data were lost (For instance because 
                 * the device went to sleep). We need to quit immediately. 
                 */ 
                if (egl.eglGetError() == EGL11.EGL_CONTEXT_LOST) {
                    // we lost the gpu, quit immediately 
                    Context c = getContext();
                    if (c instanceof Activity) {
                        ((Activity)c).finish();
                    } 
                } 
 
                 
                //Log.i(TAG, "doAnimation()" + mRoll + " , " + mYaw + " , " + mPitch); 
            	// If any of the sensors is not == 0 then we continue to update. 
                //return mRoll != -180.f || mYaw != 0 || mPitch != 0; 
                 
                // No need to check back if successfully drawn once. 
                // (OnSensorChange updates the view anyway). 
                return false; 
        } 
 
		/** 
		 * @param w 
		 * @param h 
		 */ 
		private void recreateSurface(int w, int h) {
			/* 
			 *  The window size has changed, so we need to create a new 
			 *  surface. 
			 */ 
			if (surface != null) {
			     
			    /* 
			     * Unbind and destroy the old EGL surface, if 
			     * there is one. 
			     */ 
			    egl.eglMakeCurrent(dpy, EGL10.EGL_NO_SURFACE,
			            EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
			    egl.eglDestroySurface(dpy, surface);
			} 
			 
			/*  
			 * Create an EGL surface we can render into. 
			 */ 
			surface = egl.eglCreateWindowSurface(dpy, config, mHolder,
			        null); 
       
			/* 
			 * Before we can issue GL commands, we need to make sure  
			 * the context is current and bound to a surface. 
			 */ 
			egl.eglMakeCurrent(dpy, surface, surface, context);
			 
			/* 
			 * Get to the appropriate GL interface. 
			 * This is simply done by casting the GL context to either 
			 * GL10 or GL11. 
Contextual code suggestions in your IDE  Get Codota for Java