OpenGL ES SDK for Android ARM Developer Center
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ETCUncompressedAlpha.java
Go to the documentation of this file.
1 /* Copyright (c) 2011-2017, ARM Limited and Contributors
2  *
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge,
6  * to any person obtaining a copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
9  * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
14  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
17  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  */
20 
21 package com.arm.malideveloper.openglessdk.etcuncompressedalpha;
22 
23 import javax.microedition.khronos.egl.EGLConfig;
24 import javax.microedition.khronos.opengles.GL10;
25 import android.content.Context;
26 import android.opengl.GLSurfaceView;
27 import android.os.Bundle;
28 import android.view.Window;
29 import android.view.WindowManager;
30 import com.arm.malideveloper.openglessdk.*;
31 
32 class ETCUncompressedAlphaDemoView extends MaliSamplesView
33 {
34  public ETCUncompressedAlphaDemoView(Context context)
35  {
36  super(context);
37  }
38 
39  @Override protected void setRendererCallback()
40  {
41  setRenderer(new Renderer());
42  }
43 
44  @Override protected void destroyContextCallback()
45  {
46  ETCUncompressedAlpha.uninit();
47  }
48 
49  protected class Renderer implements GLSurfaceView.Renderer
50  {
51  public void onDrawFrame(GL10 gl)
52  {
53  ETCUncompressedAlpha.step();
54  }
55 
56  public void onSurfaceChanged(GL10 gl, int width, int height)
57  {
58  ETCUncompressedAlpha.init(width, height);
59  }
60 
61  public void onSurfaceCreated(GL10 gl, EGLConfig config)
62  {
63  // Optional code here...
64  }
65  }
66 };
67 
69 {
70  ETCUncompressedAlphaDemoView mView;
71 
72  public static native void init(int width, int height);
73  public static native void step();
74  public static native void uninit();
75 
76  @Override protected void onCreate(Bundle icicle)
77  {
78  super.onCreate(icicle);
79 
80  this.requestWindowFeature(Window.FEATURE_NO_TITLE);
81  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
82  WindowManager.LayoutParams.FLAG_FULLSCREEN);
83 
84  mView = new ETCUncompressedAlphaDemoView(getApplication());
85  setContentView(mView);
86  }
87 
88  @Override protected void onPause()
89  {
90  super.onPause();
91  mView.onPause();
92  }
93 
94  @Override protected void onResume()
95  {
96  super.onResume();
97  mView.onResume();
98  }
99 
100  @Override protected void onDestroy()
101  {
102  super.onDestroy();
103  }
104 
105  static
106  {
107  // Load the NDK library for this example, built with ndk-build
108  System.loadLibrary("Native");
109  }
110 }
111 
112 
GLint GLsizei GLsizei height
Definition: gl2ext.h:179
GLint GLsizei width
Definition: gl2ext.h:179