Search in sources :

Example 1 with BezierRenderer

use of com.yalantis.waves.gl.BezierRenderer in project Horizon by Yalantis.

the class Horizon method initView.

/**
     * Basic settings for component
     *
     * @param glSurfaceView   - view that will contain the component
     * @param backgroundColor - preferable background color for correct colors blending
     */
private void initView(GLSurfaceView glSurfaceView, @ColorInt int backgroundColor) {
    // check if the system supports opengl es 2.0.
    Context context = glSurfaceView.getContext();
    final ActivityManager activityManager = (ActivityManager) context.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.
        glSurfaceView.setEGLContextClientVersion(2);
        // Set the renderer to our demo renderer, defined below.
        mRenderer = new BezierRenderer(glSurfaceView, backgroundColor);
        glSurfaceView.setRenderer(mRenderer);
        glSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
    } else {
        throw new UnsupportedOperationException();
    }
}
Also used : Context(android.content.Context) BezierRenderer(com.yalantis.waves.gl.BezierRenderer) ActivityManager(android.app.ActivityManager) ConfigurationInfo(android.content.pm.ConfigurationInfo)

Aggregations

ActivityManager (android.app.ActivityManager)1 Context (android.content.Context)1 ConfigurationInfo (android.content.pm.ConfigurationInfo)1 BezierRenderer (com.yalantis.waves.gl.BezierRenderer)1