android.opengl.GLSurfaceView.EGLConfigChooser

Here are the examples of the java api class android.opengl.GLSurfaceView.EGLConfigChooser taken from open source projects.

1. AndroidGraphics#createGLSurfaceView()

Project: libgdx
File: AndroidGraphics.java
protected View createGLSurfaceView(AndroidApplicationBase application, final ResolutionStrategy resolutionStrategy) {
    if (!checkGL20())
        throw new GdxRuntimeException("Libgdx requires OpenGL ES 2.0");
    EGLConfigChooser configChooser = getEglConfigChooser();
    int sdkVersion = android.os.Build.VERSION.SDK_INT;
    if (sdkVersion <= 10 && config.useGLSurfaceView20API18) {
        GLSurfaceView20API18 view = new GLSurfaceView20API18(application.getContext(), resolutionStrategy);
        if (configChooser != null)
            view.setEGLConfigChooser(configChooser);
        else
            view.setEGLConfigChooser(config.r, config.g, config.b, config.a, config.depth, config.stencil);
        view.setRenderer(this);
        return view;
    } else {
        GLSurfaceView20 view = new GLSurfaceView20(application.getContext(), resolutionStrategy, config.useGL30 ? 3 : 2);
        if (configChooser != null)
            view.setEGLConfigChooser(configChooser);
        else
            view.setEGLConfigChooser(config.r, config.g, config.b, config.a, config.depth, config.stencil);
        view.setRenderer(this);
        return view;
    }
}

2. AndroidGraphicsLiveWallpaper#createGLSurfaceView()

Project: libgdx
File: AndroidGraphicsLiveWallpaper.java
// <- specific for live wallpapers
// Grabbed from AndroidGraphics superclass and modified to override
// getHolder in created GLSurfaceView and GLSurfaceViewAPI18 instances
@Override
protected View createGLSurfaceView(AndroidApplicationBase application, final ResolutionStrategy resolutionStrategy) {
    if (!checkGL20())
        throw new GdxRuntimeException("Libgdx requires OpenGL ES 2.0");
    EGLConfigChooser configChooser = getEglConfigChooser();
    int sdkVersion = android.os.Build.VERSION.SDK_INT;
    if (sdkVersion <= 10 && config.useGLSurfaceView20API18) {
        GLSurfaceView20API18 view = new GLSurfaceView20API18(application.getContext(), resolutionStrategy) {

            @Override
            public SurfaceHolder getHolder() {
                return getSurfaceHolder();
            }

            // This method is invoked via reflection by AndroidLiveWallpaper.onDestroy() 
            public void onDestroy() {
                // calls GLSurfaceView.mGLThread.requestExitAndWait();
                onDetachedFromWindow();
            }
        };
        if (configChooser != null)
            view.setEGLConfigChooser(configChooser);
        else
            view.setEGLConfigChooser(config.r, config.g, config.b, config.a, config.depth, config.stencil);
        view.setRenderer(this);
        return view;
    } else {
        GLSurfaceView20 view = new GLSurfaceView20(application.getContext(), resolutionStrategy) {

            @Override
            public SurfaceHolder getHolder() {
                return getSurfaceHolder();
            }

            // This method is invoked via reflection by AndroidLiveWallpaper.onDestroy() 
            public void onDestroy() {
                // calls GLSurfaceView.mGLThread.requestExitAndWait();
                onDetachedFromWindow();
            }
        };
        if (configChooser != null)
            view.setEGLConfigChooser(configChooser);
        else
            view.setEGLConfigChooser(config.r, config.g, config.b, config.a, config.depth, config.stencil);
        view.setRenderer(this);
        return view;
    }
}