SelectGraphicsMode() public méthode

public SelectGraphicsMode ( ColorFormat color, int depth, int stencil, int samples, ColorFormat accum, int buffers, bool stereo ) : OpenTK.Graphics.GraphicsMode
color OpenTK.Graphics.ColorFormat
depth int
stencil int
samples int
accum OpenTK.Graphics.ColorFormat
buffers int
stereo bool
Résultat OpenTK.Graphics.GraphicsMode
Exemple #1
0
        bool vsync = true;   // Default vsync value is defined as 1 (true) in EGL.
        #endregion

        #region Constructors

        public EglContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
            int major, int minor, GraphicsContextFlags flags)
        {
            if (mode == null)
                throw new ArgumentNullException("mode");
            if (window == null)
                throw new ArgumentNullException("window");
            EglContext shared = (EglContext)sharedContext;
            int dummy_major, dummy_minor;
            if (!Egl.Initialize(window.Display, out dummy_major, out dummy_minor))
                throw new GraphicsContextException(String.Format("Failed to initialize EGL, error {0}.", Egl.GetError()));
            WindowInfo = window;

            Egl.BindAPI(0x30A0); //bind EGL_OPENGL_ES_API

            var eglGfxMode = new EglGraphicsMode();
            eglGfxMode.window = window;
            Mode = eglGfxMode.SelectGraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo);
            if (!Mode.Index.HasValue)
                throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
            IntPtr config = Mode.Index.Value;
            if (window.Surface == IntPtr.Zero)
                window.CreateWindowSurface(config);
            int[] attrib_list = new int[] { 
                //key,value
                Egl.CONTEXT_CLIENT_VERSION, major,
                Egl.NONE };
            HandleAsEGLContext = Egl.CreateContext(window.Display, config, shared != null ? shared.HandleAsEGLContext : IntPtr.Zero, attrib_list);
            MakeCurrent(window);
        }
Exemple #2
0
        bool vsync = true;   // Default vsync value is defined as 1 (true) in EGL.


        public EglContext(GraphicsMode mode, EglWindowInfo window, IGraphicsContext sharedContext,
                          int major, int minor, GraphicsContextFlags flags)
        {
            if (mode == null)
            {
                throw new ArgumentNullException("mode");
            }
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }

            //EglContext shared = (EglContext)sharedContext; //old version
            EglContext shared = sharedContext as EglContext;


            int dummy_major, dummy_minor;

            if (!Egl.Initialize(window.Display, out dummy_major, out dummy_minor))
            {
                throw new GraphicsContextException(String.Format("Failed to initialize EGL, error {0}.", Egl.GetError()));
            }
            WindowInfo = window;

            Egl.BindAPI(0x30A0); //bind EGL_OPENGL_ES_API

            var eglGfxMode = new EglGraphicsMode();

            eglGfxMode.window = window;
            Mode = eglGfxMode.SelectGraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo);
            if (!Mode.Index.HasValue)
            {
                throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
            }
            IntPtr config = Mode.Index.Value;

            if (window.Surface == IntPtr.Zero)
            {
                window.CreateWindowSurface(config);
            }
            int[] attrib_list = new int[] {
                //key,value
                Egl.CONTEXT_CLIENT_VERSION, major,
                Egl.NONE
            };
            HandleAsEGLContext = Egl.CreateContext(window.Display, config, shared != null ? shared.HandleAsEGLContext : IntPtr.Zero, attrib_list);
            MakeCurrent(window);
        }