21 package com.arm.malideveloper.openglessdk.occlusionculling;
24 import java.io.InputStream;
25 import java.io.RandomAccessFile;
26 import android.content.res.AssetManager;
27 import android.util.Log;
29 import javax.microedition.khronos.egl.EGLConfig;
30 import javax.microedition.khronos.opengles.GL10;
31 import android.content.Context;
32 import android.opengl.GLSurfaceView;
33 import android.os.Bundle;
34 import android.view.Window;
35 import android.view.WindowManager;
36 import com.arm.malideveloper.openglessdk.*;
40 public OcclusionCullingView(Context context)
42 super(context, GlesVersion.GLES3);
45 @Override
protected void setRendererCallback()
47 setRenderer(
new Renderer());
50 @Override
protected void destroyContextCallback()
52 OcclusionCulling.uninit();
59 OcclusionCulling.step();
75 OcclusionCullingView mView;
78 private static String
LOGTAG =
"libNative";
81 public static native
void step();
82 public static native
void uninit();
84 @Override
protected void onCreate(Bundle savedInstanceState)
86 super.onCreate(savedInstanceState);
88 this.requestWindowFeature(Window.FEATURE_NO_TITLE);
89 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
90 WindowManager.LayoutParams.FLAG_FULLSCREEN);
114 mView =
new OcclusionCullingView(getApplication());
115 mView.getHolder().setFixedSize(1280, 720);
116 setContentView(mView);
141 Log.d(
LOGTAG, assetName +
" already exists. No extraction needed.\n");
143 Log.d(
LOGTAG, assetName +
" doesn't exist. Extraction needed. \n");
146 RandomAccessFile randomAccessFile =
new RandomAccessFile(
assetsDirectory + assetName,
"rw");
147 AssetManager assetManager = applicationContext.getResources().getAssets();
148 InputStream inputStream = assetManager.open(assetName);
150 byte
buffer[] =
new byte[1024];
156 count = inputStream.read(
buffer, 0, 1024);
159 randomAccessFile.close();
161 }
catch(Exception e) {
166 Log.d(
LOGTAG,
"File extracted successfully");
175 System.loadLibrary(
"Native");
GLint GLsizei GLsizei height
GLenum GLenum GLsizei count
void extractAsset(String assetName)
void onCreate(Bundle savedInstanceState)
static native void init(int width, int height)
void onDrawFrame(GL10 gl)
void onSurfaceCreated(GL10 gl, EGLConfig config)
static String assetsDirectory
void onSurfaceChanged(GL10 gl, int width, int height)
static native void uninit()
static android.content.Context applicationContext
static native void step()