Ejemplo n.º 1
0
        public IEnumerable <Config> ChooseConfigs(Attribs <ConfigAttributes> attribs, int numberOfConfigsToReturn)
        {
            var configs = new IntPtr[numberOfConfigsToReturn];

            int numberOfConfigsFound;

            if (NativeEgl.eglChooseConfig(
                    this.display.DisplayPointer,
                    attribs.ToIntArray(),
                    configs,
                    configs.Length,
                    out numberOfConfigsFound) == NativeEgl.EGL_FALSE)
            {
                throw new PlatformGraphicsException("Could not choose configurations.", NativeEgl.eglGetError());
            }

            var result = new List <Config>();

            for (int i = 0; i < numberOfConfigsFound; i++)
            {
                result.Add(new Config(configs[i]));
            }

            return(result);
        }
Ejemplo n.º 2
0
        protected void Initialize()
        {
            var contextAttribs = new Attribs <int>();

            contextAttribs.Add(NativeEgl.EGL_CONTEXT_CLIENT_VERSION, (int)this.clientVersion);
            contextAttribs.AddEnd();

            this.ContextPointer = NativeEgl.eglCreateContext(
                this.displayPointer, this.configPointer, IntPtr.Zero, contextAttribs.ToIntArray());

            if (this.ContextPointer == IntPtr.Zero)
            {
                throw new PlatformGraphicsException("Failed to create context.", NativeEgl.eglGetError());
            }

            this.isInitialized = true;
        }