示例#1
0
        public NativeWindowProvider(string name, int width, int height)
        {
            var graphicsMode = new GraphicsMode(new ColorFormat(32), 24, 0, 0);

            Window = new NativeWindow(width, height, name, GameWindowFlags.Default, graphicsMode, DisplayDevice.Default);
            Window.Visible = true;
        }
示例#2
0
 public Main(GraphicsMode mode, string title, GameWindowFlags flags)
     : base((int)Constants.Graphics.ScreenResolution.X, (int)Constants.Graphics.ScreenResolution.Y, mode, title, flags)
 {
     Engines = new List<Engine>();
     Constants.SetupEngines(this);
     Constants.Engines.Input.SetMouseShow(false);
 }
示例#3
0
        public CanvasForm(Control parent)
        {
            InitializeComponent();

            ContextContainer = new Panel();
            ContextContainer.Padding = new Padding(1);
            ContextContainer.BackColor = Color.Black;

            Console.WriteLine(ContextContainer.Anchor);

            GraphicsMode mode = new GraphicsMode(
                new ColorFormat(8, 8, 8, 8),
                8, 8, MSAASamples,
                new ColorFormat(8, 8, 8, 8), 2, false
            );
            GLContext = new GLControl(mode, 2, 0, GraphicsContextFlags.Default);
            GLContext.Dock = DockStyle.Fill;
            GLContext.VSync = true;
            GLContext.Paint += new PaintEventHandler(this.GLContext_Paint);
            GLContext.MouseDown += new MouseEventHandler(this.GLContext_MouseDown);
            GLContext.MouseMove += new MouseEventHandler(this.GLContext_MouseMove);
            GLContext.MouseUp += new MouseEventHandler(this.GLContext_MouseUp);

            ContextContainer.Controls.Add(GLContext);
            Controls.Add(ContextContainer);

            // Setup stuff
            TopLevel = false;
            parent.Controls.Add(this);
        }
示例#4
0
        public Game(int width, int height, GraphicsMode m, string title)
            : base(width, height, m, title)
        {
            // OpenTK configuration
            //
            VSync = VSyncMode.Adaptive;

            // Our initialization
            //
            core = new Core(Color.FromArgb(255, 2, 0, 8));
            core.LoadScene(new TestScene("test scene", new Vector2(ClientSize.Width, ClientSize.Height)));
            core.ActiveScene = "test scene";

            // Subscribe to OpenTK events
            //
            RenderFrame += OnRenderFrame;
            UpdateFrame += OnUpdateFrame;
            Resize += OnResize;
            Load += OnLoad;
            Closing += OnClosing;

            // Bind key event handlers
            //
            keyBinder = new Keybinder(Keyboard);

            keyBinder.SubscribeListener(Key.V, VsyncToggle);
            keyBinder.SubscribeListener(Key.Q, Quit);
            keyBinder.SubscribeListener(Key.F4, Quit);
            keyBinder.SubscribeListener(Key.Enter, ToggleWindowedFullscreen);
        }
示例#5
0
        internal X11GLControl(GraphicsMode mode, Control control)
        {
            if (mode == null)
                throw new ArgumentNullException("mode");
            if (control == null)
                throw new ArgumentNullException("control");

            // Note: the X11 window is created with a default XVisualInfo,
            // that is not necessarily compatible with the desired GraphicsMode.
            // This manifests in Nvidia binary drivers that fail in Glx.MakeCurrent()
            // when GraphicsMode has a 32bpp color format.
            // To work around this issue, we implicitly select a 24bpp color format when 32bpp is
            // requested - this appears to work correctly in all cases.
            // (The loss of the alpha channel does not matter, since WinForms do not support
            // translucent windows on X11 in the first place.)
            this.mode = new GraphicsMode(
                new ColorFormat(mode.ColorFormat.Red, mode.ColorFormat.Green, mode.ColorFormat.Blue, 0),
                mode.Depth,
                mode.Stencil,
                mode.Samples,
                mode.AccumulatorFormat,
                mode.Buffers,
                mode.Stereo);

            if (xplatui == null) throw new PlatformNotSupportedException(
                    "System.Windows.Forms.XplatUIX11 missing. Unsupported platform or Mono runtime version, aborting.");

            // get the required handles from the X11 API.
            display = (IntPtr)GetStaticFieldValue(xplatui, "DisplayHandle");
            rootWindow = (IntPtr)GetStaticFieldValue(xplatui, "RootWindow");
            int screen = (int)GetStaticFieldValue(xplatui, "ScreenNo");

            window_info = Utilities.CreateX11WindowInfo(display, screen, control.Handle, rootWindow, IntPtr.Zero);
        }
