1 /* 2 * Copyright (C) 2009 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.test; 18 /* 19 * Copyright (C) 2008 The Android Open Source Project 20 * 21 * Licensed under the Apache License, Version 2.0 (the "License"); 22 * you may not use this file except in compliance with the License. 23 * You may obtain a copy of the License at 24 * 25 * http://www.apache.org/licenses/LICENSE-2.0 26 * 27 * Unless required by applicable law or agreed to in writing, software 28 * distributed under the License is distributed on an "AS IS" BASIS, 29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 30 * See the License for the specific language governing permissions and 31 * limitations under the License. 32 */ 33 34 35 import android.content.Context; 36 import android.opengl.GLSurfaceView; 37 import android.util.AttributeSet; 38 import android.util.Log; 39 import android.view.KeyEvent; 40 import android.view.MotionEvent; 41 42 import javax.microedition.khronos.egl.EGL10; 43 import javax.microedition.khronos.egl.EGLConfig; 44 import javax.microedition.khronos.opengles.GL10; 45 /** 46 * An implementation of SurfaceView that uses the dedicated surface for 47 * displaying an OpenGL animation. This allows the animation to run in a 48 * separate thread, without requiring that it be driven by the update mechanism 49 * of the view hierarchy. 50 * 51 * The application-specific rendering code is delegated to a GLView.Renderer 52 * instance. 53 */ 54 class TestView extends GLSurfaceView { 55 TestView(Context context) { 56 super(context); 57 init(); 58 } 59 60 public TestView(Context context, AttributeSet attrs) { 61 super(context, attrs); 62 init(); 63 } 64 65 private void init() { 66 setRenderer(new Renderer()); 67 } 68 69 private class Renderer implements GLSurfaceView.Renderer { 70 private static final String TAG = "Renderer"; 71 public void onDrawFrame(GL10 gl) { 72 // Do nothing. 73 } 74 75 public void onSurfaceChanged(GL10 gl, int width, int height) { 76 // Do nothing. 77 } 78 79 public void onSurfaceCreated(GL10 gl, EGLConfig config) { 80 // Do nothing. 81 } 82 } 83 } 84 85