21 package com.arm.malideveloper.openglessdk.metaballs;
23 import android.content.Context;
24 import android.opengl.GLSurfaceView;
25 import javax.microedition.khronos.egl.EGL10;
26 import javax.microedition.khronos.egl.EGLConfig;
27 import javax.microedition.khronos.egl.EGLContext;
28 import javax.microedition.khronos.egl.EGLDisplay;
29 import javax.microedition.khronos.opengles.GL10;
31 class MetaballsView
extends GLSurfaceView
33 protected int redSize = 5;
34 protected int greenSize = 6;
35 protected int blueSize = 5 ;
36 protected int alphaSize = 0;
37 protected int depthSize = 16;
38 protected int sampleSize = 4;
39 protected int stencilSize = 0;
40 protected int[]
value =
new int [1];
42 public MetaballsView(Context context)
45 setEGLContextFactory(
new ContextFactory());
46 setEGLConfigChooser(
new ConfigChooser());
47 setRenderer(
new Renderer());
50 private static class ContextFactory implements GLSurfaceView.EGLContextFactory
52 public EGLContext
createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig)
54 final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
55 int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION,
58 EGLContext context = egl.eglCreateContext(display,
66 public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context)
68 NativeLibrary.uninit();
69 egl.eglDestroyContext(display, context);
77 final int EGL_OPENGL_ES2_BIT = 4;
80 EGL10.EGL_RED_SIZE, redSize,
81 EGL10.EGL_GREEN_SIZE, greenSize,
82 EGL10.EGL_BLUE_SIZE, blueSize,
83 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
84 EGL10.EGL_SAMPLES, sampleSize,
85 EGL10.EGL_DEPTH_SIZE, depthSize,
86 EGL10.EGL_STENCIL_SIZE, stencilSize,
90 int[] num_config =
new int[1];
93 int numConfigs = num_config[0];
94 EGLConfig[] configs =
new EGLConfig[numConfigs];
96 egl.eglChooseConfig(display,
configAttributes, configs, numConfigs, num_config);
104 NativeLibrary.step();
GLint GLsizei GLsizei height
EGLint configAttributes[]
EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig)
void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context)