示例#6
0
 public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
 {
     WinWindowInfo win_win = (WinWindowInfo)window;
     IntPtr egl_display = GetDisplay(win_win.DeviceContext);
     EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, egl_display);
     return new EglContext(mode, egl_win, shareContext, major, minor, flags);
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public OpenGLWriteableBitmapUpdater(Size size, GraphicsMode graphicsMode, Action<GLControl> onPrepare = null, Action<GLControl> onFinalize = null)
        {
            this.loaded = false;
            this.Size = size;
            this.framebufferId = -1;

            this.OnPrepare += onPrepare;
            this.OnFinalize += onFinalize;

            messagingTask.StartMessageLoop(
                prepare: () =>
                {
                    this.glControl = new GLControl(graphicsMode);
                    this.glControl.MakeCurrent();
                    if (this.OnPrepare != null)
                    {
                        this.OnPrepare(this.glControl);
                        this.OnPrepare -= onPrepare;
                    }
                },
                finalize: () =>
                {
                    if (this.OnFinalize != null)
                    {
                        this.OnFinalize(this.glControl);
                        this.OnFinalize -= onFinalize;
                    }
                    this.glControl.Context.MakeCurrent(null);
                    this.glControl.Dispose();
                });
        }
        public void Run()
        {
            GraphicsMode gmode = new GraphicsMode(GraphicsMode.Default.ColorFormat, GraphicsMode.Default.Depth, GraphicsMode.Default.Stencil, 0);

            DisplayDevice dd = DisplayDevice.Default;

            NativeWindow nw = new NativeWindow(Width, Height, "Test", GameWindowFlags.Default, gmode, dd);

            GraphicsContext glContext = new GraphicsContext(gmode, nw.WindowInfo, 3, 0, GraphicsContextFlags.Default);
            glContext.LoadAll();

            glContext.MakeCurrent(nw.WindowInfo);

            if (Load())
            {
                nw.Visible = true;
                while (nw.Visible)
                {
                    Frame();

                    glContext.SwapBuffers();

                    Thread.Sleep(1000 / 60); //"60" fps (not really...)

                    nw.ProcessEvents();
                }

                nw.Visible = false;
            }

            Unload();
        }
 public override OpenTK.Graphics.IGraphicsContext CreateGLContext(
     GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering,
     int major, int minor, GraphicsContextFlags flags)
 {
     flags |= GraphicsContextFlags.Embedded;
     return base.CreateGLContext(mode, window, shareContext, directRendering, major, minor, flags);
 }
示例#10
0
 public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
 {
     WinWindowInfo winWindowInfo = (WinWindowInfo) window;
       IntPtr display = this.GetDisplay(winWindowInfo.DeviceContext);
       EglWindowInfo window1 = new EglWindowInfo(winWindowInfo.WindowHandle, display);
       return (IGraphicsContext) new EglContext(mode, window1, shareContext, major, minor, flags);
 }
示例#11
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Closing += Form1_Closing;

            WindowInfo = Utilities.CreateWindowsWindowInfo(panel1.Handle);
            var WindowMode = new GraphicsMode(32, 24, 0, 0, 0, 2);
            WindowContext = new GraphicsContext(WindowMode, WindowInfo, 2, 0, GraphicsContextFlags.Debug);

            WindowContext.MakeCurrent(WindowInfo);
            WindowContext.LoadAll(); // as IGraphicsContextInternal)

            WindowContext.SwapInterval = 1;
            GL.Viewport(0, 0, panel1.Width, panel1.Height);

            GL.Enable(EnableCap.DepthTest);
            GL.Disable(EnableCap.CullFace);
            GL.ClearColor(Color.DarkBlue);

            try
            {
                state.LoadCLRPackage();
                state.DoString(@" import ('LUA', 'LUA') ");
            }
            catch (LuaException ex)
            {
                MessageBox.Show(ex.Message, "LUA Package Exception", MessageBoxButtons.OK);
            }

            state["x"] = 0.0;
            state["y"] = 1.0;
            state["fn"] = 0;
            script = textBox1.Text;

            timer1.Enabled = true;
        }
示例#12
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;

            Mode = new EglGraphicsMode().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[] { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE };
            HandleAsEGLContext = Egl.CreateContext(window.Display, config, shared != null ? shared.HandleAsEGLContext : IntPtr.Zero, attrib_list);

            MakeCurrent(window);
        }
示例#13
0
 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 eglContext = (EglContext) sharedContext;
       int major1;
       int minor1;
       if (!Egl.Initialize(window.Display, out major1, out minor1))
     throw new GraphicsContextException(string.Format("Failed to initialize EGL, error {0}.", (object) Egl.GetError()));
       this.WindowInfo = window;
       this.Mode = new EglGraphicsMode().SelectGraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo, major > 1 ? RenderableFlags.ES2 : RenderableFlags.ES);
       if (!this.Mode.Index.HasValue)
     throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");
       IntPtr config = this.Mode.Index.Value;
       if (window.Surface == IntPtr.Zero)
     window.CreateWindowSurface(config);
       int[] attrib_list = new int[3]
       {
     12440,
     major,
     12344
       };
       this.HandleAsEGLContext = Egl.CreateContext(window.Display, config, eglContext != null ? eglContext.HandleAsEGLContext : IntPtr.Zero, attrib_list);
       this.MakeCurrent((IWindowInfo) window);
 }
示例#14
0
        static void Main()
        {
            Dictionary<GraphicsMode, GraphicsMode> modes = new Dictionary<GraphicsMode, GraphicsMode>();
            Trace.WriteLine("Cl (RGBA): Color format (total bits and bits per channel).");
            Trace.WriteLine("Dp       : Depth buffer bits.");
            Trace.WriteLine("St       : Stencil buffer bits.");
            Trace.WriteLine("AA       : Sample count for anti-aliasing.");
            Trace.WriteLine("Stereo   : Stereoscoping rendering supported.");
            Trace.WriteLine("");
            Trace.WriteLine("Cl (RGBA), Dp, St, AA, Stereo");
            Trace.WriteLine("-----------------------------");
            foreach (ColorFormat color in new ColorFormat[] { 32, 24, 16, 8 })
                foreach (int depth in new int[] { 24, 16 })
                    foreach (int stencil in new int[] { 8, 0 })
                        foreach (int samples in new int[] { 0, 2, 4, 6, 8, 16 })
                                foreach (bool stereo in new bool[] { false, true })
                                {
                                    try
                                    {
                                        GraphicsMode mode = new GraphicsMode(color, depth, stencil, samples, 0, 2, stereo);
                                        if (!modes.ContainsKey(mode))
                                            modes.Add(mode, mode);
                                    }
                                    catch
                                    { }
                                }

            foreach (GraphicsMode mode in modes.Keys)
                Trace.WriteLine(String.Format("{0}, {1:00}, {2:00}, {3:00}, {4}", mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.Stereo));
        }
		public void Evaluate(int SpreadMax)
		{
			if (InputChanged() || FFirstRun)
			{
				FFirstRun = false;

				FPinOutOutput.SliceCount = SpreadMax;
				ColorFormat FColorFormat;
				ColorFormat FAccumulatorFormat;

				for (int i=0; i<SpreadMax; i++)
				{
					if (FPinInColorFormat[i] == null)
						FColorFormat = new ColorFormat(32);
					else
						FColorFormat = FPinInColorFormat[i];

					if (FPinInAccumulatorFormat[i] == null)
						FAccumulatorFormat = new ColorFormat(0);
					else
						FAccumulatorFormat = FPinInAccumulatorFormat[i];

					FPinOutOutput[i] = new GraphicsMode(FColorFormat, FPinInDepthBufferDepth[i], FPinInStencilBufferDepth[i], FPinInMSAA[i], FAccumulatorFormat, FPinInBuffers[i], FPinInStereo[i]);
				}
			}
		}
