1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.performanceLaunch; 18 19 import com.android.performanceLaunch.helper.SimpleGLSurfaceView; 20 21 import android.app.Activity; 22 import android.opengl.GLSurfaceView; 23 import android.os.Bundle; 24 25 /** 26 * To draw the GLSurface view Source : development/samples/OpenGL/HelloOpenGLES20 27 */ 28 public class SimpleSurfaceGLActivity extends Activity { 29 30 private GLSurfaceView mGLView; 31 32 @Override 33 public void onCreate(Bundle savedInstanceState) { 34 super.onCreate(savedInstanceState); 35 36 // Create a GLSurfaceView instance and set it 37 // as the ContentView for this Activity 38 mGLView = new SimpleGLSurfaceView(this); 39 setContentView(mGLView); 40 } 41 42 @Override 43 protected void onPause() { 44 super.onPause(); 45 // The following call pauses the rendering thread. 46 // If your OpenGL application is memory intensive, 47 // you should consider de-allocating objects that 48 // consume significant memory here. 49 mGLView.onPause(); 50 } 51 52 @Override 53 protected void onResume() { 54 super.onResume(); 55 // The following call resumes a paused rendering thread. 56 // If you de-allocated graphic objects for onPause() 57 // this is a good place to re-allocate them. 58 mGLView.onResume(); 59 } 60 } 61