Back to project page planets.
The source code is released under:
GNU General Public License
If you think the Android project planets listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package se.liu.lysator.dahlberg.planets; //from ww w. j a v a2 s . c o m import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.content.pm.ConfigurationInfo; import android.opengl.GLSurfaceView; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; public class GLES20Activity extends Activity { private GLSurfaceView surfaceView; private GLSurfaceView glView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (hasGLES20()) { glView = new GLSurfaceView(this); glView.setEGLContextClientVersion(2); glView.setPreserveEGLContextOnPause(true); glView.setRenderer(new GLES20Renderer()); } else { // Time to get a new phone, OpenGL ES 2.0 not // supported. } setContentView(glView); } private boolean hasGLES20() { ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); ConfigurationInfo info = am.getDeviceConfigurationInfo(); return info.reqGlEsVersion >= 0x20000; } @Override protected void onResume() { super.onResume(); /* * The activity must call the GL surface view's onResume() on activity * onResume(). */ if (surfaceView != null) { surfaceView.onResume(); } } @Override protected void onPause() { super.onPause(); /* * The activity must call the GL surface view's onPause() on activity * onPause(). */ if (surfaceView != null) { surfaceView.onPause(); } } }