当前位置: 首页>>代码示例>>C#>>正文


C# Graphics.GraphicsMode类代码示例

本文整理汇总了C#中OpenTK.Graphics.GraphicsMode的典型用法代码示例。如果您正苦于以下问题:C# GraphicsMode类的具体用法?C# GraphicsMode怎么用?C# GraphicsMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GraphicsMode类属于OpenTK.Graphics命名空间,在下文中一共展示了GraphicsMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 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);
 }
开发者ID:Azzi777,项目名称:Umbra-Voxel-Engine,代码行数:7,代码来源:Main.cs

示例2: GameCanvas

        public GameCanvas(int width, int height, GraphicsMode context, string title)
            : base(width, height, context, title)
        {
            m_StaticBody.BodyType = BodyType.Static;

            ThisCanvas = this;
        }
开发者ID:Evar678,项目名称:SFBA,代码行数:7,代码来源:GameCanvas.cs

示例3: Evaluate

		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]);
				}
			}
		}
开发者ID:elliotwoods,项目名称:VVVV.Nodes.GL,代码行数:26,代码来源:GraphicsModeJoinNode.cs

示例4: CreateFrameBuffer

        // 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");
        }
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:38,代码来源:AGSGameView.cs

示例5: GetDefaultGraphicsMode

		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();
		}
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:28,代码来源:NativeEditorGraphicsContext.cs

示例6: X11GLContext

        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.");
        }
开发者ID:Chameleonherman,项目名称:ClassicalSharp,代码行数:28,代码来源:X11GLContext.cs

示例7: CreateGLContext

 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);
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:EglWinPlatformFactory.cs

示例8: Game

        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);
        }
开发者ID:Killnetic,项目名称:OpenTK_Base_GL,代码行数:30,代码来源:Game.cs

示例9: SDL2GLNative

        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();

        }
开发者ID:sulix,项目名称:opentk-sdl2,代码行数:32,代码来源:SDL2GLNative.cs

示例10: OpenGLWriteableBitmapUpdater

        /// <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();
                });
        }
开发者ID:yk35,项目名称:WpfOpenGLBitmap,代码行数:34,代码来源:OpenGLWriteableBitmapUpdater.cs

示例11: Run

        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();
        }
开发者ID:zhouyige,项目名称:OpenGLDeferredRendering,代码行数:32,代码来源:Program.cs

示例12: EglContext

 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);
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:27,代码来源:EglContext.cs

示例13: CreateGraphicsContext

 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;
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:7,代码来源:Utilities.cs

示例14: CanvasForm

        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);
        }
开发者ID:noshbar,项目名称:TISFAT-Zero,代码行数:30,代码来源:CanvasForm.cs

示例15: NativeWindowProvider

        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;
        }
开发者ID:johang88,项目名称:triton,代码行数:7,代码来源:NativeWindowProvider.cs


注:本文中的OpenTK.Graphics.GraphicsMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。