示例#16
0
 /// <summary>
 /// Constructor that passes parameters to the OpenTK GameWindow
 /// </summary>
 public TextureMapping_Net(int width,
                           int height,
                           OpenTK.Graphics.GraphicsMode mode,
                           string title) : base(width, height, mode, title)
 {
     this.VSync = VSyncMode.On;
 }
        internal CarbonGLControl(GraphicsMode mode, Control owner)
        {
            this.mode = mode;
            this.control = owner;

            window_info = Utilities.CreateMacOSCarbonWindowInfo(control.Handle, false, true);
        }
示例#18
0
 public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
 {
     X11WindowInfo x11_win = (X11WindowInfo)window;
     //EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(x11_win.Display));
     EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(new IntPtr(0)));
     return new EglContext(mode, egl_win, shareContext, major, minor, flags);
 }
示例#19
0
        // This method is called everytime the context needs
        // to be recreated. Use it to set any egl-specific settings
        // prior to context creation
        protected override void CreateFrameBuffer()
        {
            ContextRenderingApi = GLVersion.ES2;

            // the default GraphicsMode that is set consists of (16, 16, 0, 0, 2, false)
            try
            {
                Debug.WriteLine("Loading with default settings");

                // if you don't call this, the context won't be created
                base.CreateFrameBuffer();
                return;
            }
            catch (Exception ex)
            {
                Log.Verbose("AGS", "{0}", ex);
            }

            // this is a graphics setting that sets everything to the lowest mode possible so
            // the device returns a reliable graphics setting.
            try
            {
                Log.Verbose("AGS", "Loading with custom Android settings (low mode)");
                GraphicsMode = new GraphicsMode(0, 0, 0, 0, 0, 0, false);

                // if you don't call this, the context won't be created
                base.CreateFrameBuffer();
                return;
            }
            catch (Exception ex)
            {
                Log.Verbose("AGS", "{0}", ex);
            }
            throw new Exception("Can't load egl, aborting");
        }
        public X11GLContext(GraphicsMode mode, IWindowInfo window)
        {
            if (mode == null)
                throw new ArgumentNullException("mode");
            if (window == null)
                throw new ArgumentNullException("window");

            Debug.Print( "Creating X11GLContext context: " );
            currentWindow = (X11WindowInfo)window;
            Display = API.DefaultDisplay;
            XVisualInfo info = currentWindow.VisualInfo;
            Mode = GetGraphicsMode( info );
            // Cannot pass a Property by reference.
            ContextHandle = Glx.glXCreateContext(Display, ref info, IntPtr.Zero, true);

            if (ContextHandle == IntPtr.Zero) {
                Debug.Print("failed. Trying indirect... ");
                ContextHandle = Glx.glXCreateContext(Display, ref info, IntPtr.Zero, false);
            }

            if (ContextHandle != IntPtr.Zero)
                Debug.Print("Context created (id: {0}).", ContextHandle);
            else
                throw new GraphicsContextException("Failed to create OpenGL context. Glx.CreateContext call returned 0.");

            if (!Glx.glXIsDirect(Display, ContextHandle))
                Debug.Print("Warning: Context is not direct.");
        }
示例#21
0
        public SDL2GLNative(int x, int y, int width, int height, string title,
            GraphicsMode mode,GameWindowFlags options, DisplayDevice device)
            : this()
        {
            if (width <= 0)
                throw new ArgumentOutOfRangeException("width", "Must be higher than zero.");
            if (height <= 0)
                throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");


            Debug.Indent();

			IntPtr windowId;
			desiredSizeX = width;
			desiredSizeY = height;
			isFullscreen = options.HasFlag(GameWindowFlags.Fullscreen);
			if (isFullscreen)
			{
				FixupFullscreenRes(width,height,out width, out height);
			}
			lock (API.sdl_api_lock) {
				API.Init (API.INIT_VIDEO);
				API.VideoInit("",0);
				// NOTE: Seriously, letting the user set x and y coords is a _bad_ idea. We'll let the WM take care of it.
				windowId = API.CreateWindow(title, 0x1FFF0000, 0x1FFF0000, width, height, API.WindowFlags.OpenGL | ((isFullscreen)?API.WindowFlags.Fullscreen:0));
			}
			window = new SDL2WindowInfo(windowId);

			inputDriver = new SDL2Input(window);
            Debug.Unindent();

        }
        public GraphicsMode SelectGraphicsMode(GraphicsMode desired_mode, out IntPtr visual, out IntPtr fbconfig)
        {
            GraphicsMode gfx;
            GraphicsMode mode = new GraphicsMode(desired_mode);
            visual = IntPtr.Zero;
            fbconfig = IntPtr.Zero;
            IntPtr display = API.DefaultDisplay;

            do
            {
                // Try to select a visual using Glx.ChooseFBConfig and Glx.GetVisualFromFBConfig.
                // This is only supported on GLX 1.3 - if it fails, fall back to Glx.ChooseVisual.
                fbconfig = SelectFBConfig(mode);
                if (fbconfig != IntPtr.Zero)
                    visual = Glx.GetVisualFromFBConfig(display, fbconfig);
                
                if (visual == IntPtr.Zero)
                    visual = SelectVisual(mode);
                
                if (visual == IntPtr.Zero)
                {
                    // Relax parameters and retry
                    if (!Utilities.RelaxGraphicsMode(ref mode))
                        throw new GraphicsModeException("Requested GraphicsMode not available.");
                }
            }
            while (visual == IntPtr.Zero);

            XVisualInfo info = (XVisualInfo)Marshal.PtrToStructure(visual, typeof(XVisualInfo));
            gfx = CreateGraphicsMode(display, ref info);
            return gfx;
        }
