21 package com.arm.malideveloper.openglessdk.minMaxBlending;
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 TutorialView
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 TutorialView(Context context)
46 setEGLContextFactory(
new ContextFactory());
47 setEGLConfigChooser(
new ConfigChooser());
48 setRenderer(
new Renderer());
51 private static class ContextFactory implements GLSurfaceView.EGLContextFactory
53 public EGLContext
createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig)
55 final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
56 int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION,
60 EGLContext context = egl.eglCreateContext(display,
68 public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context)
70 egl.eglDestroyContext(display, context);
78 final int EGL_OPENGL_ES2_BIT = 4;
81 EGL10.EGL_RED_SIZE, redSize,
82 EGL10.EGL_GREEN_SIZE, greenSize,
83 EGL10.EGL_BLUE_SIZE, blueSize,
84 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
85 EGL10.EGL_SAMPLES, sampleSize,
86 EGL10.EGL_DEPTH_SIZE, depthSize,
87 EGL10.EGL_STENCIL_SIZE, stencilSize,
91 int[] num_config =
new int[1];
94 int numConfigs = num_config[0];
95 EGLConfig[] configs =
new EGLConfig[numConfigs];
97 egl.eglChooseConfig(display,
configAttributes, configs, numConfigs, num_config);
106 NativeLibrary.step();
void onSurfaceChanged(GL10 gl, int width, int height)
void onDrawFrame(GL10 gl)
GLint GLsizei GLsizei height
void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context)
void onSurfaceCreated(GL10 gl, EGLConfig config)
EGLint configAttributes[]
EGLConfig chooseConfig(EGL10 egl, EGLDisplay display)
EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig)