21 package com.arm.malideveloper.openglessdk.translucency;
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.view.Window;
39 import android.view.WindowManager;
40 import android.opengl.GLSurfaceView.EGLContextFactory;
41 import javax.microedition.khronos.egl.EGLContext;
42 import javax.microedition.khronos.egl.EGLDisplay;
43 import javax.microedition.khronos.egl.EGL10;
45 import javax.microedition.khronos.egl.EGLConfig;
46 import javax.microedition.khronos.opengles.GL10;
52 private static String
LOGTAG =
"libNative";
53 private GLSurfaceView
view;
55 @Override
protected void onCreate(Bundle savedInstanceState)
57 super.onCreate(savedInstanceState);
59 this.requestWindowFeature(Window.FEATURE_NO_TITLE);
60 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
61 WindowManager.LayoutParams.FLAG_FULLSCREEN);
63 view =
new GLSurfaceView(
this);
64 view.setEGLContextClientVersion(2);
65 view.setEGLConfigChooser(8, 8, 8, 8, 16, 8);
67 view.getHolder().setFixedSize(1280, 720);
95 NativeLibrary.uninit();
106 float x = event.getRawX();
107 float y = event.getRawY();
108 if (event.getAction() == MotionEvent.ACTION_UP)
110 else if (event.getAction() == MotionEvent.ACTION_MOVE)
120 Log.d(
LOGTAG, assetName +
" already exists. No extraction needed.\n");
122 Log.d(
LOGTAG, assetName +
" doesn't exist. Extraction needed. \n");
125 RandomAccessFile randomAccessFile =
new RandomAccessFile(
assetsDirectory + assetName,
"rw");
126 AssetManager assetManager = applicationContext.getResources().getAssets();
127 InputStream inputStream = assetManager.open(assetName);
129 byte
buffer[] =
new byte[1024];
135 count = inputStream.read(
buffer, 0, 1024);
138 randomAccessFile.close();
140 }
catch(Exception e) {
145 Log.d(
LOGTAG,
"File extracted successfully");
154 NativeLibrary.step();
GLint GLsizei GLsizei height
void onCreate(Bundle savedInstanceState)
GLenum GLenum GLsizei count
static String assetsDirectory
void onSurfaceCreated(GL10 gl, EGLConfig config)
void onDrawFrame(GL10 gl)
static native void onpointerup(float x, float y)
GLint GLint GLint GLint GLint x
boolean onTouchEvent(MotionEvent event)
void onSurfaceChanged(GL10 gl, int width, int height)
static native void onpointerdown(float x, float y)
void extractAsset(String assetName)
static android.content.Context applicationContext