示例#23
0
 public static IGraphicsContext CreateGraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
 {
     GraphicsContext graphicsContext = new GraphicsContext(mode, window, major, minor, flags);
       graphicsContext.MakeCurrent(window);
       graphicsContext.LoadAll();
       return (IGraphicsContext) graphicsContext;
 }
示例#24
0
        public GameCanvas(int width, int height, GraphicsMode context, string title)
            : base(width, height, context, title)
        {
            m_StaticBody.BodyType = BodyType.Static;

            ThisCanvas = this;
        }
		private GraphicsMode GetDefaultGraphicsMode()
		{
			int[] aaLevels = new int[] { 0, 2, 4, 6, 8, 16 };
			HashSet<GraphicsMode> availGraphicsModes = new HashSet<GraphicsMode>(new GraphicsModeComparer());
			foreach (int samplecount in aaLevels)
			{
				GraphicsMode mode = new GraphicsMode(32, 24, 0, samplecount, new OpenTK.Graphics.ColorFormat(0), 2, false);
				if (!availGraphicsModes.Contains(mode)) availGraphicsModes.Add(mode);
			}
			int highestAALevel = MathF.RoundToInt(MathF.Log(MathF.Max(availGraphicsModes.Max(m => m.Samples), 1.0f), 2.0f));
			int targetAALevel = highestAALevel;
			if (DualityApp.AppData.MultisampleBackBuffer)
			{
				switch (DualityApp.UserData.AntialiasingQuality)
				{
					case AAQuality.High:	targetAALevel = highestAALevel;		break;
					case AAQuality.Medium:	targetAALevel = highestAALevel / 2; break;
					case AAQuality.Low:		targetAALevel = highestAALevel / 4; break;
					case AAQuality.Off:		targetAALevel = 0;					break;
				}
			}
			else
			{
				targetAALevel = 0;
			}
			int targetSampleCount = MathF.RoundToInt(MathF.Pow(2.0f, targetAALevel));
			return availGraphicsModes.LastOrDefault(m => m.Samples <= targetSampleCount) ?? availGraphicsModes.Last();
		}
 public BasicDemo(GraphicsMode mode)
     : base(800, 600,
     mode, "BulletSharp OpenTK Demo")
 {
     VSync = VSyncMode.Off;
     physics = new Physics();
 }
示例#27
0
        int swap_interval = 1; // Default interval is defined as 1 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;

            // Select an EGLConfig that matches the desired mode. We cannot use the 'mode'
            // parameter directly, since it may have originated on a different system (e.g. GLX)
            // and it may not support the desired renderer.
            Mode = new EglGraphicsMode().SelectGraphicsMode(mode.ColorFormat,
                mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat,
                mode.Buffers, mode.Stereo,
                major > 1 ? RenderableFlags.ES2 : RenderableFlags.ES);
            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[] { Egl.CONTEXT_CLIENT_VERSION, major, Egl.NONE };
            HandleAsEGLContext = Egl.CreateContext(window.Display, config, shared != null ? shared.HandleAsEGLContext : IntPtr.Zero, attrib_list);

            MakeCurrent(window);
        }
示例#28
0
        internal X11GLControl(GraphicsMode mode, Control control)
        {
            if (mode == null)
                throw new ArgumentNullException("mode");
            if (control == null)
                throw new ArgumentNullException("control");
            if (!mode.Index.HasValue)
                throw new GraphicsModeException("Invalid or unsupported GraphicsMode.");

            this.mode = mode;

            // Use reflection to retrieve the necessary values from Mono's Windows.Forms implementation.
            Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
            if (xplatui == null) throw new PlatformNotSupportedException(
                    "System.Windows.Forms.XplatUIX11 missing. Unsupported platform or Mono runtime version, aborting.");

            // get the required handles from the X11 API.
            display = (IntPtr)GetStaticFieldValue(xplatui, "DisplayHandle");
            IntPtr rootWindow = (IntPtr)GetStaticFieldValue(xplatui, "RootWindow");
            int screen = (int)GetStaticFieldValue(xplatui, "ScreenNo");

            // get the XVisualInfo for this GraphicsMode
            XVisualInfo info = new XVisualInfo();
            info.VisualID = mode.Index.Value;
            int dummy;
            IntPtr infoPtr = XGetVisualInfo(display, 1 /* VisualInfoMask.ID */, ref info, out dummy);
            info = (XVisualInfo)Marshal.PtrToStructure(infoPtr, typeof(XVisualInfo));

            // set the X11 colormap.
            SetStaticFieldValue(xplatui, "CustomVisual", info.Visual);
            SetStaticFieldValue(xplatui, "CustomColormap", XCreateColormap(display, rootWindow, info.Visual, 0));

            window_info = Utilities.CreateX11WindowInfo(display, screen, control.Handle, rootWindow, infoPtr);
        }
