Nanashi-soft○プログラマ専用○AndroidでOpenGL ES 2.0プログラミング○
class ContextFactory implements GLSurfaceView.EGLContextFactory { private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098; public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) { // Log.w(TAG, "creating OpenGL ES 2.0 context"); // checkEglError("Before eglCreateContext", egl); int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE }; EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list); // checkEglError("After eglCreateContext", egl); return context; } public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) { egl.eglDestroyContext(display, context); } }意味はよくわかんないです('-'*)
public class sgca7 extends Activity { public native void NDKonTouch(int mode2,float cx,float cy); public native void NDKonSizeChanged(int width, int height); static { System.loadLibrary("sgc-jni"); } GLSurfaceView glview; sgcRenderer mGLRenderer; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); requestWindowFeature(Window.FEATURE_NO_TITLE); glview = new GLSurfaceView(this); // glview.setEGLContextClientVersion(2); glview.setEGLContextFactory(new ContextFactory()); glview.setRenderer(new sgcRenderer()); setContentView(glview); } public boolean onTouchEvent(MotionEvent event) { } }これで Android 2.2以降の命令を使用していないので,2.0以降で動作します