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


C# GLControl.BringToFront方法代码示例

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


在下文中一共展示了GLControl.BringToFront方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupGLControl

        public void SetupGLControl()
        {
            RenderingEnabled = false;

            if (glControl != null)
            {
                glControl.Dispose();
            }

            glControl = null;

            GLMode = null;

            try
            {
                GLMode = new OpenTK.Graphics.GraphicsMode(OpenTK.DisplayDevice.Default.BitsPerPixel, 24, 8, 4);
            }
            catch
            {
                GLMode = null;
            }

            try
            {
                if (GLMode == null)
                {
                    // Try default mode
                    glControl = new OpenTK.GLControl();
                }
                else
                {
                    glControl = new OpenTK.GLControl(GLMode);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.Message, Helpers.LogLevel.Warning, client);
                glControl = null;
            }

            if (glControl == null)
            {
                Logger.Log("Failed to initialize OpenGL control, cannot continue", Helpers.LogLevel.Error, client);
                return;
            }

            Logger.Log("Initializing OpenGL mode: " + GLMode.ToString(), Helpers.LogLevel.Info);

            glControl.Paint += glControl_Paint;
            glControl.Resize += glControl_Resize;
            glControl.MouseDown += glControl_MouseDown;
            glControl.MouseUp += glControl_MouseUp;
            glControl.MouseMove += glControl_MouseMove;
            glControl.MouseWheel += glControl_MouseWheel;
            glControl.Load += new EventHandler(glControl_Load);
            glControl.Disposed += new EventHandler(glControl_Disposed);
            glControl.Click += new EventHandler(glControl_Click);
            glControl.BackColor = clearcolour;

            glControl.Dock = DockStyle.Fill;
            glControl.TabIndex = 0;

            Controls.Add(glControl);

            glControl.BringToFront();
            glControl.Focus();
        }
开发者ID:NullProjects,项目名称:METAbolt,代码行数:67,代码来源:META3D.cs