示例#29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameContext" /> class.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="requestedWidth">Width of the requested.</param>
        /// <param name="requestedHeight">Height of the requested.</param>
        public GameContext(OpenTK.GameWindow control, int requestedWidth = 0, int requestedHeight = 0)
        {
            var creationFlags = GraphicsContextFlags.Default;
#if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
            creationFlags |= GraphicsContextFlags.Embedded;
#endif

            if (requestedWidth == 0 || requestedHeight == 0)
            {
                requestedWidth = 1280;
                requestedHeight = 720;
            }

            // force the stencil buffer to be not null.
            var defaultMode = GraphicsMode.Default;
            var graphicMode = new GraphicsMode(defaultMode.ColorFormat, defaultMode.Depth, 8, defaultMode.Samples, defaultMode.AccumulatorFormat, defaultMode.Buffers, defaultMode.Stereo);
            
            GraphicsContext.ShareContexts = true;

            if (control == null)
            {
                int versionMajor, versionMinor;
                if (RequestedGraphicsProfile == null || RequestedGraphicsProfile.Length == 0)
                {
#if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES
                    versionMajor = 3;
                    versionMinor = 0;
#else
                    // PC: 4.3 is commonly available (= compute shaders)
                    // MacOS X: 4.1 maximum
                    versionMajor = 4;
                    versionMinor = 1;
#endif
                    Control = TryGameWindow(requestedWidth, requestedHeight, graphicMode, versionMajor, versionMinor, creationFlags);
                }
                else
                {
                    foreach (var profile in RequestedGraphicsProfile)
                    {
                        OpenGLUtils.GetGLVersion(profile, out versionMajor, out versionMinor);
                        var gameWindow = TryGameWindow(requestedWidth, requestedHeight, graphicMode, versionMajor, versionMinor, creationFlags);
                        if (gameWindow != null)
                        {
                            Control = gameWindow;
                            break;
                        }
                    }
                }
            }
            else
                Control = control;

            if (Control == null)
                throw new Exception("Unable to initialize graphics context.");

            RequestedWidth = requestedWidth;
            RequestedHeight = requestedHeight;
            ContextType = AppContextType.DesktopOpenTK;
        }
        public LinuxNativeWindow(IntPtr display, IntPtr gbm, int fd,
            int x, int y, int width, int height, string title,
            GraphicsMode mode, GameWindowFlags options,
            DisplayDevice display_device)
        {
            Debug.Print("[KMS] Creating window on display {0:x}", display);

            Title = title;

            display_device = display_device ?? DisplayDevice.Default;
            if (display_device == null)
            {
                throw new NotSupportedException("[KMS] Driver does not currently support headless systems");
            }

            window = new LinuxWindowInfo(display, fd, gbm, display_device.Id as LinuxDisplay);

            // Note: we only support fullscreen windows on KMS.
            // We implicitly override the requested width and height
            // by the width and height of the DisplayDevice, if any.
            width = display_device.Width;
            height = display_device.Height;
            bounds = new Rectangle(0, 0, width, height);
            client_size = bounds.Size;

            if (!mode.Index.HasValue)
            {
                mode = new EglGraphicsMode().SelectGraphicsMode(window, mode, 0);
            }
            Debug.Print("[KMS] Selected EGL mode {0}", mode);

            SurfaceFormat format = GetSurfaceFormat(display, mode);
            SurfaceFlags usage = SurfaceFlags.Rendering | SurfaceFlags.Scanout;
            if (!Gbm.IsFormatSupported(gbm, format, usage))
            {
                Debug.Print("[KMS] Failed to find suitable surface format, using XRGB8888");
                format = SurfaceFormat.XRGB8888;
            }

            Debug.Print("[KMS] Creating GBM surface on {0:x} with {1}x{2} {3} [{4}]",
                gbm, width, height, format, usage);
            IntPtr gbm_surface =  Gbm.CreateSurface(gbm,
                    width, height, format, usage);
            if (gbm_surface == IntPtr.Zero)
            {
                throw new NotSupportedException("[KMS] Failed to create GBM surface for rendering");
            }

            window.Handle = gbm_surface;
                Debug.Print("[KMS] Created GBM surface {0:x}", window.Handle);

            window.CreateWindowSurface(mode.Index.Value);
            Debug.Print("[KMS] Created EGL surface {0:x}", window.Surface);

            cursor_default = CreateCursor(gbm, Cursors.Default);
            cursor_empty = CreateCursor(gbm, Cursors.Empty);
            Cursor = MouseCursor.Default;
            exists = true;
        }
