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();
}
}
Aggregations