21 package com.arm.malideveloper.openglessdk.tessellation;
24 import java.io.InputStream;
25 import java.io.RandomAccessFile;
26 import android.os.Bundle;
27 import android.os.Build;
28 import android.app.Activity;
29 import android.app.ActivityManager;
30 import android.content.res.AssetManager;
31 import android.util.Log;
32 import android.view.MotionEvent;
33 import android.content.Context;
34 import android.content.pm.ConfigurationInfo;
35 import android.opengl.GLSurfaceView;
36 import android.widget.Toast;
37 import android.content.res.AssetManager;
38 import android.content.pm.PackageManager;
39 import android.view.Window;
40 import android.view.WindowManager;
41 import android.opengl.GLSurfaceView.EGLContextFactory;
42 import android.opengl.GLES31;
43 import javax.microedition.khronos.egl.EGLContext;
44 import javax.microedition.khronos.egl.EGLDisplay;
45 import javax.microedition.khronos.egl.EGL10;
47 import javax.microedition.khronos.egl.EGLConfig;
48 import javax.microedition.khronos.opengles.GL10;
54 private static String
LOGTAG =
"libNative";
55 private GLSurfaceView
view;
57 @Override
protected void onCreate(Bundle savedInstanceState)
59 super.onCreate(savedInstanceState);
61 this.requestWindowFeature(Window.FEATURE_NO_TITLE);
62 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
63 WindowManager.LayoutParams.FLAG_FULLSCREEN);
65 view =
new GLSurfaceView(
this);
66 view.setEGLContextClientVersion(2);
67 view.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
115 Log.d(
LOGTAG, assetName +
" already exists. No extraction needed.\n");
117 Log.d(
LOGTAG, assetName +
" doesn't exist. Extraction needed. \n");
120 RandomAccessFile randomAccessFile =
new RandomAccessFile(
assetsDirectory + assetName,
"rw");
121 AssetManager assetManager = applicationContext.getResources().getAssets();
122 InputStream inputStream = assetManager.open(assetName);
124 byte
buffer[] =
new byte[1024];
130 count = inputStream.read(
buffer, 0, 1024);
133 randomAccessFile.close();
135 }
catch(Exception e) {
140 Log.d(
LOGTAG,
"File extracted successfully");
149 NativeLibrary.step();
159 NativeLibrary.init();
GLint GLsizei GLsizei height
static String assetsDirectory
void onDrawFrame(GL10 gl)
GLenum GLenum GLsizei count
static android.content.Context applicationContext
void extractAsset(String assetName)
void onSurfaceChanged(GL10 gl, int width, int height)
void onCreate(Bundle savedInstanceState)
void onSurfaceCreated(GL10 gl, EGLConfig config)