示例#31
0
        public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil, int samples, ColorFormat accum,
                                               int buffers, bool stereo)
        {
            GraphicsMode gfx;
            // The actual GraphicsMode that will be selected.
            IntPtr visual = IntPtr.Zero;
            IntPtr display = API.DefaultDisplay;

            do
            {
                // Try to select a visual using Glx.ChooseFBConfig and Glx.GetVisualFromFBConfig.
                // This is only supported on GLX 1.3 - if it fails, fall back to Glx.ChooseVisual.
                visual = SelectVisualUsingFBConfig(color, depth, stencil, samples, accum, buffers, stereo);
                
                if (visual == IntPtr.Zero)
                    visual = SelectVisualUsingChooseVisual(color, depth, stencil, samples, accum, buffers, stereo);
                
                if (visual == IntPtr.Zero)
                {
                    // Relax parameters and retry
                    if (!Utilities.RelaxGraphicsMode(ref color, ref depth, ref stencil, ref samples, ref accum, ref buffers, ref stereo))
                        throw new GraphicsModeException("Requested GraphicsMode not available.");
                }
            }
            while (visual == IntPtr.Zero);

            XVisualInfo info = (XVisualInfo)Marshal.PtrToStructure(visual, typeof(XVisualInfo));

            // See what we *really* got:
            int r, g, b, a;
            Glx.GetConfig(display, ref info, GLXAttribute.ALPHA_SIZE, out a);
            Glx.GetConfig(display, ref info, GLXAttribute.RED_SIZE, out r);
            Glx.GetConfig(display, ref info, GLXAttribute.GREEN_SIZE, out g);
            Glx.GetConfig(display, ref info, GLXAttribute.BLUE_SIZE, out b);
            int ar, ag, ab, aa;
            Glx.GetConfig(display, ref info, GLXAttribute.ACCUM_ALPHA_SIZE, out aa);
            Glx.GetConfig(display, ref info, GLXAttribute.ACCUM_RED_SIZE, out ar);
            Glx.GetConfig(display, ref info, GLXAttribute.ACCUM_GREEN_SIZE, out ag);
            Glx.GetConfig(display, ref info, GLXAttribute.ACCUM_BLUE_SIZE, out ab);
            Glx.GetConfig(display, ref info, GLXAttribute.DEPTH_SIZE, out depth);
            Glx.GetConfig(display, ref info, GLXAttribute.STENCIL_SIZE, out stencil);
            Glx.GetConfig(display, ref info, GLXAttribute.SAMPLES, out samples);
            Glx.GetConfig(display, ref info, GLXAttribute.DOUBLEBUFFER, out buffers);
            ++buffers;
            // the above lines returns 0 - false and 1 - true.
            int st;
            Glx.GetConfig(display, ref info, GLXAttribute.STEREO, out st);
            stereo = st != 0;
            
            gfx = new GraphicsMode(info.VisualID, new ColorFormat(r, g, b, a), depth, stencil, samples,
            new ColorFormat(ar, ag, ab, aa), buffers, stereo);
            
            using (new XLock(display))
            {
                Functions.XFree(visual);
            }
            
            return gfx;
        }
示例#32
0
        public MyEglWin(IntPtr hwnd, IntPtr eglDisplay, int major, int minor,
                        OpenTK.Graphics.GraphicsMode mode, GraphicsContextFlags flags)
        {
            Hwnd        = hwnd;
            _eglDisplay = eglDisplay;

            _egl_win       = new OpenTK.Platform.Egl.EglWindowInfo(hwnd, _eglDisplay);
            _eglWinContext = new EglWinContext(mode, _egl_win, null, major, minor, flags);
        }
示例#33
0
        public TestSync()
        {
            InitializeComponent();
            var mode = new OpenTK.Graphics.GraphicsMode(32, 24, 8, 0, 0, 2, false);     // combined 32 max of depth/stencil

            glwfc = new GLOFC.WinForm.GLWinFormControl(glControlContainer, mode);

            systemtimer.Interval = 25;
            systemtimer.Tick    += new EventHandler(SystemTick);
            systemtimer.Start();
        }
示例#34
0
    /// <summary>
    /// Entry point of this application
    /// </summary>
    public static void Main()
    {
        // Print some help info
        Console.WriteLine("\n--------------------------------------------------------------");
        Console.WriteLine("Texture Mapping with OpenGL and DotNet");

        OpenTK.Graphics.GraphicsMode mode =
            new OpenTK.Graphics.GraphicsMode(32, // bits color buffer
                                             24, // bits depth buffer
                                             0,  // bits stencil buffer
                                             4); // No. of sample for AA

        TextureMapping_Net app = new TextureMapping_Net(640, 480, mode, "OpenGL Texture Mapping (.NET)");

        app.Run(30.0, 0.0);
    }
示例#35
0
        static void Main(string[] args)
        {
            ContextSettings contextSettings = new ContextSettings(24, 0, 0);
            var             window          = new RenderWindow(new SFML.Window.VideoMode(640, 480), "ImGui + SFML + .Net = <3", Styles.Default, contextSettings);

            OpenTK.Graphics.GraphicsMode graphicsMode = new OpenTK.Graphics.GraphicsMode(32, (int)contextSettings.DepthBits, (int)contextSettings.StencilBits, (int)contextSettings.AntialiasingLevel);
            OpenTK.Platform.IWindowInfo  windowInfo   = OpenTK.Platform.Utilities.CreateWindowsWindowInfo(window.SystemHandle);

            OpenTK.Graphics.GraphicsContext context = new OpenTK.Graphics.GraphicsContext(graphicsMode, windowInfo);
            context.MakeCurrent(windowInfo);
            context.LoadAll();


            window.SetFramerateLimit(60);
            ImGuiSfml.Init(window);

            window.Closed += (s, e) => window.Close();

            CircleShape shape = new CircleShape(100);

            shape.FillColor = Color.Green;

            Clock deltaClock = new Clock();

            while (window.IsOpen)
            {
                window.DispatchEvents();

                ImGuiSfml.Update(window, deltaClock.Restart());

                ImGui.ShowDemoWindow();
                //ImGui.ShowTestWindow();

                /*
                 * ImGui.Begin("Hello, world!");
                 * ImGui.Button("Look at this pretty button");
                 * ImGui.End();
                 */

                window.Clear();
                window.Draw(shape);
                ImGuiSfml.Render(window);
                window.Display();
            }
        }
