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


C# GLControl.Invalidate方法代码示例

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


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

示例1: HandleResize

 public static void HandleResize(GLControl glCtrl, double viewdistance)
 {
     GL.Viewport(0, 0, glCtrl.ClientSize.Width, glCtrl.ClientSize.Height);
       GL.MatrixMode(MatrixMode.Projection);
       GL.LoadIdentity();
       Glu.Perspective(45, (double)glCtrl.Width / glCtrl.Height, 0.5, viewdistance);
       glCtrl.Invalidate();
       GL.MatrixMode(MatrixMode.Modelview);
 }
开发者ID:Felixdev,项目名称:dogfight2008,代码行数:9,代码来源:GLControlUtil.cs

示例2: Initialize


//.........这里部分代码省略.........
            _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();
            _redoListBox.ActionString = "L_REDOACTIONS";
            languageProvider1.SetPropertyNames(_redoListBox, "ActionString");

            _redoListBox.ListBox.MouseClick += RedoListBox_MouseClick;

            redoToolStripButton.DropDown = new Popup(_redoListBox);
            redoToolStripButton.DropDownOpening += redoToolStripButton_DropDownOpening;

            undoToolStripButton.DropDown.AutoClose = redoToolStripButton.DropDown.AutoClose = true;

            CreatePartList();
            Renderer.Invalidate();
        }
开发者ID:rmbzlib,项目名称:mcskin3d,代码行数:101,代码来源:Editor.cs

示例3: LoadROM

        /// <summary>
        /// Defines the control that renders the game and initializes
        /// all video related objects.
        /// </summary>
        /// <param name="ctrl">A reference to the GLControl renderer.</param>
        public static void LoadROM(ref byte[] romBuffer, ref GLControl ctrl)
        {
            _control = ctrl;

            IsColorGameBoy = GBCEmulator.IsColorGameBoy;

            _vram = new byte[8192];
            _oam = new byte[160];
            Buffer.BlockCopy(romBuffer, 0x8000, _vram, 0, 8192);
            Buffer.BlockCopy(romBuffer, 0xFE00, _oam, 0, 160);

            STAT = 0;
            ModeFlag = (byte)ModeFlags.OAM;
            LYC = 0;
            SCX = 0;
            SCY = 0;
            WX = 0;
            WY = 0;

            // Graphics initialization
            _pixelBuffer = new byte[160,144,3];
            ctrl.MakeCurrent(); // Make it current for OpenGL
            GL.ClearColor(Color.White);
            ctrl.Invalidate();
        }
开发者ID:Warpten,项目名称:mzmdbg,代码行数:30,代码来源:GPU.cs

示例4: RenderTab

        public RenderTab(Mesh mesh, string filename)
        {
            tabPage = new TabPage(Path.GetFileNameWithoutExtension(filename));
            tabPage.AllowDrop = true;
            tabPage.ToolTipText = Path.GetFullPath(filename);

            glControl = new GLControl();
            glControl.Parent = tabPage;
            glControl.Dock = DockStyle.Fill;
            glControl.VSync = false;
            glControl.TabStop = false;

            // doesn't work at the moment... (OpenTK bug)
            glControl.Load += Load;

            glControl.Resize += Resize;
            glControl.Paint += Paint;

            inputHandler = new InputHandler(glControl);
            inputHandler.mouseDownListeners.Add(MouseButtons.Left, (x, y) => mouseLeftDown = true);
            inputHandler.mouseDownListeners.Add(MouseButtons.Right, (x, y) => mouseRightDown = true);
            inputHandler.mouseDownListeners.Add(MouseButtons.Middle, (x, y) => mouseMiddleDown = true);

            inputHandler.mouseUpListeners.Add(MouseButtons.Left, (x, y) => mouseLeftDown = false);
            inputHandler.mouseUpListeners.Add(MouseButtons.Right, (x, y) => mouseRightDown = false);
            inputHandler.mouseUpListeners.Add(MouseButtons.Middle, (x, y) => mouseMiddleDown = false);

            inputHandler.mouseMoved += (int x, int y) =>
            {
                if (mouseLastX != -1 && mouseLastY != -1)
                {
                    if (mouseLeftDown)
                    {
                        int moveX = x - mouseLastX;
                        int moveY = y - mouseLastY;

                        float mag = (float)Math.Sqrt(moveX * moveX + moveY * moveY) / 2f;

                        // vector (x, y) perpendicular to another vector is (y, x)
                        rotations.Add(new Rotation(-mag, -moveY, -moveX, 0));

                        glControl.Invalidate();
                    }
                }

                mouseLastX = x;
                mouseLastY = y;
            };

            inputHandler.mouseWheelMoved += (int delta) =>
            {
                scale += delta / SystemInformation.MouseWheelScrollDelta * 0.1f;

                // keep scale between 0.1 - 10
                scale = Math.Min(10f, Math.Max(0.1f, scale));

                glControl.Invalidate();
            };

            this.mesh = mesh;

            rotations = new List<Rotation>();
        }
开发者ID:dabbertorres,项目名称:ObjRenderer,代码行数:63,代码来源:RenderTab.cs


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