21 package com.arm.malideveloper.openglessdk.ocean;
24 import java.io.InputStream;
25 import java.io.BufferedOutputStream;
26 import java.io.FileOutputStream;
27 import java.io.IOException;
28 import android.content.res.AssetManager;
29 import android.util.Log;
31 import javax.microedition.khronos.egl.EGLConfig;
32 import javax.microedition.khronos.opengles.GL10;
33 import android.content.Context;
34 import android.opengl.GLSurfaceView;
35 import android.os.Bundle;
36 import android.view.Window;
37 import android.view.WindowManager;
38 import com.arm.malideveloper.openglessdk.*;
42 public OceanView(Context context)
44 super(context, GlesVersion.GLES3);
47 @Override
protected void setRendererCallback()
49 setRenderer(
new Renderer());
52 @Override
protected void destroyContextCallback()
80 private static String
LOGTAG =
"libNative";
83 public static native
void step();
84 public static native
void uninit();
86 @Override
protected void onCreate(Bundle savedInstanceState)
88 super.onCreate(savedInstanceState);
90 this.requestWindowFeature(Window.FEATURE_NO_TITLE);
91 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
92 WindowManager.LayoutParams.FLAG_FULLSCREEN);
99 mView =
new OceanView(getApplication());
100 mView.getHolder().setFixedSize(1280, 720);
101 setContentView(mView);
123 InputStream stream = getAssets().open(file);
124 int len = stream.available();
125 byte[]
buf =
new byte[len];
126 stream.read(
buf, 0, len);
129 }
catch (IOException e) {
137 String[] assets = getAssets().list(
"");
139 for (String file : assets) {
145 BufferedOutputStream writer =
new BufferedOutputStream(
new FileOutputStream(
new File(path)));
151 Log.d(
LOGTAG,
"Asset " + path +
" extracted successfully.");
154 catch (IOException e) {
155 Log.e(
LOGTAG,
"Failure in extractAssets(): " + e.toString());
162 System.loadLibrary(
"Native");
static native void init(int width, int height)
void onSurfaceCreated(GL10 gl, EGLConfig config)
GLint GLsizei GLsizei height
static android.content.Context applicationContext
byte[] loadAsset(String file)
void onCreate(Bundle savedInstanceState)
void onSurfaceChanged(GL10 gl, int width, int height)
static native void step()
static native void uninit()
static String assetsDirectory
void onDrawFrame(GL10 gl)
GLenum GLuint GLenum GLsizei length
GLenum GLuint GLenum GLsizei const GLchar * buf