Home | History | Annotate | Download | only in opengl
      1 /*
      2  * Copyright (C) 2011 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 package com.example.android.opengl;
     17 
     18 import android.app.Activity;
     19 import android.opengl.GLSurfaceView;
     20 import android.os.Bundle;
     21 
     22 public class OpenGLES20Activity extends Activity {
     23 
     24     private GLSurfaceView mGLView;
     25 
     26     @Override
     27     public void onCreate(Bundle savedInstanceState) {
     28         super.onCreate(savedInstanceState);
     29 
     30         // Create a GLSurfaceView instance and set it
     31         // as the ContentView for this Activity
     32         mGLView = new MyGLSurfaceView(this);
     33         setContentView(mGLView);
     34     }
     35 
     36     @Override
     37     protected void onPause() {
     38         super.onPause();
     39         // The following call pauses the rendering thread.
     40         // If your OpenGL application is memory intensive,
     41         // you should consider de-allocating objects that
     42         // consume significant memory here.
     43         mGLView.onPause();
     44     }
     45 
     46     @Override
     47     protected void onResume() {
     48         super.onResume();
     49         // The following call resumes a paused rendering thread.
     50         // If you de-allocated graphic objects for onPause()
     51         // this is a good place to re-allocate them.
     52         mGLView.onResume();
     53     }
     54 }