Search in sources :

Example 1 with ParticleSystemRenderer

use of com.yalantis.starwarsdemo.particlesys.ParticleSystemRenderer in project StarWars.Android by Yalantis.

the class DemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);
    ButterKnife.bind(this);
    // Check if the system supports OpenGL ES 2.0.
    final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
    final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;
    if (supportsEs2) {
        // Request an OpenGL ES 2.0 compatible context.
        mGlSurfaceView.setEGLContextClientVersion(2);
        // Set the renderer to our demo renderer, defined below.
        ParticleSystemRenderer mRenderer = new ParticleSystemRenderer(mGlSurfaceView);
        mGlSurfaceView.setRenderer(mRenderer);
        mGlSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    } else {
        throw new UnsupportedOperationException();
    }
    if (savedInstanceState == null) {
        showGreetings();
    }
}
Also used : ParticleSystemRenderer(com.yalantis.starwarsdemo.particlesys.ParticleSystemRenderer) ActivityManager(android.app.ActivityManager) ConfigurationInfo(android.content.pm.ConfigurationInfo)

Aggregations

ActivityManager (android.app.ActivityManager)1 ConfigurationInfo (android.content.pm.ConfigurationInfo)1 ParticleSystemRenderer (com.yalantis.starwarsdemo.particlesys.ParticleSystemRenderer)1