setEGLConfigChooser() public method

public setEGLConfigChooser ( android arg0 ) : void
arg0 android
return void
Example #1
0
        //
        // constructor
        //

        private Renderer(android.app.Activity activity, Action onChanged,
                         int redSize, int greenSize, int blueSize,
                         int alphaSize, int depthSize, int stencilSize,
                         int swapInterval, bool checkErrors)
        {
            waitObject        = new android.os.ConditionVariable();
            paused            = new java.util.concurrent.atomic.AtomicInteger();
            actionOnChanged   = onChanged;
            this.swapInterval = swapInterval;
            this.checkErrors  = checkErrors;

            activity.runOnUiThread(((java.lang.Runnable.Delegate)(() =>
            {
                surface = new android.opengl.GLSurfaceView(activity);
                surface.setEGLContextClientVersion(3); // OpenGL ES 3.0
                surface.setEGLConfigChooser(redSize, greenSize, blueSize,
                                            alphaSize, depthSize, stencilSize);
                surface.setPreserveEGLContextOnPause(true);
                surface.setRenderer(this);
                surface.setRenderMode(android.opengl.GLSurfaceView.RENDERMODE_WHEN_DIRTY);
                activity.setContentView(surface);
            })).AsInterface());

            // wait for one onDrawFrame callback, which tells us that
            // GLSurfaceView finished initializing the GL context
            if (!waitObject.block(8000))
            {
                throw new NoSuitableGraphicsDeviceException("cannot create GLSurfaceView");
            }

            var clientBounds = GameRunner.Singleton.ClientBounds;

            if (SurfaceWidth != clientBounds.Width || SurfaceHeight != clientBounds.Height)
            {
                // while not common, it is possible for the screen to rotate,
                // between the time the Window/GameRunner is created, and the
                // time the renderer is created.  we want to identify this.
                if (actionOnChanged != null)
                {
                    actionOnChanged();
                }
            }
        }