示例2: Initialize

        public void Initialize(Language language)
        {
            // tools
            DodgeBurnOptions = new DodgeBurnOptions();
            DarkenLightenOptions = new DarkenLightenOptions();
            PencilOptions = new PencilOptions();
            FloodFillOptions = new FloodFillOptions();
            NoiseOptions = new NoiseOptions();
            EraserOptions = new EraserOptions();
            StampOptions = new StampOptions();

            _tools.Add(new ToolIndex(new CameraTool(), null, "T_TOOL_CAMERA", Resources.eye__1_, Keys.C));
            _tools.Add(new ToolIndex(new PencilTool(), PencilOptions, "T_TOOL_PENCIL", Resources.pen, Keys.P));
            _tools.Add(new ToolIndex(new EraserTool(), EraserOptions, "T_TOOL_ERASER", Resources.erase, Keys.E));
            _tools.Add(new ToolIndex(new DropperTool(), null, "T_TOOL_DROPPER", Resources.pipette, Keys.D));
            _tools.Add(new ToolIndex(new DodgeBurnTool(), DodgeBurnOptions, "T_TOOL_DODGEBURN", Resources.dodge, Keys.B));
            _tools.Add(new ToolIndex(new DarkenLightenTool(), DarkenLightenOptions, "T_TOOL_DARKENLIGHTEN", Resources.darkenlighten, Keys.L));
            _tools.Add(new ToolIndex(new FloodFillTool(), FloodFillOptions, "T_TOOL_BUCKET", Resources.fill_bucket, Keys.F));
            _tools.Add(new ToolIndex(new NoiseTool(), NoiseOptions, "T_TOOL_NOISE", Resources.noise, Keys.N));
            _tools.Add(new ToolIndex(new StampTool(), StampOptions, "T_TOOL_STAMP", Resources.stamp_pattern, Keys.M));

            for (int i = _tools.Count - 1; i >= 0; --i)
            {
                toolToolStripMenuItem.DropDownItems.Insert(0, _tools[i].MenuItem);
                _tools[i].MenuItem.Click += ToolMenuItemClicked;
                toolStrip1.Items.Insert(toolStrip1.Items.IndexOf(toolStripSeparator1) + 1, _tools[i].Button);
                _tools[i].Button.Click += ToolMenuItemClicked;

                languageProvider1.SetPropertyNames(_tools[i].MenuItem, "Text");
                languageProvider1.SetPropertyNames(_tools[i].Button, "Text");
            }

            // Shortcuts
            InitShortcuts();
            LoadShortcutKeys(GlobalSettings.ShortcutKeys);
            _shortcutEditor.ShortcutExists += _shortcutEditor_ShortcutExists;

            Editor.CurrentLanguage = language;
            SetSelectedTool(_tools[0]);

            Brushes.LoadBrushes();

            foreach (string x in GlobalSettings.SkinDirectories)
                Directory.CreateDirectory(MacroHandler.ReplaceMacros(x));

            // set up the GL control
            var mode = new GraphicsMode();

            reset:

            Renderer =
                new GLControl(new GraphicsMode(mode.ColorFormat, mode.Depth, mode.Stencil, GlobalSettings.Multisamples));

            if (Renderer.Context == null)
            {
                mode = new GraphicsMode();
                goto reset;
            }

            Renderer.BackColor = Color.Black;
            Renderer.Dock = DockStyle.Fill;
            Renderer.Location = new Point(0, 25);
            Renderer.Name = "rendererControl";
            Renderer.Size = new Size(641, 580);
            Renderer.TabIndex = 4;

            splitContainer4.Panel2.Controls.Add(Renderer);
            Renderer.BringToFront();

            GLVendor = GL.GetString(StringName.Vendor);
            GLVersion = GL.GetString(StringName.Version);
            GLRenderer = GL.GetString(StringName.Renderer);
            GLExtensions = GL.GetString(StringName.Extensions);

            InitGL();

            Renderer.Paint += rendererControl_Paint;
            Renderer.MouseDown += rendererControl_MouseDown;
            Renderer.MouseMove += rendererControl_MouseMove;
            Renderer.MouseUp += rendererControl_MouseUp;
            Renderer.MouseLeave += rendererControl_MouseLeave;
            Renderer.Resize += rendererControl_Resize;
            Renderer.MouseWheel += rendererControl_MouseWheel;
            Renderer.MouseEnter += rendererControl_MouseEnter;

            #if NO
            if (!GlobalSettings.Loaded)
                MessageBox.Show(this, GetLanguageString("C_SETTINGSFAILED"));
            #endif

            _undoListBox = new UndoRedoPanel();
            _undoListBox.ActionString = "L_UNDOACTIONS";
            languageProvider1.SetPropertyNames(_undoListBox, "ActionString");

            _undoListBox.ListBox.MouseClick += UndoListBox_MouseClick;

            undoToolStripButton.DropDown = new Popup(_undoListBox);
            undoToolStripButton.DropDownOpening += undoToolStripButton_DropDownOpening;

            _redoListBox = new UndoRedoPanel();
//.........这里部分代码省略.........
开发者ID:rmbzlib,项目名称:mcskin3d,代码行数:101,代码来源:Editor.cs

示例3: Reset

 public void Reset()
 {
     if (glControl != null)
     {
         Destroy();
     }
     scaledScreen = new uint[imageScaler.ResizedX * imageScaler.ResizedY];
     glControl = new GLControl(new GraphicsMode());
     glControl.Location = Point.Empty;
     glControl.Size = renderTarget.Size;
     glControl.Visible = true;
     glControl.TabStop = false;
     glControl.Enabled = false;
     renderTarget.Controls.Add(glControl);
     renderTarget.FindForm().Show(); //Need this in here when running a rom from double click, may cause problems elsewhere?
     glControl.VSync = false;
     glControl.BringToFront();
     GL.ClearColor(Color.Black);
     GL.MatrixMode(MatrixMode.Projection);
     GL.LoadIdentity();
     GL.Ortho(0, renderTarget.Width, renderTarget.Height, 0, -1, 1); // Bottom-left corner pixel has coordinate (0, 0)
     GL.Viewport(0, 0, renderTarget.Width, renderTarget.Height); // Use all of the glControl painting area
     GL.Enable(EnableCap.Texture2D);
     GL.Enable(EnableCap.Blend);
     GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
     GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1);
     textureName = GL.GenTexture();
     GL.BindTexture(TextureTarget.Texture2D, textureName);
     GL.TexParameterI(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, new int[] { (int)TextureWrapMode.Clamp });//Clamp to edges
     GL.TexParameterI(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, new int[] { (int)TextureWrapMode.Clamp });
     if (smoothOutput)
     {
         GL.TexParameterI(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, new int[] { (int)TextureMagFilter.Linear });
         GL.TexParameterI(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, new int[] { (int)TextureMagFilter.Linear });
     }
     else
     {
         GL.TexParameterI(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, new int[] { (int)TextureMagFilter.Nearest });
         GL.TexParameterI(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, new int[] { (int)TextureMagFilter.Nearest });
     }
     GL.TexEnv(TextureEnvTarget.TextureEnv, TextureEnvParameter.TextureEnvMode, new int[] { (int)TextureEnvMode.Modulate }); //Enables blending and lighting
     LoadCharSheet();
 }
开发者ID:nickmass,项目名称:Emu-o-Tron,代码行数:43,代码来源:OpenGLRenderer.cs


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