示例#36
0
        /*
         * Textures found at:
         * http://www.solarsystemscope.com/nexus/textures/planet_textures/
         */
        public RenderWindow(int width, int height, OpenTK.Graphics.GraphicsMode mode, string title)
            : base(width, height, mode, title)
        {
            physController  = new PhysicsController();
            camController   = new CameraController(new double[] { 0, 0.0f, -5000000 });
            graphController = new GraphicsController();
            graphController.ReadObjFile("sphere.obj");

            int[] newTextureIds = new int[11];
            newTextureIds[0] = graphController.LoadTexture("Textures/texture_sun.jpg");
            newTextureIds[1] = graphController.LoadTexture("Textures/texture_mercury.jpg");
            newTextureIds[2] = graphController.LoadTexture("Textures/texture_venus_atmosphere.jpg");
            newTextureIds[3] = graphController.LoadTexture("Textures/texture_earth_surface.jpg");
            newTextureIds[4] = graphController.LoadTexture("Textures/texture_mars.jpg");
            newTextureIds[5] = graphController.LoadTexture("Textures/texture_jupiter.jpg");
            newTextureIds[6] = graphController.LoadTexture("Textures/texture_saturn.jpg");
            newTextureIds[7] = graphController.LoadTexture("Textures/texture_uranus.jpg");
            newTextureIds[8] = graphController.LoadTexture("Textures/texture_neptune.jpg");
            newTextureIds[9] = graphController.LoadTexture("Textures/texture_moon.jpg");

            newTextureIds[10] = graphController.LoadTexture("Textures/texture_skybox.jpg");
            textureIds        = newTextureIds;
        }
示例#37
0
        /// <summary>
        /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags,  and attaches it to the specified window.
        /// </summary>
        /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GraphicsContext.</param>
        /// <param name="window">The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.</param>
        /// <param name="major">The major version of the new GraphicsContext.</param>
        /// <param name="minor">The minor version of the new GraphicsContext.</param>
        /// <param name="flags">The GraphicsContextFlags for the GraphicsContext.</param>
        /// <remarks>
        /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
        /// </remarks>
        public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
        {
            bool designMode = false;

            if (mode == null && window == null)
            {
                designMode = true;
            }
            else if (mode == null)
            {
                throw new ArgumentNullException("mode", "Must be a valid GraphicsMode.");
            }
            else if (window == null)
            {
                throw new ArgumentNullException("window", "Must point to a valid window.");
            }

            // Silently ignore invalid major and minor versions.
            if (major <= 0)
            {
                major = 1;
            }
            if (minor < 0)
            {
                minor = 0;
            }

            Debug.Print("Creating GraphicsContext.");
            try
            {
                Debug.Indent();
                Debug.Print("GraphicsMode: {0}", mode);
                Debug.Print("IWindowInfo: {0}", window);
                Debug.Print("GraphicsContextFlags: {0}", flags);
                Debug.Print("Requested version: {0}.{1}", major, minor);

                IGraphicsContext shareContext = null;
                if (GraphicsContext.ShareContexts)
                {
                    lock (context_lock)
                    {
                        // A small hack to create a shared context with the first available context.
                        foreach (WeakReference r in GraphicsContext.available_contexts.Values)
                        {
                            shareContext = (IGraphicsContext)r.Target;
                            break;
                        }
                    }
                }

                // Todo: Add a DummyFactory implementing IPlatformFactory.
                if (designMode)
#if !IPHONE
                { implementation = new Platform.Dummy.DummyGLContext(); }
#else
                { implementation = Factory.Embedded.CreateGLContext(mode, window, shareContext, direct_rendering, major, minor, flags); }
#endif
                else
                {
                    switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded)
                    {
                    case false: implementation = Factory.Default.CreateGLContext(mode, window, shareContext, direct_rendering, major, minor, flags); break;

                    case true: implementation = Factory.Embedded.CreateGLContext(mode, window, shareContext, direct_rendering, major, minor, flags); break;
                    }
                }

                lock (context_lock)
                {
                    available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
                }
            }
示例#38
0
        /// <summary>
        /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags,  and attaches it to the specified window.
        /// </summary>
        /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GraphicsContext.</param>
        /// <param name="window">The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.</param>
        /// <param name="major">The major version of the new GraphicsContext.</param>
        /// <param name="minor">The minor version of the new GraphicsContext.</param>
        /// <param name="flags">The GraphicsContextFlags for the GraphicsContext.</param>
        /// <remarks>
        /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
        /// </remarks>
        public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
        {
            lock (SyncRoot)
            {
                bool designMode = false;
                if (mode == null && window == null)
                {
                    designMode = true;
                }
                else if (mode == null)
                {
                    throw new ArgumentNullException("mode", "Must be a valid GraphicsMode.");
                }
                else if (window == null)
                {
                    throw new ArgumentNullException("window", "Must point to a valid window.");
                }

                // Silently ignore invalid major and minor versions.
                if (major <= 0)
                {
                    major = 1;
                }
                if (minor < 0)
                {
                    minor = 0;
                }

                Debug.Print("Creating GraphicsContext.");
                try
                {
                    Debug.Indent();
                    Debug.Print("GraphicsMode: {0}", mode);
                    Debug.Print("IWindowInfo: {0}", window);
                    Debug.Print("GraphicsContextFlags: {0}", flags);
                    Debug.Print("Requested version: {0}.{1}", major, minor);

                    IGraphicsContext shareContext = shareContext = FindSharedContext();

                    // Todo: Add a DummyFactory implementing IPlatformFactory.
                    if (designMode)
                    {
                        implementation = new Platform.Dummy.DummyGLContext();
                    }
                    else
                    {
                        IPlatformFactory factory = null;
                        switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded)
                        {
                        case false: factory = Factory.Default; break;

                        case true: factory = Factory.Embedded; break;
                        }

                        implementation = factory.CreateGLContext(mode, window, shareContext, direct_rendering, major, minor, flags);
                        // Note: this approach does not allow us to mix native and EGL contexts in the same process.
                        // This should not be a problem, as this use-case is not interesting for regular applications.
                        // Note 2: some platforms may not support a direct way of getting the current context
                        // (this happens e.g. with DummyGLContext). In that case, we use a slow fallback which
                        // iterates through all known contexts and checks if any is current (check GetCurrentContext
                        // declaration).
                        if (GetCurrentContext == null)
                        {
                            GetCurrentContextDelegate temp = factory.CreateGetCurrentGraphicsContext();
                            if (temp != null)
                            {
                                GetCurrentContext = temp;
                            }
                        }
                    }

                    available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
                }
                finally
                {
                    Debug.Unindent();
                }
            }
        }
示例#39
0
 public GameWindowNative(int width, int height, OpenTK.Graphics.GraphicsMode mode, GameWindowFlags flags, int openGlMajor, int openGlMinor) : base(width, height, mode, "Server Context", flags, DisplayDevice.Default, openGlMajor, openGlMinor, OpenTK.Graphics.GraphicsContextFlags.Default)
 {
 }
        /// <summary>
        /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags, and attaches it to the
        /// specified window. A dummy context will be created if both
        /// the handle and the window are null.
        /// </summary>
        /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GraphicsContext.</param>
        /// <param name="window">The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.</param>
        /// <param name="shareContext">The GraphicsContext to share resources with, or null for explicit non-sharing.</param>
        /// <param name="major">The major version of the new GraphicsContext.</param>
        /// <param name="minor">The minor version of the new GraphicsContext.</param>
        /// <param name="flags">The GraphicsContextFlags for the GraphicsContext.</param>
        /// <remarks>
        /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
        /// </remarks>
        public GraphicsContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, int major,
                               int minor, GraphicsContextFlags flags)
        {
            lock (SyncRoot)
            {
                var designMode = false;
                if (mode == null && window == null)
                {
                    designMode = true;
                }
                else if (mode == null)
                {
                    throw new ArgumentNullException(nameof(mode), "Must be a valid GraphicsMode.");
                }
                else if (window == null)
                {
                    throw new ArgumentNullException(nameof(window), "Must point to a valid window.");
                }

                // Silently ignore invalid major and minor versions.
                if (major <= 0)
                {
                    major = 1;
                }

                if (minor < 0)
                {
                    minor = 0;
                }

                // Angle needs an embedded context
                const GraphicsContextFlags useAngleFlag = GraphicsContextFlags.Angle
                                                          | GraphicsContextFlags.AngleD3D9
                                                          | GraphicsContextFlags.AngleD3D11
                                                          | GraphicsContextFlags.AngleOpenGL;
                var useAngle = false;
                if ((flags & useAngleFlag) != 0)
                {
                    flags   |= GraphicsContextFlags.Embedded;
                    useAngle = true;
                }

                Debug.Print("Creating GraphicsContext.");
                try
                {
                    Debug.Indent();
                    Debug.Print("GraphicsMode: {0}", mode);
                    Debug.Print("IWindowInfo: {0}", window);
                    Debug.Print("GraphicsContextFlags: {0}", flags);
                    Debug.Print("Requested version: {0}.{1}", major, minor);

                    // Todo: Add a DummyFactory implementing IPlatformFactory.
                    if (designMode)
                    {
                        implementation = new DummyGLContext();
                    }
                    else
                    {
                        IPlatformFactory factory = null;
                        switch ((flags & GraphicsContextFlags.Embedded) == GraphicsContextFlags.Embedded)
                        {
                        case false:
                            factory = Factory.Default;
                            break;

                        case true:
                            factory = useAngle ? Factory.Angle : Factory.Embedded;
                            break;
                        }

                        // Note: this approach does not allow us to mix native and EGL contexts in the same process.
                        // This should not be a problem, as this use-case is not interesting for regular applications.
                        // Note 2: some platforms may not support a direct way of getting the current context
                        // (this happens e.g. with DummyGLContext). In that case, we use a slow fallback which
                        // iterates through all known contexts and checks if any is current (check GetCurrentContext
                        // declaration).
                        if (GetCurrentContext == null)
                        {
                            GetCurrentContext = factory.CreateGetCurrentGraphicsContext();
                        }

                        implementation = factory.CreateGLContext(mode, window, shareContext, DirectRendering, major,
                                                                 minor, flags);
                        handle_cached = ((IGraphicsContextInternal)implementation).Context;
                        factory.RegisterResource(this);
                    }

                    AddContext(this);
                }
                finally
                {
                    Debug.Unindent();
                }
            }
        }
 /// <summary>
 /// Constructs a new GraphicsContext with the specified GraphicsMode and attaches it to the specified window.
 /// </summary>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GraphicsContext.</param>
 /// <param name="window">The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.</param>
 public GraphicsContext(GraphicsMode mode, IWindowInfo window)
     : this(mode, window, 1, 0, GraphicsContextFlags.Default)
 {
 }
 /// <summary>
 /// Constructs a new GraphicsContext with the specified GraphicsMode, version and flags,  and attaches it to the
 /// specified window.
 /// </summary>
 /// <param name="mode">The OpenTK.Graphics.GraphicsMode of the GraphicsContext.</param>
 /// <param name="window">The OpenTK.Platform.IWindowInfo to attach the GraphicsContext to.</param>
 /// <param name="major">The major version of the new GraphicsContext.</param>
 /// <param name="minor">The minor version of the new GraphicsContext.</param>
 /// <param name="flags">The GraphicsContextFlags for the GraphicsContext.</param>
 /// <remarks>
 /// Different hardware supports different flags, major and minor versions. Invalid parameters will be silently ignored.
 /// </remarks>
 public GraphicsContext(GraphicsMode mode, IWindowInfo window, int major, int minor, GraphicsContextFlags flags)
     : this(mode, window, FindSharedContext(), major, minor, flags)
 {
 }
示例#43
0
 internal GraphicsMode(GraphicsMode mode)
     : this(mode.ColorFormat, mode.Depth, mode.Stencil, mode.Samples, mode.AccumulatorFormat, mode.Buffers, mode.Stereo)
 {
 }
示例#44
0
 public EditorProgram(int w, int h, GRFX.GraphicsMode mode)
     : base(w, h, mode)
 {
 }