├── .nuke ├── .gitignore ├── parameters.json └── build.schema.json ├── publish.cmd ├── .editorconfig ├── OpenTK.GLControl.MultiControlTest ├── OpenTK.GLControl.MultiControlTest.csproj ├── Program.cs ├── Form1.resx ├── Form1.cs └── Form1.Designer.cs ├── OpenTK.GLControl.InputTest ├── OpenTK.GLControl.InputTest.csproj ├── Program.cs ├── Form1.cs ├── Form1.resx └── Form1.Designer.cs ├── OpenTK.GLControl.TestForm ├── OpenTK.GLControl.TestForm.csproj ├── Program.cs ├── Form1.resx ├── Form1.cs └── Form1.Designer.cs ├── LICENSE.md ├── OpenTK.GLControl ├── OpenTK.GLControl.csproj ├── DummyGLFWGraphicsContext.cs ├── Win32.cs ├── INativeInput.cs ├── GLControlDesignTimeRenderer.cs ├── GLControlSettings.cs └── NativeInput.cs ├── RELEASE_NOTES.md ├── OpenTK.GLControl.sln ├── README.md └── .gitignore /.nuke/.gitignore: -------------------------------------------------------------------------------- 1 | /temp -------------------------------------------------------------------------------- /.nuke/parameters.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./build.schema.json", 3 | "Solution": "OpenTK.GLControl.sln" 4 | } 5 | -------------------------------------------------------------------------------- /publish.cmd: -------------------------------------------------------------------------------- 1 | REM clean, restore, compile, pack, then publish to nuget and github 2 | cls 3 | .\build.cmd --target PublishRelease --configuration release -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root=true 2 | 3 | [*.{cs,fsx}] 4 | indent_style=space 5 | indent_size=4 6 | insert_final_newline = true 7 | trim_trailing_whitespace = true 8 | 9 | [*.{sln,spec}] 10 | indent_style=tab 11 | indent_size=4 12 | 13 | [*.{xml,sh,cmd,yml,csproj}] 14 | indent_style=space 15 | indent_size=2 16 | -------------------------------------------------------------------------------- /OpenTK.GLControl.MultiControlTest/OpenTK.GLControl.MultiControlTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /OpenTK.GLControl.InputTest/OpenTK.GLControl.InputTest.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | enable 8 | true 9 | 8.0 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /OpenTK.GLControl.TestForm/OpenTK.GLControl.TestForm.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | netcoreapp3.1 6 | true 7 | enable 8 | true 9 | 8.0 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /OpenTK.GLControl.InputTest/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace OpenTK.GLControl.InputTest 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.SetHighDpiMode(HighDpiMode.SystemAware); 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new Form1()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /OpenTK.GLControl.TestForm/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace OpenTK.GLControl.TestForm 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.SetHighDpiMode(HighDpiMode.SystemAware); 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new Form1()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /OpenTK.GLControl.MultiControlTest/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace OpenTK.GLControl.MultiControlTest 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.SetHighDpiMode(HighDpiMode.SystemAware); 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new Form1()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2006-2019 Stefanos Apostolopoulos for the Open Toolkit project. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | - The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | #### Third party licenses may be applicable. These have been disclosed in [THIRD_PARTIES.md](THIRD_PARTIES.md) 24 | -------------------------------------------------------------------------------- /OpenTK.GLControl/OpenTK.GLControl.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | true 6 | enable 7 | true 8 | 8.0 9 | 10 | Team OpenTK 11 | A WinForms control designed to wrap the OpenTK 4.x APIs. 12 | Copyright (c) 2021 Team OpenTK 13 | Team OpenTK 14 | https://github.com/opentk/GLControl 15 | https://github.com/opentk/GLControl 16 | git 17 | MIT 18 | false 19 | true 20 | OpenTK, GLControl 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Component 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /OpenTK.GLControl/DummyGLFWGraphicsContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using OpenTK.Windowing.Desktop; 3 | 4 | namespace OpenTK.GLControl 5 | { 6 | /// 7 | /// At design-time, we don't have a real GLFW graphics context. 8 | /// We use this stub instead, which does nothing but prevent crashes. 9 | /// 10 | internal class DummyGLFWGraphicsContext : IGLFWGraphicsContext 11 | { 12 | /// 13 | /// The one-and-only instance of this class. 14 | /// 15 | public static DummyGLFWGraphicsContext Instance { get; } = new DummyGLFWGraphicsContext(); 16 | 17 | /// 18 | /// The mandatory WindowPtr, which is always a null handle. 19 | /// 20 | public IntPtr WindowPtr => IntPtr.Zero; 21 | 22 | /// 23 | /// A fake IsCurrent flag, which just stores its last usage. 24 | /// 25 | public bool IsCurrent { get; private set; } 26 | 27 | public int SwapInterval { get; set; } 28 | 29 | /// 30 | /// This can only be constructed internally. 31 | /// 32 | private DummyGLFWGraphicsContext() 33 | { 34 | } 35 | 36 | /// 37 | /// Make this graphics context "current." This does mostly nothing. 38 | /// 39 | public void MakeCurrent() 40 | => IsCurrent = true; 41 | 42 | /// 43 | /// Make *no* graphics context "current." This does mostly nothing. 44 | /// 45 | public void MakeNoneCurrent() 46 | => IsCurrent = false; 47 | 48 | /// 49 | /// Swap the displayed buffer. This does *literally* nothing. 50 | /// 51 | public void SwapBuffers() 52 | { 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | # Release notes 2 | 3 | ## [4.0.2] 4 | - Make `GLControl` work with `OpenTK` `4.9.3`. (@NogginBops) 5 | 6 | ## [4.0.1] 7 | - Renamed the `OpenTK.WinForms` namespace to `OpenTK.GLControl`. (@NogginBops) 8 | - Fixed all remaining renaming issues. (@NogginBops) 9 | 10 | ## [4.0.0] 11 | - This is the first stable release of GLControl for OpenTK 4.x. 12 | - This version is idential to OpenTK.WinForms 4.0.0-pre.8. 13 | 14 | ## [4.0.0-pre.8] 15 | - This will be the last release under the name OpenTK.WinForms, the next release is going to be 4.0 under the name OpenTK.GLControl. 16 | - Disabled design mode animation as it was causing flickering when a dropdown menu was supposed to draw on top of GLControl. (@NogginBops) 17 | - Removed the ability to change OpenGL context settings at runtime, attempting this will result in a runtime exception. (@NogginBops) 18 | - The design time properties of the control have been cleaned up and marked with appropriate attributes. (@NogginBops) 19 | - Updated to OpenTK 4.8.2. (@NogginBops) 20 | - Updated to NUKE 8.0.0. (@NogginBops) 21 | 22 | ## [4.0.0-pre.7] 23 | - Added properties to `GLControlSettings` to control backbuffer bits. 24 | - Added `GLControlSettings.SrgbCapable` to set backbuffer sRGB capabilities. 25 | - Fix issue where OpenTK 4.7.2+ would throw an exception at startup. 26 | 27 | ## [4.0.0-pre.6] 28 | - _August 27, 2021_ 29 | - Update dependencies to OpenTK 4.6.4 packages. 30 | 31 | ## [4.0.0-pre.5] 32 | - _March 4, 2021_ 33 | - Add `Context` property for better backward compatibility with GLControl 3.x. 34 | 35 | ## [4.0.0-pre.4] 36 | - _February 18, 2021_ 37 | - Fix `Control.Site` null-reference bug. 38 | - Add `Load` event for better backward compatibility with GLControl 3.x. 39 | - Update simple test to demonstrate `Load` event. 40 | 41 | ## [4.0.0-pre.3] 42 | - _December 28, 2020_ 43 | - Fix design-mode bugs. 44 | 45 | ## [4.0.0-pre.2] 46 | - _December 22, 2020_ 47 | - Add more example projects to show usage: Simple example, multi-control example, and raw-input example. 48 | - Fix more bugs. 49 | 50 | ## [4.0.0-pre.1] 51 | - _December 21, 2020_ 52 | - All-new WebForms.GLControl, rewritten from the ground up for OpenTK 4.x and .NET Core 3.x+. 53 | - Support both WinForms input events and "native device" input events. 54 | - API is mostly backward compatible with the old GLControl. 55 | - Full support for the new WinForms Designer (VS2019). 56 | - All methods and properties fully XML-documented. 57 | - Example project to show its usage. 58 | - Readme that includes detailed usage and documentation. 59 | 60 | -------------------------------------------------------------------------------- /OpenTK.GLControl.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.11.35219.272 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTK.GLControl.TestForm", "OpenTK.GLControl.TestForm\OpenTK.GLControl.TestForm.csproj", "{95E422AB-9DC7-4E2A-B13F-A26A52EF1BBA}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTK.GLControl", "OpenTK.GLControl\OpenTK.GLControl.csproj", "{7CB8414E-9A16-4171-B3CA-ED3E3D82C3A4}" 9 | EndProject 10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTK.GLControl.MultiControlTest", "OpenTK.GLControl.MultiControlTest\OpenTK.GLControl.MultiControlTest.csproj", "{0B625ED5-86A7-4C38-AB6B-1833F2FA8C5A}" 11 | EndProject 12 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTK.GLControl.InputTest", "OpenTK.GLControl.InputTest\OpenTK.GLControl.InputTest.csproj", "{65839490-2DE7-4823-AC53-C210A805A982}" 13 | EndProject 14 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{7F8678E7-2F0E-44B1-903D-80FBA892D6A0}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Any CPU = Debug|Any CPU 19 | Release|Any CPU = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {95E422AB-9DC7-4E2A-B13F-A26A52EF1BBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {95E422AB-9DC7-4E2A-B13F-A26A52EF1BBA}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {95E422AB-9DC7-4E2A-B13F-A26A52EF1BBA}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {95E422AB-9DC7-4E2A-B13F-A26A52EF1BBA}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {7CB8414E-9A16-4171-B3CA-ED3E3D82C3A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {7CB8414E-9A16-4171-B3CA-ED3E3D82C3A4}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {7CB8414E-9A16-4171-B3CA-ED3E3D82C3A4}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {7CB8414E-9A16-4171-B3CA-ED3E3D82C3A4}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {0B625ED5-86A7-4C38-AB6B-1833F2FA8C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {0B625ED5-86A7-4C38-AB6B-1833F2FA8C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {0B625ED5-86A7-4C38-AB6B-1833F2FA8C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {0B625ED5-86A7-4C38-AB6B-1833F2FA8C5A}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {65839490-2DE7-4823-AC53-C210A805A982}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {65839490-2DE7-4823-AC53-C210A805A982}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {65839490-2DE7-4823-AC53-C210A805A982}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {65839490-2DE7-4823-AC53-C210A805A982}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {7F8678E7-2F0E-44B1-903D-80FBA892D6A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {7F8678E7-2F0E-44B1-903D-80FBA892D6A0}.Release|Any CPU.ActiveCfg = Release|Any CPU 40 | EndGlobalSection 41 | GlobalSection(SolutionProperties) = preSolution 42 | HideSolutionNode = FALSE 43 | EndGlobalSection 44 | GlobalSection(ExtensibilityGlobals) = postSolution 45 | SolutionGuid = {EB413925-4352-4A67-B073-BA550A8CA770} 46 | EndGlobalSection 47 | EndGlobal 48 | -------------------------------------------------------------------------------- /.nuke/build.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "Host": { 5 | "type": "string", 6 | "enum": [ 7 | "AppVeyor", 8 | "AzurePipelines", 9 | "Bamboo", 10 | "Bitbucket", 11 | "Bitrise", 12 | "GitHubActions", 13 | "GitLab", 14 | "Jenkins", 15 | "Rider", 16 | "SpaceAutomation", 17 | "TeamCity", 18 | "Terminal", 19 | "TravisCI", 20 | "VisualStudio", 21 | "VSCode" 22 | ] 23 | }, 24 | "ExecutableTarget": { 25 | "type": "string", 26 | "enum": [ 27 | "Clean", 28 | "Compile", 29 | "Pack", 30 | "PublishRelease", 31 | "PushGithub", 32 | "PushNuget", 33 | "Restore", 34 | "VersionInfo" 35 | ] 36 | }, 37 | "Verbosity": { 38 | "type": "string", 39 | "description": "", 40 | "enum": [ 41 | "Verbose", 42 | "Normal", 43 | "Minimal", 44 | "Quiet" 45 | ] 46 | }, 47 | "NukeBuild": { 48 | "properties": { 49 | "Continue": { 50 | "type": "boolean", 51 | "description": "Indicates to continue a previously failed build attempt" 52 | }, 53 | "Help": { 54 | "type": "boolean", 55 | "description": "Shows the help text for this build assembly" 56 | }, 57 | "Host": { 58 | "description": "Host for execution. Default is 'automatic'", 59 | "$ref": "#/definitions/Host" 60 | }, 61 | "NoLogo": { 62 | "type": "boolean", 63 | "description": "Disables displaying the NUKE logo" 64 | }, 65 | "Partition": { 66 | "type": "string", 67 | "description": "Partition to use on CI" 68 | }, 69 | "Plan": { 70 | "type": "boolean", 71 | "description": "Shows the execution plan (HTML)" 72 | }, 73 | "Profile": { 74 | "type": "array", 75 | "description": "Defines the profiles to load", 76 | "items": { 77 | "type": "string" 78 | } 79 | }, 80 | "Root": { 81 | "type": "string", 82 | "description": "Root directory during build execution" 83 | }, 84 | "Skip": { 85 | "type": "array", 86 | "description": "List of targets to be skipped. Empty list skips all dependencies", 87 | "items": { 88 | "$ref": "#/definitions/ExecutableTarget" 89 | } 90 | }, 91 | "Target": { 92 | "type": "array", 93 | "description": "List of targets to be invoked. Default is '{default_target}'", 94 | "items": { 95 | "$ref": "#/definitions/ExecutableTarget" 96 | } 97 | }, 98 | "Verbosity": { 99 | "description": "Logging verbosity during build execution. Default is 'Normal'", 100 | "$ref": "#/definitions/Verbosity" 101 | } 102 | } 103 | } 104 | }, 105 | "allOf": [ 106 | { 107 | "properties": { 108 | "Configuration": { 109 | "type": "string", 110 | "description": "Configuration to build - Default is 'Release'", 111 | "enum": [ 112 | "Debug", 113 | "Release" 114 | ] 115 | }, 116 | "NugetApiUrl": { 117 | "type": "string", 118 | "description": "NuGet api url" 119 | }, 120 | "opentk_github_token": { 121 | "type": "string", 122 | "description": "Github authentication token" 123 | }, 124 | "opentk_nuget_api_key": { 125 | "type": "string", 126 | "description": "NuGet api key" 127 | }, 128 | "Solution": { 129 | "type": "string", 130 | "description": "Path to a solution file that is automatically loaded" 131 | } 132 | } 133 | }, 134 | { 135 | "$ref": "#/definitions/NukeBuild" 136 | } 137 | ] 138 | } 139 | -------------------------------------------------------------------------------- /OpenTK.GLControl.InputTest/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using OpenTK.Graphics.OpenGL4; 4 | using OpenTK.Mathematics; 5 | 6 | namespace OpenTK.GLControl.InputTest 7 | { 8 | public partial class Form1 : Form 9 | { 10 | private INativeInput? _nativeInput; 11 | 12 | public Form1() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | private void exitToolStripMenuItem_Click(object sender, EventArgs e) 18 | { 19 | Close(); 20 | } 21 | 22 | private void aboutToolStripMenuItem_Click(object sender, EventArgs e) 23 | { 24 | MessageBox.Show(this, 25 | "This demonstrates a simple use of the new OpenTK 4.x GLControl.", 26 | "GLControl Test Form", 27 | MessageBoxButtons.OK); 28 | } 29 | 30 | protected override void OnLoad(EventArgs e) 31 | { 32 | base.OnLoad(e); 33 | 34 | WinFormsInputRadioButton.Checked = true; 35 | 36 | // Make sure that when the GLControl is resized or needs to be painted, 37 | // we update our projection matrix or re-render its contents, respectively. 38 | glControl.Resize += glControl_Resize; 39 | glControl.Paint += glControl_Paint; 40 | 41 | // Ensure that the viewport and projection matrix are set correctly initially. 42 | glControl_Resize(glControl, EventArgs.Empty); 43 | 44 | // Log any focus changes. 45 | glControl.GotFocus += (sender, e) => 46 | Log("Focus in"); 47 | glControl.LostFocus += (sender, e) => 48 | Log("Focus out"); 49 | 50 | // Log WinForms keyboard/mouse events. 51 | glControl.MouseDown += (sender, e) => 52 | { 53 | glControl.Focus(); 54 | Log($"WinForms Mouse down: ({e.X},{e.Y})"); 55 | }; 56 | glControl.MouseUp += (sender, e) => 57 | Log($"WinForms Mouse up: ({e.X},{e.Y})"); 58 | glControl.MouseMove += (sender, e) => 59 | Log($"WinForms Mouse move: ({e.X},{e.Y})"); 60 | glControl.KeyDown += (sender, e) => 61 | Log($"WinForms Key down: {e.KeyCode}"); 62 | glControl.KeyUp += (sender, e) => 63 | Log($"WinForms Key up: {e.KeyCode}"); 64 | glControl.KeyPress += (sender, e) => 65 | Log($"WinForms Key press: {e.KeyChar}"); 66 | } 67 | 68 | private void glControl_Resize(object? sender, EventArgs e) 69 | { 70 | glControl.MakeCurrent(); 71 | 72 | if (glControl.ClientSize.Height == 0) 73 | glControl.ClientSize = new System.Drawing.Size(glControl.ClientSize.Width, 1); 74 | 75 | GL.Viewport(0, 0, glControl.ClientSize.Width, glControl.ClientSize.Height); 76 | } 77 | 78 | private void glControl_Paint(object sender, PaintEventArgs e) 79 | { 80 | glControl.MakeCurrent(); 81 | 82 | GL.ClearColor(Color4.MidnightBlue); 83 | GL.Clear(ClearBufferMask.ColorBufferBit); 84 | 85 | glControl.SwapBuffers(); 86 | } 87 | 88 | private void WinFormsInputRadioButton_CheckedChanged(object sender, EventArgs e) 89 | { 90 | glControl.DisableNativeInput(); 91 | } 92 | 93 | private void NativeInputRadioButton_CheckedChanged(object sender, EventArgs e) 94 | { 95 | INativeInput nativeInput = glControl.EnableNativeInput(); 96 | 97 | if (_nativeInput == null) 98 | { 99 | _nativeInput = nativeInput; 100 | 101 | _nativeInput.MouseDown += (e) => 102 | { 103 | glControl.Focus(); 104 | Log("Native Mouse down"); 105 | }; 106 | _nativeInput.MouseUp += (e) => 107 | Log("Native Mouse up"); 108 | _nativeInput.MouseMove += (e) => 109 | Log($"Native Mouse move: {e.DeltaX},{e.DeltaY}"); 110 | _nativeInput.KeyDown += (e) => 111 | Log($"Native Key down: {e.Key}"); 112 | _nativeInput.KeyUp += (e) => 113 | Log($"Native Key up: {e.Key}"); 114 | _nativeInput.TextInput += (e) => 115 | Log($"Native Text input: {e.AsString}"); 116 | _nativeInput.JoystickConnected += (e) => 117 | Log($"Native Joystick connected: {e.JoystickId}"); 118 | } 119 | } 120 | 121 | private void Log(string message) 122 | { 123 | LogTextBox.AppendText(message + "\r\n"); 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenTK 4.x WinForms GLControl 2 | 3 | This repo contains a WinForms control designed to wrap the OpenTK 4.x APIs 4 | into something WinForms can easily use. It is designed and built for 5 | .NET Core 3.1+. 6 | 7 | ## Building it 8 | 9 | - Clone the repo. 10 | - Build the solution (or at least the `OpenTK.GLControl.csproj`). 11 | - The `OpenTK.GLControl` project exposes the new `GLControl`. Add this project 12 | (or its compiled DLL) as a dependency of your own projects. This directly 13 | depends on the WinForms and OpenTK Nuget packages but has no other dependencies. 14 | - `OpenTK.GLControl.TestForm` contains a test program that demonstrates that the 15 | new `GLControl` works. Try it first and make sure it works for you. You should 16 | see a spinning cube under a standard menubar. 17 | 18 | ## Usage 19 | 20 | The new `GLControl` is reasonably-well documented in its [source code](OpenTK.GLControl/GLControl.cs). It has a 21 | similar (but not identical) API to the 3.x `GLControl`. In general, you do this 22 | to use it: 23 | 24 | 1. Add the package to your project so you can use it. 25 | 2. Use the WinForms Designer to add a new `GLControl` to your form. 26 | 3. Configure the `GLControl` in the Designer, if necessary, to use the correct 27 | OpenGL configuration for your use case: Set API, APIVersion, Flags, and Profile 28 | to whatever flavor of OpenGL you need. 29 | 30 | - Note: The WinForms Designer is buggy when handling Version objects: Make sure to 31 | type a full four-digit version number: For OpenGL 3.3, for example, you need 32 | to type `3.3.0.0`; for OpenGL 4.0, you need to type `4.0.0.0`. 33 | 34 | 4. Bind events on the control that correspond to what you want to do. 35 | - In general, you probably want to bind `Paint` and `Resize`. 36 | - See below for a simple example. 37 | 38 | 5. If necessary, configure the control for `EnableNativeInput()`. By default, all 39 | input is done via WinForms using standard WinForms event handlers. If you need 40 | direct keyboard/mouse/joystick access, you can use `EnableNativeInput()` to 41 | get an `INativeInput` interface that will let you bind those events directly. 42 | Note that the control can be in _either_ native-input mode _or_ in WinForms 43 | input mode, not both. 44 | 45 | ## Example Resize/Paint handlers 46 | 47 | A complete example can be found in [OpenTK.GLControl.TestForm](OpenTK.GLControl.TestForm/Form1.cs), 48 | but the basics of implementing Resize and Paint handlers look like this: 49 | 50 | ```c# 51 | public partial class MyForm : Form 52 | { 53 | public MyForm() 54 | { 55 | InitializeComponent(); 56 | } 57 | 58 | protected override void OnLoad(EventArgs e) 59 | { 60 | base.OnLoad(e); 61 | 62 | // You can bind the events here or in the Designer. 63 | MyGLControl.Resize += MyGLControl_Resize; 64 | MyGLControl.Paint += MyGLControl_Paint; 65 | } 66 | 67 | private void MyGLControl_Resize(object? sender, EventArgs e) 68 | { 69 | MyGLControl.MakeCurrent(); // Tell OpenGL to use MyGLControl. 70 | 71 | // Update OpenGL on the new size of the control. 72 | GL.Viewport(0, 0, MyGLControl.ClientSize.Width, MyGLControl.ClientSize.Height); 73 | 74 | /* 75 | Usually you compute projection matrices here too, like this: 76 | 77 | float aspect_ratio = MyGLControl.ClientSize.Width / (float)MyGLControl.ClientSize.Height; 78 | Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 1, 64); 79 | 80 | And then you load that into OpenGL with a call like GL.LoadMatrix() or GL.Uniform(). 81 | */ 82 | } 83 | 84 | private void MyGLControl_Paint(object? sender, PaintEventArgs e) 85 | { 86 | MyGLControl.MakeCurrent(); // Tell OpenGL to draw on MyGLControl. 87 | GL.Clear(...); // Clear any prior drawing. 88 | 89 | /* 90 | ... use various other GL.*() calls here to draw stuff ... 91 | */ 92 | 93 | MyGLControl.SwapBuffers(); // Display the result. 94 | } 95 | } 96 | ``` 97 | 98 | ## A note on the Fixed-Function Pipeline (FFP) 99 | 100 | The FFP is the "old" way of doing OpenGL that uses calls like `GL.Begin()` and `GL.End()`. 101 | Modern OpenGL uses shaders instead. Most of the examples you'll find online that use 102 | the previous versions of the `GLControl` use the FFP; but the FFP is *not* enabled by 103 | default in OpenTK 4. 104 | 105 | So if you need the FFP because you're running older code or using examples found online, 106 | be sure to set 107 | 108 | ```c# 109 | Profile = Profile.Compatability; 110 | ``` 111 | 112 | either in the Designer or in your form's constructor, or the FFP functions will *not* work 113 | as expected. 114 | 115 | ## Upgrade note on Colors 116 | 117 | OpenTK 4 uses different color types than OpenTK 3. When porting code designed for 118 | the older `GLControl`, you will likely have to convert uses of colors to the new types: 119 | 120 | - Convert all uses of `Color` to `Color4`. 121 | - Convert all calls to `GL.Color()` to `GL.Color4()`. 122 | 123 | ## License 124 | 125 | This is released under the terms of the [MIT Open-Source License](LICENSE.md), just like 126 | OpenTK itself. 127 | 128 | 129 | -------------------------------------------------------------------------------- /OpenTK.GLControl/Win32.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace OpenTK.GLControl 5 | { 6 | /// 7 | /// P/Invoke functions and declarations for Microsoft Windows (32-bit and 64-bit). 8 | /// 9 | internal static class Win32 10 | { 11 | #region Enums 12 | 13 | public enum WindowLongs : int 14 | { 15 | GWL_EXSTYLE = -20, 16 | GWLP_HINSTANCE = -6, 17 | GWLP_HWNDPARENT = -8, 18 | GWL_ID = -12, 19 | GWL_STYLE = -16, 20 | GWL_USERDATA = -21, 21 | GWL_WNDPROC = -4, 22 | DWLP_DLGPROC = 4, 23 | DWLP_MSGRESULT = 0, 24 | DWLP_USER = 8, 25 | } 26 | 27 | [Flags] 28 | public enum WindowStyles : uint 29 | { 30 | WS_BORDER = 0x800000, 31 | WS_CAPTION = 0xc00000, 32 | WS_CHILD = 0x40000000, 33 | WS_CLIPCHILDREN = 0x2000000, 34 | WS_CLIPSIBLINGS = 0x4000000, 35 | WS_DISABLED = 0x8000000, 36 | WS_DLGFRAME = 0x400000, 37 | WS_GROUP = 0x20000, 38 | WS_HSCROLL = 0x100000, 39 | WS_MAXIMIZE = 0x1000000, 40 | WS_MAXIMIZEBOX = 0x10000, 41 | WS_MINIMIZE = 0x20000000, 42 | WS_MINIMIZEBOX = 0x20000, 43 | WS_OVERLAPPED = 0x0, 44 | WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_SIZEFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, 45 | WS_POPUP = 0x80000000u, 46 | WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU, 47 | WS_SIZEFRAME = 0x40000, 48 | WS_SYSMENU = 0x80000, 49 | WS_TABSTOP = 0x10000, 50 | WS_VISIBLE = 0x10000000, 51 | WS_VSCROLL = 0x200000, 52 | } 53 | 54 | [Flags] 55 | public enum WindowStylesEx : uint 56 | { 57 | WS_EX_ACCEPTFILES = 0x00000010, 58 | WS_EX_APPWINDOW = 0x00040000, 59 | WS_EX_CLIENTEDGE = 0x00000200, 60 | WS_EX_COMPOSITED = 0x02000000, 61 | WS_EX_CONTEXTHELP = 0x00000400, 62 | WS_EX_CONTROLPARENT = 0x00010000, 63 | WS_EX_DLGMODALFRAME = 0x00000001, 64 | WS_EX_LAYERED = 0x00080000, 65 | WS_EX_LAYOUTRTL = 0x00400000, 66 | WS_EX_LEFT = 0x00000000, 67 | WS_EX_LEFTSCROLLBAR = 0x00004000, 68 | WS_EX_LTRREADING = 0x00000000, 69 | WS_EX_MDICHILD = 0x00000040, 70 | WS_EX_NOACTIVATE = 0x08000000, 71 | WS_EX_NOINHERITLAYOUT = 0x00100000, 72 | WS_EX_NOPARENTNOTIFY = 0x00000004, 73 | WS_EX_NOREDIRECTIONBITMAP = 0x00200000, 74 | WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE, 75 | WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST, 76 | WS_EX_RIGHT = 0x00001000, 77 | WS_EX_RIGHTSCROLLBAR = 0x00000000, 78 | WS_EX_RTLREADING = 0x00002000, 79 | WS_EX_STATICEDGE = 0x00020000, 80 | WS_EX_TOOLWINDOW = 0x00000080, 81 | WS_EX_TOPMOST = 0x00000008, 82 | WS_EX_TRANSPARENT = 0x00000020, 83 | WS_EX_WINDOWEDGE = 0x00000100, 84 | } 85 | 86 | #endregion 87 | 88 | #region Miscellaneous User32 stuff 89 | 90 | [DllImport("user32.dll", SetLastError = true)] 91 | public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); 92 | 93 | #endregion 94 | 95 | #region Miscellaneous Kernel32 stuff 96 | 97 | public static int GetLastError() 98 | => Marshal.GetLastWin32Error(); // This alias isn't strictly needed, but it reads better. 99 | 100 | #endregion 101 | 102 | #region GetWindowLong/SetWindowLong and friends 103 | 104 | public static IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongs nIndex) 105 | => GetWindowLongPtr(hWnd, (int)nIndex); 106 | 107 | public static IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex) 108 | { 109 | if (IntPtr.Size == 8) 110 | return GetWindowLongPtr64(hWnd, nIndex); 111 | else 112 | return GetWindowLongPtr32(hWnd, nIndex); 113 | } 114 | 115 | [DllImport("user32.dll", EntryPoint = "GetWindowLong", SetLastError = true)] 116 | private static extern IntPtr GetWindowLongPtr32(IntPtr hWnd, int nIndex); 117 | 118 | [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr", SetLastError = true)] 119 | private static extern IntPtr GetWindowLongPtr64(IntPtr hWnd, int nIndex); 120 | 121 | public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongs nIndex, IntPtr dwNewLong) 122 | => SetWindowLongPtr(hWnd, (int)nIndex, dwNewLong); 123 | 124 | public static IntPtr SetWindowLongPtr(IntPtr hWnd, int nIndex, IntPtr dwNewLong) 125 | { 126 | if (IntPtr.Size == 8) 127 | return SetWindowLongPtr64(hWnd, nIndex, dwNewLong); 128 | else 129 | return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32())); 130 | } 131 | 132 | [DllImport("user32.dll", EntryPoint = "SetWindowLong", SetLastError = true)] 133 | private static extern int SetWindowLong32(IntPtr hWnd, int nIndex, int dwNewLong); 134 | 135 | [DllImport("user32.dll", EntryPoint = "SetWindowLongPtr", SetLastError = true)] 136 | private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, int nIndex, IntPtr dwNewLong); 137 | 138 | #endregion 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /OpenTK.GLControl/INativeInput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using OpenTK.Mathematics; 4 | using OpenTK.Windowing.Common; 5 | using OpenTK.Windowing.GraphicsLibraryFramework; 6 | 7 | namespace OpenTK.GLControl 8 | { 9 | /// 10 | /// Abstract access to native-input properties, methods, and events. 11 | /// 12 | public interface INativeInput 13 | { 14 | /// 15 | /// Gets or sets the position of the mouse relative to the content area of this window. 16 | /// 17 | Vector2 MousePosition { get; } 18 | 19 | /// 20 | /// Gets the current state of the keyboard as of the last time the window processed 21 | /// events. 22 | /// 23 | KeyboardState KeyboardState { get; } 24 | 25 | /// 26 | /// Gets the current state of the joysticks as of the last time the window processed 27 | /// events. 28 | /// 29 | IReadOnlyList JoystickStates { get; } 30 | 31 | /// 32 | /// Gets the current state of the mouse as of the last time the window processed 33 | /// events. 34 | /// 35 | MouseState MouseState { get; } 36 | 37 | /// 38 | /// Gets a value indicating whether any key is down. 39 | /// 40 | bool IsAnyKeyDown { get; } 41 | 42 | /// 43 | /// Gets a value indicating whether any mouse button is pressed. 44 | /// 45 | bool IsAnyMouseButtonDown { get; } 46 | 47 | /// 48 | /// Occurs whenever the mouse cursor is moved 49 | /// 50 | event Action MouseMove; 51 | 52 | /// 53 | /// Occurs whenever a OpenTK.Windowing.GraphicsLibraryFramework.MouseButton is released. 54 | /// 55 | event Action MouseUp; 56 | 57 | /// 58 | /// Occurs whenever a OpenTK.Windowing.GraphicsLibraryFramework.MouseButton is clicked. 59 | /// 60 | event Action MouseDown; 61 | 62 | /// 63 | /// Occurs whenever the mouse cursor enters the window OpenTK.Windowing.Desktop.NativeWindow.Bounds. 64 | /// 65 | event Action MouseEnter; 66 | 67 | /// 68 | /// Occurs whenever the mouse cursor leaves the window OpenTK.Windowing.Desktop.NativeWindow.Bounds. 69 | /// 70 | event Action MouseLeave; 71 | 72 | /// 73 | /// Occurs whenever a keyboard key is released. 74 | /// 75 | event Action KeyUp; 76 | 77 | /// 78 | /// Occurs whenever a Unicode code point is typed. 79 | /// 80 | event Action TextInput; 81 | 82 | /// 83 | /// Occurs when a joystick is connected or disconnected. 84 | /// 85 | event Action JoystickConnected; 86 | 87 | /// 88 | /// Occurs whenever a keyboard key is pressed. 89 | /// 90 | event Action KeyDown; 91 | 92 | /// 93 | /// Occurs whenever one or more files are dropped on the window. 94 | /// 95 | event Action FileDrop; 96 | 97 | /// 98 | /// Occurs whenever a mouse wheel is moved. 99 | /// 100 | event Action MouseWheel; 101 | 102 | /// 103 | /// Gets a indicating whether this key is currently down. 104 | /// 105 | /// The key to check. 106 | /// true if is in the down state; otherwise, false. 107 | bool IsKeyDown(Keys key); 108 | 109 | /// 110 | /// Gets whether the specified key is pressed in the current frame but released in the previous frame. 111 | /// 112 | /// 113 | /// "Frame" refers to invocations of here. 114 | /// 115 | /// The key to check. 116 | /// True if the key is pressed in this frame, but not the last frame. 117 | bool IsKeyPressed(Keys key); 118 | 119 | /// 120 | /// Gets whether the specified key is released in the current frame but pressed in the previous frame. 121 | /// 122 | /// 123 | /// "Frame" refers to invocations of here. 124 | /// 125 | /// The key to check. 126 | /// True if the key is released in this frame, but pressed the last frame. 127 | bool IsKeyReleased(Keys key); 128 | 129 | /// 130 | /// Gets a indicating whether this button is currently down. 131 | /// 132 | /// The to check. 133 | /// true if is in the down state; otherwise, false. 134 | bool IsMouseButtonDown(MouseButton button); 135 | 136 | /// 137 | /// Gets whether the specified mouse button is pressed in the current frame but released in the previous frame. 138 | /// 139 | /// 140 | /// "Frame" refers to invocations of here. 141 | /// 142 | /// The button to check. 143 | /// True if the button is pressed in this frame, but not the last frame. 144 | bool IsMouseButtonPressed(MouseButton button); 145 | 146 | /// 147 | /// Gets whether the specified mouse button is released in the current frame but pressed in the previous frame. 148 | /// 149 | /// 150 | /// "Frame" refers to invocations of here. 151 | /// 152 | /// The button to check. 153 | /// True if the button is released in this frame, but pressed the last frame. 154 | bool IsMouseButtonReleased(MouseButton button); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /OpenTK.GLControl/GLControlDesignTimeRenderer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using OpenTK.Mathematics; 4 | 5 | namespace OpenTK.GLControl 6 | { 7 | /// 8 | /// At design-time, we really can't load OpenGL and GLFW and render with it 9 | /// for real; the WinForms designer is too limited to support such advanced 10 | /// things without exploding. So instead, we simply use GDI+ to draw a cube 11 | /// at design-time. 12 | /// 13 | internal class GLControlDesignTimeRenderer 14 | { 15 | /// 16 | /// The GLControl that needs to be rendered at design-time. 17 | /// 18 | private readonly GLControl _owner; 19 | 20 | /// 21 | /// The angle (yaw) of the design-time cube. 22 | /// 23 | private float _designTimeCubeYaw; 24 | 25 | /// 26 | /// The angle (pitch) of the design-time cube. 27 | /// 28 | private float _designTimeCubeRoll; 29 | 30 | /// 31 | /// Endpoints that can make a cube. We only use this in design mode. 32 | /// 33 | private static (Vector3, Vector3)[] CubeLines { get; } = new (Vector3, Vector3)[] 34 | { 35 | (new Vector3(-1, -1, -1), new Vector3(+1, -1, -1)), 36 | (new Vector3(-1, -1, -1), new Vector3(-1, +1, -1)), 37 | (new Vector3(-1, -1, -1), new Vector3(-1, -1, +1)), 38 | 39 | (new Vector3(+1, -1, -1), new Vector3(+1, +1, -1)), 40 | (new Vector3(+1, -1, -1), new Vector3(+1, -1, +1)), 41 | 42 | (new Vector3(-1, +1, -1), new Vector3(+1, +1, -1)), 43 | (new Vector3(-1, +1, -1), new Vector3(-1, +1, +1)), 44 | 45 | (new Vector3(-1, -1, +1), new Vector3(+1, -1, +1)), 46 | (new Vector3(-1, -1, +1), new Vector3(-1, +1, +1)), 47 | 48 | (new Vector3(+1, +1, +1), new Vector3(+1, +1, -1)), 49 | (new Vector3(+1, +1, +1), new Vector3(-1, +1, +1)), 50 | (new Vector3(+1, +1, +1), new Vector3(+1, -1, +1)), 51 | }; 52 | 53 | /// 54 | /// Instantiate a new design-timer renderer for the given GLControl. 55 | /// 56 | /// The GLControl that needs to be rendered at 57 | /// design-time. 58 | public GLControlDesignTimeRenderer(GLControl owner) 59 | { 60 | _owner = owner; 61 | 62 | 63 | _designTimeCubeYaw += -10 * (float)(Math.PI / 97); 64 | } 65 | 66 | /// 67 | /// Draw a simple cube, in an ortho projection, using GDI+. 68 | /// 69 | /// The GDI+ Graphics object to draw on. 70 | /// The color for the cube. 71 | /// The X coordinate of the center point of the cube, 72 | /// in Graphics coordinates. 73 | /// The Y coordinate of the center point of the cube, 74 | /// in Graphics coordinates. 75 | /// The radius to the cube's corners from the center point. 76 | /// The yaw (rotation around the Y axis) of the cube. 77 | /// The pitch (rotation around the X axis) of the cube. 78 | /// The roll (rotation around the Z axis) of the cube. 79 | private void DrawCube(System.Drawing.Graphics graphics, 80 | System.Drawing.Color color, 81 | float cx, float cy, float radius, 82 | float yaw = 0, float pitch = 0, float roll = 0) 83 | { 84 | // We use matrices to rotate and scale the cube, but we just use a simple 85 | // center offset to position it. That saves a lot of extra multiplies all 86 | // over this code, since we can use Matrix3 and Vector3 instead of Matrix4 87 | // and Vector4. And no, quaternions aren't worth the effort here either. 88 | Matrix3 matrix = Matrix3.CreateRotationZ(roll) 89 | * Matrix3.CreateRotationY(yaw) 90 | * Matrix3.CreateRotationX(pitch) 91 | * Matrix3.CreateScale(radius); 92 | 93 | // Draw the edges of the cube in the given color. Since it's just a single- 94 | // color wireframe, the order of the edges doesn't matter at all. 95 | using System.Drawing.Brush brush = new System.Drawing.SolidBrush(color); 96 | using System.Drawing.Pen pen = new System.Drawing.Pen(brush); 97 | 98 | foreach ((Vector3 start, Vector3 end) in CubeLines) 99 | { 100 | Vector3 projStart = start * matrix; 101 | Vector3 projEnd = end * matrix; 102 | 103 | graphics.DrawLine(pen, cx + projStart.X, cy - projStart.Y, cx + projEnd.X, cy - projEnd.Y); 104 | } 105 | } 106 | 107 | /// 108 | /// In design mode, we have nothing to show, so we paint the 109 | /// background black and put a cube on it so that it's 110 | /// obvious that it's a 3D renderer. 111 | /// 112 | public void Paint(System.Drawing.Graphics graphics) 113 | { 114 | // Since we're always DoubleBuffered = false, we have to do 115 | // simple double-buffering ourselves, using a bitmap. 116 | using System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(_owner.Width, _owner.Height, graphics); 117 | using System.Drawing.Graphics bitmapGraphics = System.Drawing.Graphics.FromImage(bitmap); 118 | 119 | // Other resources we'll need. 120 | using System.Drawing.Font bigFont = new System.Drawing.Font("Arial", 12); 121 | using System.Drawing.Font smallFont = new System.Drawing.Font("Arial", 9); 122 | using System.Drawing.Brush titleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White); 123 | using System.Drawing.Brush subtitleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.PaleGoldenrod); 124 | 125 | // Configuration. 126 | const float cubeRadius = 16; 127 | const string title = "GLControl"; 128 | int cx = _owner.Width / 2, cy = _owner.Height / 2; 129 | string subtitle = $"( {_owner.Name} )"; 130 | 131 | // These sizes will hold font metrics. 132 | System.Drawing.SizeF titleSize; 133 | System.Drawing.SizeF subtitleSize; 134 | System.Drawing.SizeF totalTextSize; 135 | 136 | // Start with a black background. 137 | bitmapGraphics.Clear(System.Drawing.Color.Black); 138 | bitmapGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; 139 | 140 | // Measure and the title (fixed) and the subtitle (the control's Name). 141 | titleSize = bitmapGraphics.MeasureString(title, bigFont); 142 | subtitleSize = bitmapGraphics.MeasureString(subtitle, smallFont); 143 | totalTextSize = new System.Drawing.SizeF( 144 | Math.Max(titleSize.Width, subtitleSize.Width), 145 | titleSize.Height + subtitleSize.Height 146 | ); 147 | 148 | // Draw both of the title and subtitle centered, now that we know how big they are. 149 | bitmapGraphics.DrawString(title, bigFont, titleBrush, 150 | new System.Drawing.PointF(cx - totalTextSize.Width / 2 + cubeRadius + 2, cy - totalTextSize.Height / 2)); 151 | bitmapGraphics.DrawString(subtitle, smallFont, subtitleBrush, 152 | new System.Drawing.PointF(cx - totalTextSize.Width / 2 + cubeRadius + 2, cy - totalTextSize.Height / 2 + titleSize.Height)); 153 | 154 | // Draw a cube beside the title and subtitle. 155 | DrawCube(bitmapGraphics, System.Drawing.Color.Red, 156 | cx - totalTextSize.Width / 2 - cubeRadius - 2, cy, cubeRadius, 157 | _designTimeCubeYaw, (float)(Math.PI / 8), _designTimeCubeRoll); 158 | 159 | // Draw the resulting bitmap on the real window canvas. 160 | graphics.DrawImage(bitmap, 0, 0); 161 | } 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /OpenTK.GLControl.InputTest/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | 61 | 62 | 63 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 64 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABiSURBVDhP7czBCoAwCIBhn80nifnq1cVDddHjQtogtjbb 65 | NRJ+BuI+yCMi0UtVp3Rejx0gYjMiiszcRjKwb0eV7UOgPuIBy7z2EQ+w947Yffp6jQeUDQFlP/B94G2P 66 | wGgAACcYuZjJw4fhNwAAAABJRU5ErkJggg== 67 | 68 | 69 | 70 | 71 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 72 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFUSURBVDhPlZK9SgNBFIXnCcQnkLyA4CPkHayFdBY22mqj 73 | paVlxCKCoBaClUQLESNRC4OE4EKQrAbcYBKy62Z/ynHOzUwcMzuyDhzYGc795tw7y2ZXFEVLSZI8p2la 74 | kkf5lywO1vZr/MH54LkhwlgQKsZxvC4AfHHjjM+tHOaDiKIKiqDqk0s6rbUJoCDCsy3t5kJh+bJFZrZ8 75 | YGhh9ZjgSIeUUgVZPgHot2HfGwbTNu4aTf75UuW+50wVhSMAKwRwugO6aevokYohfQbDzj1/vdj8pffb 76 | PfJREpUAEPSOvXoFBdSFBIDgmxIgTr3lEkRPYZMOwDwYDtzrXToATPVp06B9QwB8o4YAipjVr02dqx0T 77 | gOHMGm3qNc8nL6EAX33XMP2l8cj7mQEOvMaJYbKpWy/zMAzf6BVE9ADF6CnLnCXMCn8mAUSMEiCYwX/k 78 | +/48Y4x9AwxhsnXBwZZBAAAAAElFTkSuQmCC 79 | 80 | 81 | 82 | 83 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 84 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABzSURBVDhPY/j69WvDt2/f/pODQXoZQIyYCfv+MwTPIQmD 85 | 9ID0gg3ApoAYjGHAh/cficLD2QBS8SA1AJufkTGyWtoagM5HFwdhmAEfkPMCukJkzcjiIAw24MuXLwbI 86 | hqArRNaMLA7CYANAAGYISIA0/O0/AID67ECmnhNDAAAAAElFTkSuQmCC 87 | 88 | 89 | 90 | 91 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 92 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACHSURBVDhP3ZJRCoAgEEQ9Wngsj+UJOkF1kwpEP6sxFdNt 93 | 098GHgk7+yxI5LHWHi2Eeh0MpZQsTYJt3Un+KnDODcaYEYNWAcAOdgUOSik/7EFr7SXptedpIW+lQBc7 94 | 2H18d3y2QAp6eBXgzPEqoEolZS8Jcr4EZT/8DXeigKNaypObOUL9ihAnoWKSj1JdahUAAAAASUVORK5C 95 | YII= 96 | 97 | 98 | 99 | 100 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 101 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADXSURBVDhPnZExDoIwFIY5gWfxDFzBVRMTRu4iriYuXqGT 102 | BmO8gFudmQ2DaJsyPvlrawilFGzy5fFK/68tRO2hlKIQdV2vzXJ3YEEcx16SJKGyLP0SK6ieLwfM5/l5 103 | WBISoA5KxgiAlWC9iX5HSNBlkqCLV8AYIyEkibfoDVocAT7I8VbQbHWgaLHXFX1fGDgCKeUVIbA7cV2B 104 | 7ySOQDfNzgjjGRX9vXiEBc3uczR/ncCEq+X28rv7pG/QDqNyzqmRjv8LVgAwgRdpmlK2yQZxrmDQk+NR 105 | 9AE47sSEPD2a+wAAAABJRU5ErkJggg== 106 | 107 | 108 | 109 | 110 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 111 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE6SURBVDhPhZI9boNAEIU5Qo6QI+QM9Egp6anDAaho3NiN 112 | z0LrCKU0nQt6UodIOIifkuy3zKAlWORJI3bnvZk3s7bnouu6l2EY7kTTNE+S9jhrHo2ktzDkRxzHU5Zl 113 | U9/3qaQ9zuTg0Eh6C+Mw+b4/hWE46RTqTg4Ojci3aNv2M4oiK9Qp1J0cHBqRb4E4z/PVFK57URSr1R4C 114 | B3bVKdSd3K67wji8lmW5TKHu5OBEtg8z9u1wONhCIkkS1rkJ/T94aUa+XgsbQRDsvz4wgjMiDYoul3fb 115 | gClczsRZymaQYEeKEOvXDZdDu2pCV4j4LZ7qr2/7eyOu69oGZ5dDS42Uzw1sgRHcmx/75V5VlRU+4mg8 116 | juPz0oCux+PJCtI0XVz2OFsMzGXzBrrnHiflM0S8uLp/2b8c95nxvF92DupZ7oH5WgAAAABJRU5ErkJg 117 | gg== 118 | 119 | 120 | 121 | 122 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 123 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhPtc9RCoAgDMbxzuZJAo9pN/KhetkejQWD/HLq 124 | oAZ/ItIfbZEhomLFzOt9qDdyMITwKsZYcs5jRIFjP6tS2uYQC0DEXKkF6BrPzL+xAHw3V5oF5NlEPICk 125 | iNxzAZgLwP4BsNZFTb5XAOYCcD4DRnWBuahc6R2LWkqXAfkAAAAASUVORK5CYII= 126 | 127 | 128 | 129 | 130 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 131 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACaSURBVDhPvZFBCsMgEEU9Qs/k2TyGe6/RrWdxYRPEbcof 132 | /MTaZGpa6MDDcfQ/AzFj5ZxvpZR7rXUD6DFrx58LAe/9Zq0V0GPWjo+Lr4GUkgSdcwL6/hy02F4Y8kXy 133 | yIswzlUBAwz3Eq5TgiOmBRr/EazLKn8ixqjyIhoFuIC9xpTg7EumBVx7LgtGQgjnAsJLGm+Cb2jxX8qY 134 | J5nBJhUlLbsqAAAAAElFTkSuQmCC 135 | 136 | 137 | -------------------------------------------------------------------------------- /OpenTK.GLControl.TestForm/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | 61 | 17, 17 62 | 63 | 64 | 65 | 66 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 67 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABiSURBVDhP7czBCoAwCIBhn80nifnq1cVDddHjQtogtjbb 68 | NRJ+BuI+yCMi0UtVp3Rejx0gYjMiiszcRjKwb0eV7UOgPuIBy7z2EQ+w947Yffp6jQeUDQFlP/B94G2P 69 | wGgAACcYuZjJw4fhNwAAAABJRU5ErkJggg== 70 | 71 | 72 | 73 | 74 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 75 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFUSURBVDhPlZK9SgNBFIXnCcQnkLyA4CPkHayFdBY22mqj 76 | paVlxCKCoBaClUQLESNRC4OE4EKQrAbcYBKy62Z/ynHOzUwcMzuyDhzYGc795tw7y2ZXFEVLSZI8p2la 77 | kkf5lywO1vZr/MH54LkhwlgQKsZxvC4AfHHjjM+tHOaDiKIKiqDqk0s6rbUJoCDCsy3t5kJh+bJFZrZ8 78 | YGhh9ZjgSIeUUgVZPgHot2HfGwbTNu4aTf75UuW+50wVhSMAKwRwugO6aevokYohfQbDzj1/vdj8pffb 79 | PfJREpUAEPSOvXoFBdSFBIDgmxIgTr3lEkRPYZMOwDwYDtzrXToATPVp06B9QwB8o4YAipjVr02dqx0T 80 | gOHMGm3qNc8nL6EAX33XMP2l8cj7mQEOvMaJYbKpWy/zMAzf6BVE9ADF6CnLnCXMCn8mAUSMEiCYwX/k 81 | +/48Y4x9AwxhsnXBwZZBAAAAAElFTkSuQmCC 82 | 83 | 84 | 85 | 86 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 87 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABzSURBVDhPY/j69WvDt2/f/pODQXoZQIyYCfv+MwTPIQmD 88 | 9ID0gg3ApoAYjGHAh/cficLD2QBS8SA1AJufkTGyWtoagM5HFwdhmAEfkPMCukJkzcjiIAw24MuXLwbI 89 | hqArRNaMLA7CYANAAGYISIA0/O0/AID67ECmnhNDAAAAAElFTkSuQmCC 90 | 91 | 92 | 93 | 94 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 95 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACHSURBVDhP3ZJRCoAgEEQ9Wngsj+UJOkF1kwpEP6sxFdNt 96 | 098GHgk7+yxI5LHWHi2Eeh0MpZQsTYJt3Un+KnDODcaYEYNWAcAOdgUOSik/7EFr7SXptedpIW+lQBc7 97 | 2H18d3y2QAp6eBXgzPEqoEolZS8Jcr4EZT/8DXeigKNaypObOUL9ihAnoWKSj1JdahUAAAAASUVORK5C 98 | YII= 99 | 100 | 101 | 102 | 103 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 104 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADXSURBVDhPnZExDoIwFIY5gWfxDFzBVRMTRu4iriYuXqGT 105 | BmO8gFudmQ2DaJsyPvlrawilFGzy5fFK/68tRO2hlKIQdV2vzXJ3YEEcx16SJKGyLP0SK6ieLwfM5/l5 106 | WBISoA5KxgiAlWC9iX5HSNBlkqCLV8AYIyEkibfoDVocAT7I8VbQbHWgaLHXFX1fGDgCKeUVIbA7cV2B 107 | 7ySOQDfNzgjjGRX9vXiEBc3uczR/ncCEq+X28rv7pG/QDqNyzqmRjv8LVgAwgRdpmlK2yQZxrmDQk+NR 108 | 9AE47sSEPD2a+wAAAABJRU5ErkJggg== 109 | 110 | 111 | 112 | 113 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 114 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE6SURBVDhPhZI9boNAEIU5Qo6QI+QM9Egp6anDAaho3NiN 115 | z0LrCKU0nQt6UodIOIifkuy3zKAlWORJI3bnvZk3s7bnouu6l2EY7kTTNE+S9jhrHo2ktzDkRxzHU5Zl 116 | U9/3qaQ9zuTg0Eh6C+Mw+b4/hWE46RTqTg4Ojci3aNv2M4oiK9Qp1J0cHBqRb4E4z/PVFK57URSr1R4C 117 | B3bVKdSd3K67wji8lmW5TKHu5OBEtg8z9u1wONhCIkkS1rkJ/T94aUa+XgsbQRDsvz4wgjMiDYoul3fb 118 | gClczsRZymaQYEeKEOvXDZdDu2pCV4j4LZ7qr2/7eyOu69oGZ5dDS42Uzw1sgRHcmx/75V5VlRU+4mg8 119 | juPz0oCux+PJCtI0XVz2OFsMzGXzBrrnHiflM0S8uLp/2b8c95nxvF92DupZ7oH5WgAAAABJRU5ErkJg 120 | gg== 121 | 122 | 123 | 124 | 125 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 126 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhPtc9RCoAgDMbxzuZJAo9pN/KhetkejQWD/HLq 127 | oAZ/ItIfbZEhomLFzOt9qDdyMITwKsZYcs5jRIFjP6tS2uYQC0DEXKkF6BrPzL+xAHw3V5oF5NlEPICk 128 | iNxzAZgLwP4BsNZFTb5XAOYCcD4DRnWBuahc6R2LWkqXAfkAAAAASUVORK5CYII= 129 | 130 | 131 | 132 | 133 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 134 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACaSURBVDhPvZFBCsMgEEU9Qs/k2TyGe6/RrWdxYRPEbcof 135 | /MTaZGpa6MDDcfQ/AzFj5ZxvpZR7rXUD6DFrx58LAe/9Zq0V0GPWjo+Lr4GUkgSdcwL6/hy02F4Y8kXy 136 | yIswzlUBAwz3Eq5TgiOmBRr/EazLKn8ixqjyIhoFuIC9xpTg7EumBVx7LgtGQgjnAsJLGm+Cb2jxX8qY 137 | J5nBJhUlLbsqAAAAAElFTkSuQmCC 138 | 139 | 140 | -------------------------------------------------------------------------------- /OpenTK.GLControl.MultiControlTest/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | text/microsoft-resx 50 | 51 | 52 | 2.0 53 | 54 | 55 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 56 | 57 | 58 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 59 | 60 | 61 | 17, 17 62 | 63 | 64 | 65 | 66 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 67 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABiSURBVDhP7czBCoAwCIBhn80nifnq1cVDddHjQtogtjbb 68 | NRJ+BuI+yCMi0UtVp3Rejx0gYjMiiszcRjKwb0eV7UOgPuIBy7z2EQ+w947Yffp6jQeUDQFlP/B94G2P 69 | wGgAACcYuZjJw4fhNwAAAABJRU5ErkJggg== 70 | 71 | 72 | 73 | 74 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 75 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFUSURBVDhPlZK9SgNBFIXnCcQnkLyA4CPkHayFdBY22mqj 76 | paVlxCKCoBaClUQLESNRC4OE4EKQrAbcYBKy62Z/ynHOzUwcMzuyDhzYGc795tw7y2ZXFEVLSZI8p2la 77 | kkf5lywO1vZr/MH54LkhwlgQKsZxvC4AfHHjjM+tHOaDiKIKiqDqk0s6rbUJoCDCsy3t5kJh+bJFZrZ8 78 | YGhh9ZjgSIeUUgVZPgHot2HfGwbTNu4aTf75UuW+50wVhSMAKwRwugO6aevokYohfQbDzj1/vdj8pffb 79 | PfJREpUAEPSOvXoFBdSFBIDgmxIgTr3lEkRPYZMOwDwYDtzrXToATPVp06B9QwB8o4YAipjVr02dqx0T 80 | gOHMGm3qNc8nL6EAX33XMP2l8cj7mQEOvMaJYbKpWy/zMAzf6BVE9ADF6CnLnCXMCn8mAUSMEiCYwX/k 81 | +/48Y4x9AwxhsnXBwZZBAAAAAElFTkSuQmCC 82 | 83 | 84 | 85 | 86 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 87 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABzSURBVDhPY/j69WvDt2/f/pODQXoZQIyYCfv+MwTPIQmD 88 | 9ID0gg3ApoAYjGHAh/cficLD2QBS8SA1AJufkTGyWtoagM5HFwdhmAEfkPMCukJkzcjiIAw24MuXLwbI 89 | hqArRNaMLA7CYANAAGYISIA0/O0/AID67ECmnhNDAAAAAElFTkSuQmCC 90 | 91 | 92 | 93 | 94 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 95 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACHSURBVDhP3ZJRCoAgEEQ9Wngsj+UJOkF1kwpEP6sxFdNt 96 | 098GHgk7+yxI5LHWHi2Eeh0MpZQsTYJt3Un+KnDODcaYEYNWAcAOdgUOSik/7EFr7SXptedpIW+lQBc7 97 | 2H18d3y2QAp6eBXgzPEqoEolZS8Jcr4EZT/8DXeigKNaypObOUL9ihAnoWKSj1JdahUAAAAASUVORK5C 98 | YII= 99 | 100 | 101 | 102 | 103 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 104 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADXSURBVDhPnZExDoIwFIY5gWfxDFzBVRMTRu4iriYuXqGT 105 | BmO8gFudmQ2DaJsyPvlrawilFGzy5fFK/68tRO2hlKIQdV2vzXJ3YEEcx16SJKGyLP0SK6ieLwfM5/l5 106 | WBISoA5KxgiAlWC9iX5HSNBlkqCLV8AYIyEkibfoDVocAT7I8VbQbHWgaLHXFX1fGDgCKeUVIbA7cV2B 107 | 7ySOQDfNzgjjGRX9vXiEBc3uczR/ncCEq+X28rv7pG/QDqNyzqmRjv8LVgAwgRdpmlK2yQZxrmDQk+NR 108 | 9AE47sSEPD2a+wAAAABJRU5ErkJggg== 109 | 110 | 111 | 112 | 113 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 114 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE6SURBVDhPhZI9boNAEIU5Qo6QI+QM9Egp6anDAaho3NiN 115 | z0LrCKU0nQt6UodIOIifkuy3zKAlWORJI3bnvZk3s7bnouu6l2EY7kTTNE+S9jhrHo2ktzDkRxzHU5Zl 116 | U9/3qaQ9zuTg0Eh6C+Mw+b4/hWE46RTqTg4Ojci3aNv2M4oiK9Qp1J0cHBqRb4E4z/PVFK57URSr1R4C 117 | B3bVKdSd3K67wji8lmW5TKHu5OBEtg8z9u1wONhCIkkS1rkJ/T94aUa+XgsbQRDsvz4wgjMiDYoul3fb 118 | gClczsRZymaQYEeKEOvXDZdDu2pCV4j4LZ7qr2/7eyOu69oGZ5dDS42Uzw1sgRHcmx/75V5VlRU+4mg8 119 | juPz0oCux+PJCtI0XVz2OFsMzGXzBrrnHiflM0S8uLp/2b8c95nxvF92DupZ7oH5WgAAAABJRU5ErkJg 120 | gg== 121 | 122 | 123 | 124 | 125 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 126 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAB4SURBVDhPtc9RCoAgDMbxzuZJAo9pN/KhetkejQWD/HLq 127 | oAZ/ItIfbZEhomLFzOt9qDdyMITwKsZYcs5jRIFjP6tS2uYQC0DEXKkF6BrPzL+xAHw3V5oF5NlEPICk 128 | iNxzAZgLwP4BsNZFTb5XAOYCcD4DRnWBuahc6R2LWkqXAfkAAAAASUVORK5CYII= 129 | 130 | 131 | 132 | 133 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 134 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACaSURBVDhPvZFBCsMgEEU9Qs/k2TyGe6/RrWdxYRPEbcof 135 | /MTaZGpa6MDDcfQ/AzFj5ZxvpZR7rXUD6DFrx58LAe/9Zq0V0GPWjo+Lr4GUkgSdcwL6/hy02F4Y8kXy 136 | yIswzlUBAwz3Eq5TgiOmBRr/EazLKn8ixqjyIhoFuIC9xpTg7EumBVx7LgtGQgjnAsJLGm+Cb2jxX8qY 137 | J5nBJhUlLbsqAAAAAElFTkSuQmCC 138 | 139 | 140 | -------------------------------------------------------------------------------- /OpenTK.GLControl.TestForm/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using OpenTK.Graphics.OpenGL4; 4 | using OpenTK.Mathematics; 5 | 6 | namespace OpenTK.GLControl.TestForm 7 | { 8 | public partial class Form1 : Form 9 | { 10 | private Timer _timer = null!; 11 | private float _angle = 0.0f; 12 | 13 | public Form1() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void exitToolStripMenuItem_Click(object sender, EventArgs e) 19 | { 20 | Close(); 21 | } 22 | 23 | private void aboutToolStripMenuItem_Click(object sender, EventArgs e) 24 | { 25 | MessageBox.Show(this, 26 | "This demonstrates a simple use of the new OpenTK 4.x GLControl.", 27 | "GLControl Test Form", 28 | MessageBoxButtons.OK); 29 | } 30 | 31 | private static readonly Vector3[] VertexData = new Vector3[] 32 | { 33 | new Vector3(-1.0f, -1.0f, -1.0f), 34 | new Vector3(-1.0f, 1.0f, -1.0f), 35 | new Vector3(1.0f, 1.0f, -1.0f), 36 | new Vector3(1.0f, -1.0f, -1.0f), 37 | 38 | new Vector3(-1.0f, -1.0f, -1.0f), 39 | new Vector3(1.0f, -1.0f, -1.0f), 40 | new Vector3(1.0f, -1.0f, 1.0f), 41 | new Vector3(-1.0f, -1.0f, 1.0f), 42 | 43 | new Vector3(-1.0f, -1.0f, -1.0f), 44 | new Vector3(-1.0f, -1.0f, 1.0f), 45 | new Vector3(-1.0f, 1.0f, 1.0f), 46 | new Vector3(-1.0f, 1.0f, -1.0f), 47 | 48 | new Vector3(-1.0f, -1.0f, 1.0f), 49 | new Vector3(1.0f, -1.0f, 1.0f), 50 | new Vector3(1.0f, 1.0f, 1.0f), 51 | new Vector3(-1.0f, 1.0f, 1.0f), 52 | 53 | new Vector3(-1.0f, 1.0f, -1.0f), 54 | new Vector3(-1.0f, 1.0f, 1.0f), 55 | new Vector3(1.0f, 1.0f, 1.0f), 56 | new Vector3(1.0f, 1.0f, -1.0f), 57 | 58 | new Vector3(1.0f, -1.0f, -1.0f), 59 | new Vector3(1.0f, 1.0f, -1.0f), 60 | new Vector3(1.0f, 1.0f, 1.0f), 61 | new Vector3(1.0f, -1.0f, 1.0f), 62 | }; 63 | 64 | private static readonly int[] IndexData = new int[] 65 | { 66 | 0, 1, 2, 2, 3, 0, 67 | 4, 5, 6, 6, 7, 4, 68 | 8, 9, 10, 10, 11, 8, 69 | 12, 13, 14, 14, 15, 12, 70 | 16, 17, 18, 18, 19, 16, 71 | 20, 21, 22, 22, 23, 20, 72 | }; 73 | 74 | private static readonly Color4[] ColorData = new Color4[] 75 | { 76 | Color4.Silver, Color4.Silver, Color4.Silver, Color4.Silver, 77 | Color4.Honeydew, Color4.Honeydew, Color4.Honeydew, Color4.Honeydew, 78 | Color4.Moccasin, Color4.Moccasin, Color4.Moccasin, Color4.Moccasin, 79 | Color4.IndianRed, Color4.IndianRed, Color4.IndianRed, Color4.IndianRed, 80 | Color4.PaleVioletRed, Color4.PaleVioletRed, Color4.PaleVioletRed, Color4.PaleVioletRed, 81 | Color4.ForestGreen, Color4.ForestGreen, Color4.ForestGreen, Color4.ForestGreen, 82 | }; 83 | 84 | private const string VertexShaderSource = @"#version 330 core 85 | 86 | layout(location = 0) in vec3 aPos; 87 | layout(location = 1) in vec4 aColor; 88 | 89 | out vec4 fColor; 90 | 91 | uniform mat4 MVP; 92 | 93 | void main() 94 | { 95 | gl_Position = vec4(aPos, 1) * MVP; 96 | fColor = aColor; 97 | } 98 | "; 99 | 100 | private const string FragmentShaderSource = @"#version 330 core 101 | 102 | in vec4 fColor; 103 | 104 | out vec4 oColor; 105 | 106 | void main() 107 | { 108 | oColor = fColor; 109 | } 110 | "; 111 | 112 | private int CubeShader; 113 | 114 | private int VAO; 115 | private int EBO; 116 | private int PositionBuffer; 117 | private int ColorBuffer; 118 | 119 | private void glControl_Load(object? sender, EventArgs e) 120 | { 121 | // Make sure that when the GLControl is resized or needs to be painted, 122 | // we update our projection matrix or re-render its contents, respectively. 123 | glControl.Resize += glControl_Resize; 124 | glControl.Paint += glControl_Paint; 125 | 126 | // Redraw the screen every 1/20 of a second. 127 | _timer = new Timer(); 128 | _timer.Tick += (sender, e) => 129 | { 130 | const float DELTA_TIME = 1 / 50f; 131 | _angle += 180f * DELTA_TIME; 132 | Render(); 133 | }; 134 | _timer.Interval = 50; // 1000 ms per sec / 50 ms per frame = 20 FPS 135 | _timer.Start(); 136 | 137 | // Ensure that the viewport and projection matrix are set correctly initially. 138 | glControl_Resize(glControl, EventArgs.Empty); 139 | 140 | CubeShader = CompileProgram(VertexShaderSource, FragmentShaderSource); 141 | 142 | VAO = GL.GenVertexArray(); 143 | GL.BindVertexArray(VAO); 144 | 145 | EBO = GL.GenBuffer(); 146 | GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO); 147 | GL.BufferData(BufferTarget.ElementArrayBuffer, IndexData.Length * sizeof(int), IndexData, BufferUsageHint.StaticDraw); 148 | 149 | PositionBuffer = GL.GenBuffer(); 150 | GL.BindBuffer(BufferTarget.ArrayBuffer, PositionBuffer); 151 | GL.BufferData(BufferTarget.ArrayBuffer, VertexData.Length * sizeof(float) * 3, VertexData, BufferUsageHint.StaticDraw); 152 | 153 | GL.EnableVertexAttribArray(0); 154 | GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, sizeof(float) * 3, 0); 155 | 156 | ColorBuffer = GL.GenBuffer(); 157 | GL.BindBuffer(BufferTarget.ArrayBuffer, ColorBuffer); 158 | GL.BufferData(BufferTarget.ArrayBuffer, ColorData.Length * sizeof(float) * 4, ColorData, BufferUsageHint.StaticDraw); 159 | 160 | GL.EnableVertexAttribArray(1); 161 | GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, sizeof(float) * 4, 0); 162 | } 163 | 164 | private int CompileProgram(string vertexShader, string fragmentShader) 165 | { 166 | int program = GL.CreateProgram(); 167 | 168 | int vert = CompileShader(ShaderType.VertexShader, vertexShader); 169 | int frag = CompileShader(ShaderType.FragmentShader, fragmentShader); 170 | 171 | GL.AttachShader(program, vert); 172 | GL.AttachShader(program, frag); 173 | 174 | GL.LinkProgram(program); 175 | 176 | GL.GetProgram(program, GetProgramParameterName.LinkStatus, out int success); 177 | if (success == 0) 178 | { 179 | string log = GL.GetProgramInfoLog(program); 180 | throw new Exception($"Could not link program: {log}"); 181 | } 182 | 183 | GL.DetachShader(program, vert); 184 | GL.DetachShader(program, frag); 185 | 186 | GL.DeleteShader(vert); 187 | GL.DeleteShader(frag); 188 | 189 | return program; 190 | 191 | static int CompileShader(ShaderType type, string source) 192 | { 193 | int shader = GL.CreateShader(type); 194 | 195 | GL.ShaderSource(shader, source); 196 | GL.CompileShader(shader); 197 | 198 | GL.GetShader(shader, ShaderParameter.CompileStatus, out int status); 199 | if (status == 0) 200 | { 201 | string log = GL.GetShaderInfoLog(shader); 202 | throw new Exception($"Failed to compile {type}: {log}"); 203 | } 204 | 205 | return shader; 206 | } 207 | } 208 | 209 | private void glControl_Resize(object? sender, EventArgs e) 210 | { 211 | glControl.MakeCurrent(); 212 | 213 | if (glControl.ClientSize.Height == 0) 214 | glControl.ClientSize = new System.Drawing.Size(glControl.ClientSize.Width, 1); 215 | 216 | GL.Viewport(0, 0, glControl.ClientSize.Width, glControl.ClientSize.Height); 217 | 218 | float aspect_ratio = Math.Max(glControl.ClientSize.Width, 1) / (float)Math.Max(glControl.ClientSize.Height, 1); 219 | projection = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 1, 64); 220 | } 221 | 222 | private void glControl_Paint(object sender, PaintEventArgs e) 223 | { 224 | Render(); 225 | } 226 | 227 | Matrix4 projection; 228 | 229 | private void Render() 230 | { 231 | glControl.MakeCurrent(); 232 | 233 | GL.ClearColor(Color4.MidnightBlue); 234 | GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); 235 | 236 | GL.Enable(EnableCap.DepthTest); 237 | 238 | Matrix4 lookat = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0); 239 | Matrix4 model = Matrix4.CreateFromAxisAngle(new Vector3(0.0f, 1.0f, 0.0f), MathHelper.DegreesToRadians(_angle)); 240 | 241 | Matrix4 mvp = model * lookat * projection; 242 | 243 | GL.UseProgram(CubeShader); 244 | GL.UniformMatrix4(GL.GetUniformLocation(CubeShader, "MVP"), true, ref mvp); 245 | 246 | 247 | GL.DrawElements(BeginMode.Triangles, IndexData.Length, DrawElementsType.UnsignedInt, 0); 248 | 249 | glControl.SwapBuffers(); 250 | } 251 | } 252 | } 253 | -------------------------------------------------------------------------------- /OpenTK.GLControl/GLControlSettings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using OpenTK.Windowing.Common; 3 | using OpenTK.Windowing.Desktop; 4 | 5 | namespace OpenTK.GLControl 6 | { 7 | /// 8 | /// Configuration settings for a GLControl. The properties here are a subset 9 | /// of the NativeWindowSettings properties, restricted to those that make 10 | /// sense in a WinForms environment. 11 | /// 12 | public class GLControlSettings 13 | { 14 | /// 15 | /// Gets the default settings for a . 16 | /// 17 | public static readonly GLControlSettings Default = new GLControlSettings(); 18 | 19 | /// 20 | /// Gets or sets a value representing the current version of the graphics API. 21 | /// 22 | /// 23 | /// 24 | /// OpenGL 3.3 is selected by default, and runs on almost any hardware made within the last ten years. 25 | /// This will run on Windows, Mac OS, and Linux. 26 | /// 27 | /// 28 | /// OpenGL 4.1 is suggested for modern apps meant to run on more modern hardware. 29 | /// This will run on Windows, Mac OS, and Linux. 30 | /// 31 | /// 32 | /// OpenGL 4.6 is suggested for modern apps that only intend to run on Windows and Linux; 33 | /// Mac OS doesn't support it. 34 | /// 35 | /// 36 | /// Note that if you choose an API other than base OpenGL, this will need to be updated accordingly, 37 | /// as the versioning of OpenGL and OpenGL ES do not match. 38 | /// 39 | /// 40 | public Version APIVersion { get; set; } = new Version(3, 3, 0, 0); 41 | 42 | /// 43 | /// Gets or sets a value indicating whether or not OpenGL bindings should be automatically loaded 44 | /// when the window is created. 45 | /// 46 | public bool AutoLoadBindings { get; set; } = true; 47 | 48 | /// 49 | /// Gets or sets a value representing the current graphics profile flags. 50 | /// 51 | public ContextFlags Flags { get; set; } = ContextFlags.Default; 52 | 53 | /// 54 | /// Gets or sets a value representing the current graphics API profile. 55 | /// 56 | /// 57 | /// 58 | /// This only has an effect on OpenGL 3.2 and higher. On older versions, this setting does nothing. 59 | /// 60 | /// 61 | public ContextProfile Profile { get; set; } = ContextProfile.Core; 62 | 63 | /// 64 | /// Gets or sets a value representing the current graphics API. 65 | /// 66 | /// 67 | /// 68 | /// If this is changed, you'll have to modify the API version as well, as the versioning of OpenGL and OpenGL ES 69 | /// do not match. 70 | /// 71 | /// 72 | public ContextAPI API { get; set; } = ContextAPI.OpenGL; 73 | 74 | /// 75 | /// Gets or sets a value indicating whether or not this window is event-driven. 76 | /// An event-driven window will wait for events before updating/rendering. It is useful for non-game applications, 77 | /// where the program only needs to do any processing after the user inputs something. 78 | /// 79 | public bool IsEventDriven { get; set; } = true; 80 | 81 | /// 82 | /// Gets or sets the context to share. 83 | /// 84 | public IGLFWGraphicsContext? SharedContext { get; set; } 85 | 86 | /// 87 | /// Gets or sets a value indicating the number of samples that should be used. 88 | /// 89 | /// 90 | /// 0 indicates that no multisampling should be used; 91 | /// otherwise multisampling is used if available. The actual number of samples is the closest matching the given number that is supported. 92 | /// 93 | public int NumberOfSamples { get; set; } 94 | 95 | /// 96 | /// Gets or sets a value indicating the number of stencil bits used for OpenGL context creation. 97 | /// 98 | /// 99 | /// Default value is 8. 100 | /// 101 | public int? StencilBits { get; set; } 102 | 103 | /// 104 | /// Gets or sets a value indicating the number of depth bits used for OpenGL context creation. 105 | /// 106 | /// 107 | /// Default value is 24. 108 | /// 109 | public int? DepthBits { get; set; } 110 | 111 | /// 112 | /// Gets or sets a value indicating the number of red bits used for OpenGL context creation. 113 | /// 114 | /// 115 | /// Default value is 8. 116 | /// 117 | public int? RedBits { get; set; } 118 | 119 | /// 120 | /// Gets or sets a value indicating the number of green bits used for OpenGL context creation. 121 | /// 122 | /// 123 | /// Default value is 8. 124 | /// 125 | public int? GreenBits { get; set; } 126 | 127 | /// 128 | /// Gets or sets a value indicating the number of blue bits used for OpenGL context creation. 129 | /// 130 | /// 131 | /// Default value is 8. 132 | /// 133 | public int? BlueBits { get; set; } 134 | 135 | /// 136 | /// Gets or sets a value indicating the number of alpha bits used for OpenGL context creation. 137 | /// 138 | /// 139 | /// Default value is 8. 140 | /// 141 | public int? AlphaBits { get; set; } 142 | 143 | /// 144 | /// Gets or sets a value indicating whether the backbuffer should be sRGB capable. 145 | /// 146 | public bool SrgbCapable { get; set; } 147 | 148 | /// 149 | /// Make a perfect shallow copy of this object. 150 | /// 151 | /// A perfect shallow copy of this GLControlSettings object. 152 | public GLControlSettings Clone() 153 | { 154 | return new GLControlSettings() 155 | { 156 | APIVersion = APIVersion, 157 | AutoLoadBindings = AutoLoadBindings, 158 | Flags = Flags, 159 | Profile = Profile, 160 | API = API, 161 | IsEventDriven = IsEventDriven, 162 | SharedContext = SharedContext, 163 | NumberOfSamples = NumberOfSamples, 164 | StencilBits = StencilBits, 165 | DepthBits = DepthBits, 166 | RedBits = RedBits, 167 | GreenBits = GreenBits, 168 | BlueBits = BlueBits, 169 | AlphaBits = AlphaBits, 170 | SrgbCapable = SrgbCapable, 171 | }; 172 | } 173 | 174 | /// 175 | /// Derive a NativeWindowSettings object from this GLControlSettings object. 176 | /// The NativeWindowSettings has all of our properties and more, but many of 177 | /// its properties cannot be reasonably configured by the user when a 178 | /// NativeWindow is being used as a child window. 179 | /// 180 | /// The NativeWindowSettings to use when constructing a new 181 | /// NativeWindow. 182 | public NativeWindowSettings ToNativeWindowSettings() 183 | { 184 | return new NativeWindowSettings() 185 | { 186 | APIVersion = FixupVersion(APIVersion), 187 | AutoLoadBindings = AutoLoadBindings, 188 | Flags = Flags, 189 | Profile = Profile, 190 | API = API, 191 | IsEventDriven = IsEventDriven, 192 | SharedContext = SharedContext, 193 | NumberOfSamples = NumberOfSamples, 194 | StencilBits = StencilBits, 195 | DepthBits = DepthBits, 196 | RedBits = RedBits, 197 | GreenBits = GreenBits, 198 | BlueBits = BlueBits, 199 | AlphaBits = AlphaBits, 200 | SrgbCapable = SrgbCapable, 201 | 202 | StartFocused = false, 203 | StartVisible = false, 204 | WindowBorder = WindowBorder.Hidden, 205 | WindowState = WindowState.Normal, 206 | }; 207 | } 208 | 209 | /// 210 | /// The WinForms Designer has bugs when it comes to editing Version objects: 211 | /// Many times when a component is left out, it is treated not as 0, but as -1! 212 | /// So this little method corrects for bad data from the WinForms designer. 213 | /// 214 | /// A version number. 215 | /// The same version number, but with all negative values clipped to 0. 216 | private static Version FixupVersion(Version version) 217 | { 218 | return new Version( 219 | Math.Max(version.Major, 0), 220 | Math.Max(version.Minor, 0), 221 | Math.Max(version.Build, 0), 222 | Math.Max(version.Revision, 0) 223 | ); 224 | } 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /OpenTK.GLControl/NativeInput.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using OpenTK.Mathematics; 4 | using OpenTK.Windowing.Common; 5 | using OpenTK.Windowing.Desktop; 6 | using OpenTK.Windowing.GraphicsLibraryFramework; 7 | 8 | namespace OpenTK.GLControl 9 | { 10 | /// 11 | /// This proxy class provides access to the native input methods and properties 12 | /// exposed by OpenTK, where those methods and properties are safe to invoke. 13 | /// In general, you should prefer to use WinForms's keyboard/mouse input, but 14 | /// if you need access to "raw" device input within a GLControl, this class 15 | /// provides that access. 16 | /// 17 | /// Instances of this class are only instantiated if they are required; we 18 | /// don't make one of these if we don't need it. 19 | /// 20 | internal class NativeInput : INativeInput 21 | { 22 | #region Private/internal data 23 | 24 | /// 25 | /// Access to the underlying NativeWindow. 26 | /// 27 | private readonly NativeWindow _nativeWindow; 28 | 29 | #endregion 30 | 31 | #region Public properties 32 | 33 | /// 34 | /// Gets or sets the position of the mouse relative to the content area of this window. 35 | /// 36 | public Vector2 MousePosition 37 | { 38 | get => _nativeWindow.MousePosition; 39 | set => _nativeWindow.MousePosition = value; 40 | } 41 | 42 | /// 43 | /// Gets the current state of the keyboard as of the last time the window processed 44 | /// events. 45 | /// 46 | public KeyboardState KeyboardState 47 | => _nativeWindow.KeyboardState; 48 | 49 | /// 50 | /// Gets the current state of the joysticks as of the last time the window processed 51 | /// events. 52 | /// 53 | public IReadOnlyList JoystickStates 54 | => _nativeWindow.JoystickStates; 55 | 56 | /// 57 | /// Gets the current state of the mouse as of the last time the window processed 58 | /// events. 59 | /// 60 | public MouseState MouseState 61 | => _nativeWindow.MouseState; 62 | 63 | /// 64 | /// Gets a value indicating whether any key is down. 65 | /// 66 | public bool IsAnyKeyDown 67 | => _nativeWindow.IsAnyKeyDown; 68 | 69 | /// 70 | /// Gets a value indicating whether any mouse button is pressed. 71 | /// 72 | public bool IsAnyMouseButtonDown 73 | => _nativeWindow.IsAnyMouseButtonDown; 74 | 75 | #endregion 76 | 77 | #region Public events 78 | 79 | /// 80 | /// Occurs whenever the mouse cursor is moved 81 | /// 82 | public event Action MouseMove 83 | { 84 | add => _nativeWindow.MouseMove += value; 85 | remove => _nativeWindow.MouseMove -= value; 86 | } 87 | 88 | /// 89 | /// Occurs whenever a OpenTK.Windowing.GraphicsLibraryFramework.MouseButton is released. 90 | /// 91 | public event Action MouseUp 92 | { 93 | add => _nativeWindow.MouseUp += value; 94 | remove => _nativeWindow.MouseUp -= value; 95 | } 96 | 97 | /// 98 | /// Occurs whenever a OpenTK.Windowing.GraphicsLibraryFramework.MouseButton is clicked. 99 | /// 100 | public event Action MouseDown 101 | { 102 | add => _nativeWindow.MouseDown += value; 103 | remove => _nativeWindow.MouseDown -= value; 104 | } 105 | 106 | /// 107 | /// Occurs whenever the mouse cursor enters the window OpenTK.Windowing.Desktop.NativeWindow.Bounds. 108 | /// 109 | public event Action MouseEnter 110 | { 111 | add => _nativeWindow.MouseEnter += value; 112 | remove => _nativeWindow.MouseEnter -= value; 113 | } 114 | 115 | /// 116 | /// Occurs whenever the mouse cursor leaves the window OpenTK.Windowing.Desktop.NativeWindow.Bounds. 117 | /// 118 | public event Action MouseLeave 119 | { 120 | add => _nativeWindow.MouseLeave += value; 121 | remove => _nativeWindow.MouseLeave -= value; 122 | } 123 | 124 | /// 125 | /// Occurs whenever a keyboard key is released. 126 | /// 127 | public event Action KeyUp 128 | { 129 | add => _nativeWindow.KeyUp += value; 130 | remove => _nativeWindow.KeyUp -= value; 131 | } 132 | 133 | /// 134 | /// Occurs whenever a Unicode code point is typed. 135 | /// 136 | public event Action TextInput 137 | { 138 | add => _nativeWindow.TextInput += value; 139 | remove => _nativeWindow.TextInput -= value; 140 | } 141 | 142 | /// 143 | /// Occurs when a joystick is connected or disconnected. 144 | /// 145 | public event Action JoystickConnected 146 | { 147 | add => _nativeWindow.JoystickConnected += value; 148 | remove => _nativeWindow.JoystickConnected -= value; 149 | } 150 | 151 | /// 152 | /// Occurs whenever a keyboard key is pressed. 153 | /// 154 | public event Action KeyDown 155 | { 156 | add => _nativeWindow.KeyDown += value; 157 | remove => _nativeWindow.KeyDown -= value; 158 | } 159 | 160 | /// 161 | /// Occurs whenever one or more files are dropped on the window. 162 | /// 163 | public event Action FileDrop 164 | { 165 | add => _nativeWindow.FileDrop += value; 166 | remove => _nativeWindow.FileDrop -= value; 167 | } 168 | 169 | /// 170 | /// Occurs whenever a mouse wheel is moved. 171 | /// 172 | public event Action MouseWheel 173 | { 174 | add => _nativeWindow.MouseWheel += value; 175 | remove => _nativeWindow.MouseWheel -= value; 176 | } 177 | 178 | #endregion 179 | 180 | #region Construction 181 | 182 | /// 183 | /// Construct a new instance of a NativeInput proxy. 184 | /// 185 | /// The NativeWindow that this NativeInput is wrapping. 186 | internal NativeInput(NativeWindow nativeWindow) 187 | { 188 | _nativeWindow = nativeWindow; 189 | } 190 | 191 | #endregion 192 | 193 | #region Public methods 194 | 195 | /// 196 | /// Gets a indicating whether this key is currently down. 197 | /// 198 | /// The key to check. 199 | /// true if is in the down state; otherwise, false. 200 | public bool IsKeyDown(Keys key) 201 | => _nativeWindow.IsKeyDown(key); 202 | 203 | /// 204 | /// Gets whether the specified key is pressed in the current frame but released in the previous frame. 205 | /// 206 | /// 207 | /// "Frame" refers to invocations of here. 208 | /// 209 | /// The key to check. 210 | /// True if the key is pressed in this frame, but not the last frame. 211 | public bool IsKeyPressed(Keys key) 212 | => _nativeWindow.IsKeyPressed(key); 213 | 214 | /// 215 | /// Gets whether the specified key is released in the current frame but pressed in the previous frame. 216 | /// 217 | /// 218 | /// "Frame" refers to invocations of here. 219 | /// 220 | /// The key to check. 221 | /// True if the key is released in this frame, but pressed the last frame. 222 | public bool IsKeyReleased(Keys key) 223 | => _nativeWindow.IsKeyReleased(key); 224 | 225 | /// 226 | /// Gets a indicating whether this button is currently down. 227 | /// 228 | /// The to check. 229 | /// true if is in the down state; otherwise, false. 230 | public bool IsMouseButtonDown(MouseButton button) 231 | => _nativeWindow.IsMouseButtonDown(button); 232 | 233 | 234 | /// 235 | /// Gets whether the specified mouse button is pressed in the current frame but released in the previous frame. 236 | /// 237 | /// 238 | /// "Frame" refers to invocations of here. 239 | /// 240 | /// The button to check. 241 | /// True if the button is pressed in this frame, but not the last frame. 242 | public bool IsMouseButtonPressed(MouseButton button) 243 | => _nativeWindow.IsMouseButtonPressed(button); 244 | 245 | /// 246 | /// Gets whether the specified mouse button is released in the current frame but pressed in the previous frame. 247 | /// 248 | /// 249 | /// "Frame" refers to invocations of here. 250 | /// 251 | /// The button to check. 252 | /// True if the button is released in this frame, but pressed the last frame. 253 | public bool IsMouseButtonReleased(MouseButton button) 254 | => _nativeWindow.IsMouseButtonReleased(button); 255 | 256 | #endregion 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /OpenTK.GLControl.MultiControlTest/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Windows.Forms; 5 | using OpenTK.Graphics.OpenGL4; 6 | using OpenTK.Mathematics; 7 | 8 | namespace OpenTK.GLControl.MultiControlTest 9 | { 10 | public partial class Form1 : Form 11 | { 12 | public class GLControlContext 13 | { 14 | public GLControl GLControl; 15 | public int VAO; 16 | public int CubeShader; 17 | 18 | public Matrix4 projection; 19 | public Matrix4 view; 20 | public Matrix4 model; 21 | 22 | public GLControlContext(GLControl control) 23 | { 24 | GLControl = control; 25 | } 26 | } 27 | 28 | public Dictionary Contexts = new Dictionary(); 29 | 30 | public int EBO; 31 | public int PositionBuffer; 32 | public int ColorBuffer; 33 | 34 | private Timer _timer = null!; 35 | private float _angle = 0.0f; 36 | 37 | public Form1() 38 | { 39 | // We setup context sharing in the designer properies. 40 | // glControl1 is the context that is shared. 41 | InitializeComponent(); 42 | } 43 | 44 | private void exitToolStripMenuItem_Click(object sender, EventArgs e) 45 | { 46 | Close(); 47 | } 48 | 49 | private void aboutToolStripMenuItem_Click(object sender, EventArgs e) 50 | { 51 | MessageBox.Show(this, 52 | "This demonstrates how to use multiple instances of the new OpenTK 4.x GLControl.", 53 | "Multi GLControl Test", 54 | MessageBoxButtons.OK); 55 | } 56 | 57 | protected override void OnLoad(EventArgs e) 58 | { 59 | base.OnLoad(e); 60 | 61 | Contexts.Add(glControl1, new GLControlContext(glControl1)); 62 | Contexts.Add(glControl2, new GLControlContext(glControl2)); 63 | Contexts.Add(glControl3, new GLControlContext(glControl3)); 64 | Contexts.Add(glControl4, new GLControlContext(glControl4)); 65 | 66 | // Update each control if it's resized or needs to be painted. 67 | glControl1.Resize += (sender, e) => SetupProjection(Contexts[(GLControl)sender]); 68 | glControl1.Paint += (sender, e) => RenderControl1(Contexts[(GLControl)sender]); 69 | 70 | glControl2.Resize += (sender, e) => SetupProjection(Contexts[(GLControl)sender]); 71 | glControl2.Paint += (sender, e) => RenderControl2(Contexts[(GLControl)sender]); 72 | 73 | glControl3.Resize += (sender, e) => SetupProjection(Contexts[(GLControl)sender]); 74 | glControl3.Paint += (sender, e) => RenderControl3(Contexts[(GLControl)sender]); 75 | 76 | glControl4.Resize += (sender, e) => SetupProjection(Contexts[(GLControl)sender]); 77 | glControl4.Paint += (sender, e) => RenderControl4(Contexts[(GLControl)sender]); 78 | 79 | // Redraw each control every 1/20 of a second. 80 | _timer = new Timer(); 81 | _timer.Tick += (sender, e) => 82 | { 83 | const float DELTA_TIME = 1 / 50f; 84 | _angle += 180f * DELTA_TIME; 85 | RenderControl1(Contexts[glControl1]); 86 | RenderControl2(Contexts[glControl2]); 87 | RenderControl3(Contexts[glControl3]); 88 | RenderControl4(Contexts[glControl4]); 89 | }; 90 | _timer.Interval = 50; // 1000 ms per sec / 50 ms per frame = 20 FPS 91 | _timer.Start(); 92 | 93 | // Load the shared data as well as the context specific data. 94 | LoadShared(); 95 | LoadContextSpecific(Contexts[glControl1]); 96 | LoadContextSpecific(Contexts[glControl2]); 97 | LoadContextSpecific(Contexts[glControl3]); 98 | LoadContextSpecific(Contexts[glControl4]); 99 | 100 | // Ensure that the viewport and projection matrix are initially 101 | // set correctly for each control. 102 | SetupProjection(Contexts[glControl1]); 103 | SetupProjection(Contexts[glControl2]); 104 | SetupProjection(Contexts[glControl3]); 105 | SetupProjection(Contexts[glControl4]); 106 | } 107 | 108 | public void LoadShared() 109 | { 110 | glControl1.MakeCurrent(); 111 | PositionBuffer = GL.GenBuffer(); 112 | GL.BindBuffer(BufferTarget.ArrayBuffer, PositionBuffer); 113 | GL.BufferData(BufferTarget.ArrayBuffer, VertexData.Length * sizeof(float) * 3, VertexData, BufferUsageHint.StaticDraw); 114 | 115 | ColorBuffer = GL.GenBuffer(); 116 | GL.BindBuffer(BufferTarget.ArrayBuffer, ColorBuffer); 117 | GL.BufferData(BufferTarget.ArrayBuffer, ColorData.Length * sizeof(float) * 4, ColorData, BufferUsageHint.StaticDraw); 118 | 119 | EBO = GL.GenBuffer(); 120 | GL.BindBuffer(BufferTarget.ArrayBuffer, EBO); 121 | GL.BufferData(BufferTarget.ArrayBuffer, IndexData.Length * sizeof(int), IndexData, BufferUsageHint.StaticDraw); 122 | } 123 | 124 | public void LoadContextSpecific(GLControlContext context) 125 | { 126 | context.GLControl.MakeCurrent(); 127 | 128 | context.CubeShader = CompileProgram(VertexShaderSource, FragmentShaderSource); 129 | 130 | context.VAO = GL.GenVertexArray(); 131 | GL.BindVertexArray(context.VAO); 132 | 133 | GL.BindBuffer(BufferTarget.ElementArrayBuffer, EBO); 134 | 135 | GL.BindBuffer(BufferTarget.ArrayBuffer, PositionBuffer); 136 | GL.EnableVertexAttribArray(0); 137 | GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, sizeof(float) * 3, 0); 138 | 139 | GL.BindBuffer(BufferTarget.ArrayBuffer, ColorBuffer); 140 | GL.EnableVertexAttribArray(1); 141 | GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, sizeof(float) * 4, 0); 142 | } 143 | 144 | // All four example GLControls in this demo use the same projection, 145 | // but they don't have to. 146 | private void SetupProjection(GLControlContext context) 147 | { 148 | context.GLControl.MakeCurrent(); 149 | 150 | if (context.GLControl.ClientSize.Height == 0) 151 | context.GLControl.ClientSize = new System.Drawing.Size(context.GLControl.ClientSize.Width, 1); 152 | 153 | GL.Viewport(0, 0, context.GLControl.ClientSize.Width, context.GLControl.ClientSize.Height); 154 | 155 | float aspect_ratio = Math.Max(context.GLControl.ClientSize.Width, 1) / (float)Math.Max(context.GLControl.ClientSize.Height, 1); 156 | context.projection = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspect_ratio, 1, 64); 157 | } 158 | 159 | // All four GLControls will render the same cube, but in different colors 160 | // and at different angles, to show that they are rendering independently. 161 | private void RenderControl1(GLControlContext context) 162 | { 163 | RenderCube(context, 1.0f, Color4.Black, Color4.Aqua); 164 | } 165 | 166 | private void RenderControl2(GLControlContext context) 167 | { 168 | RenderCube(context, 1.7f, Color4.MidnightBlue, Color4.Pink); 169 | } 170 | 171 | private void RenderControl3(GLControlContext context) 172 | { 173 | RenderCube(context, -1.0f, Color4.DarkGray, Color4.Orange); 174 | } 175 | 176 | private void RenderControl4(GLControlContext context) 177 | { 178 | RenderCube(context, -1.7f, Color4.DarkViolet, Color4.LightGreen); 179 | } 180 | 181 | private void RenderCube(GLControlContext context, float extraRotation, Color4 backgroundColor, Color4 cubeColor) 182 | { 183 | context.GLControl.MakeCurrent(); 184 | 185 | GL.ClearColor(backgroundColor); 186 | GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); 187 | 188 | GL.Enable(EnableCap.DepthTest); 189 | 190 | context.view = Matrix4.LookAt(0, 5, 5, 0, 0, 0, 0, 1, 0); 191 | context.model = Matrix4.CreateFromAxisAngle((0.0f, 1.0f, 0.0f), MathHelper.DegreesToRadians(_angle * extraRotation)); 192 | 193 | Matrix4 mvp = context.model * context.view * context.projection; 194 | 195 | GL.UseProgram(context.CubeShader); 196 | GL.UniformMatrix4(GL.GetUniformLocation(context.CubeShader, "MVP"), true, ref mvp); 197 | 198 | GL.DrawElements(BeginMode.Triangles, IndexData.Length, DrawElementsType.UnsignedInt, 0); 199 | 200 | context.GLControl.SwapBuffers(); 201 | } 202 | 203 | // Mix a given color A with another color B, in a range of 0 (100% A, 0% B) 204 | // to 255 (0% A, 100% B). 205 | private static Color4 MixColors(Color4 a, Color4 b, int amount) 206 | { 207 | int ia = 255 - amount; 208 | return new Color4( 209 | (a.R * ia + b.R * amount) / 255, 210 | (a.G * ia + b.G * amount) / 255, 211 | (a.B * ia + b.B * amount) / 255, 212 | 255 213 | ); 214 | } 215 | 216 | private static readonly Vector3[] VertexData = new Vector3[] 217 | { 218 | new Vector3(-1.0f, -1.0f, -1.0f), 219 | new Vector3(-1.0f, 1.0f, -1.0f), 220 | new Vector3(1.0f, 1.0f, -1.0f), 221 | new Vector3(1.0f, -1.0f, -1.0f), 222 | 223 | new Vector3(-1.0f, -1.0f, -1.0f), 224 | new Vector3(1.0f, -1.0f, -1.0f), 225 | new Vector3(1.0f, -1.0f, 1.0f), 226 | new Vector3(-1.0f, -1.0f, 1.0f), 227 | 228 | new Vector3(-1.0f, -1.0f, -1.0f), 229 | new Vector3(-1.0f, -1.0f, 1.0f), 230 | new Vector3(-1.0f, 1.0f, 1.0f), 231 | new Vector3(-1.0f, 1.0f, -1.0f), 232 | 233 | new Vector3(-1.0f, -1.0f, 1.0f), 234 | new Vector3(1.0f, -1.0f, 1.0f), 235 | new Vector3(1.0f, 1.0f, 1.0f), 236 | new Vector3(-1.0f, 1.0f, 1.0f), 237 | 238 | new Vector3(-1.0f, 1.0f, -1.0f), 239 | new Vector3(-1.0f, 1.0f, 1.0f), 240 | new Vector3(1.0f, 1.0f, 1.0f), 241 | new Vector3(1.0f, 1.0f, -1.0f), 242 | 243 | new Vector3(1.0f, -1.0f, -1.0f), 244 | new Vector3(1.0f, 1.0f, -1.0f), 245 | new Vector3(1.0f, 1.0f, 1.0f), 246 | new Vector3(1.0f, -1.0f, 1.0f), 247 | }; 248 | 249 | private static readonly Color4[] ColorData = new Color4[] 250 | { 251 | Color4.Silver, Color4.Silver, Color4.Silver, Color4.Silver, 252 | Color4.Honeydew, Color4.Honeydew, Color4.Honeydew, Color4.Honeydew, 253 | Color4.Moccasin, Color4.Moccasin, Color4.Moccasin, Color4.Moccasin, 254 | Color4.IndianRed, Color4.IndianRed, Color4.IndianRed, Color4.IndianRed, 255 | Color4.PaleVioletRed, Color4.PaleVioletRed, Color4.PaleVioletRed, Color4.PaleVioletRed, 256 | Color4.ForestGreen, Color4.ForestGreen, Color4.ForestGreen, Color4.ForestGreen, 257 | }; 258 | 259 | private static readonly int[] IndexData = new int[] 260 | { 261 | 0, 1, 2, 2, 3, 0, 262 | 4, 5, 6, 6, 7, 4, 263 | 8, 9, 10, 10, 11, 8, 264 | 12, 13, 14, 14, 15, 12, 265 | 16, 17, 18, 18, 19, 16, 266 | 20, 21, 22, 22, 23, 20, 267 | }; 268 | 269 | private const string VertexShaderSource = @"#version 330 core 270 | 271 | layout(location = 0) in vec3 aPos; 272 | layout(location = 1) in vec4 aColor; 273 | 274 | out vec4 fColor; 275 | 276 | uniform mat4 MVP; 277 | 278 | void main() 279 | { 280 | gl_Position = vec4(aPos, 1) * MVP; 281 | fColor = aColor; 282 | } 283 | "; 284 | 285 | private const string FragmentShaderSource = @"#version 330 core 286 | 287 | in vec4 fColor; 288 | 289 | out vec4 oColor; 290 | 291 | void main() 292 | { 293 | oColor = fColor; 294 | } 295 | "; 296 | 297 | private int CompileProgram(string vertexShader, string fragmentShader) 298 | { 299 | int program = GL.CreateProgram(); 300 | 301 | int vert = CompileShader(ShaderType.VertexShader, vertexShader); 302 | int frag = CompileShader(ShaderType.FragmentShader, fragmentShader); 303 | 304 | GL.AttachShader(program, vert); 305 | GL.AttachShader(program, frag); 306 | 307 | GL.LinkProgram(program); 308 | 309 | GL.GetProgram(program, GetProgramParameterName.LinkStatus, out int success); 310 | if (success == 0) 311 | { 312 | string log = GL.GetProgramInfoLog(program); 313 | throw new Exception($"Could not link program: {log}"); 314 | } 315 | 316 | GL.DetachShader(program, vert); 317 | GL.DetachShader(program, frag); 318 | 319 | GL.DeleteShader(vert); 320 | GL.DeleteShader(frag); 321 | 322 | return program; 323 | 324 | static int CompileShader(ShaderType type, string source) 325 | { 326 | int shader = GL.CreateShader(type); 327 | 328 | GL.ShaderSource(shader, source); 329 | GL.CompileShader(shader); 330 | 331 | GL.GetShader(shader, ShaderParameter.CompileStatus, out int status); 332 | if (status == 0) 333 | { 334 | string log = GL.GetShaderInfoLog(shader); 335 | throw new Exception($"Failed to compile {type}: {log}"); 336 | } 337 | 338 | return shader; 339 | } 340 | } 341 | } 342 | } 343 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/vim,osx,linux,macos,emacs,fsharp,csharp,windows,android,monodevelop,intellij+all,visualstudio,xamarinstudio,visualstudiocode 3 | 4 | ### Android ### 5 | # Built application files 6 | *.apk 7 | *.ap_ 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | 23 | # Local configuration file (sdk path, etc) 24 | local.properties 25 | 26 | # Proguard folder generated by Eclipse 27 | proguard/ 28 | 29 | # Log Files 30 | *.log 31 | 32 | # Android Studio Navigation editor temp files 33 | .navigation/ 34 | 35 | # Android Studio captures folder 36 | captures/ 37 | 38 | # Intellij 39 | *.iml 40 | .idea/workspace.xml 41 | .idea/tasks.xml 42 | .idea/gradle.xml 43 | .idea/dictionaries 44 | .idea/libraries 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Freeline 50 | freeline.py 51 | freeline/ 52 | freeline_project_description.json 53 | 54 | ### Android Patch ### 55 | gen-external-apklibs 56 | 57 | ### Csharp ### 58 | ## Ignore Visual Studio temporary files, build results, and 59 | ## files generated by popular Visual Studio add-ons. 60 | ## 61 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 62 | 63 | # User-specific files 64 | *.suo 65 | *.user 66 | *.userosscache 67 | *.sln.docstates 68 | 69 | # User-specific files (MonoDevelop/Xamarin Studio) 70 | *.userprefs 71 | 72 | # Build results 73 | [Dd]ebug/ 74 | [Dd]ebugPublic/ 75 | [Rr]elease/ 76 | [Rr]eleases/ 77 | x64/ 78 | x86/ 79 | bld/ 80 | [Bb]in/ 81 | [Oo]bj/ 82 | [Ll]og/ 83 | 84 | # Visual Studio 2015 cache/options directory 85 | .vs/ 86 | # Uncomment if you have tasks that create the project's static files in wwwroot 87 | #wwwroot/ 88 | 89 | # MSTest test Results 90 | [Tt]est[Rr]esult*/ 91 | [Bb]uild[Ll]og.* 92 | 93 | # NUNIT 94 | *.VisualState.xml 95 | TestResult.xml 96 | 97 | # Build Results of an ATL Project 98 | [Dd]ebugPS/ 99 | [Rr]eleasePS/ 100 | dlldata.c 101 | 102 | # .NET Core 103 | project.lock.json 104 | project.fragment.lock.json 105 | artifacts/ 106 | **/Properties/launchSettings.json 107 | 108 | *_i.c 109 | *_p.c 110 | *_i.h 111 | *.ilk 112 | *.meta 113 | *.obj 114 | *.pch 115 | *.pdb 116 | *.pgc 117 | *.pgd 118 | *.rsp 119 | *.sbr 120 | *.tlb 121 | *.tli 122 | *.tlh 123 | *.tmp 124 | *.tmp_proj 125 | *.vspscc 126 | *.vssscc 127 | .builds 128 | *.pidb 129 | *.svclog 130 | *.scc 131 | 132 | # Chutzpah Test files 133 | _Chutzpah* 134 | 135 | # Visual C++ cache files 136 | ipch/ 137 | *.aps 138 | *.ncb 139 | *.opendb 140 | *.opensdf 141 | *.sdf 142 | *.cachefile 143 | *.VC.db 144 | *.VC.VC.opendb 145 | 146 | # Visual Studio profiler 147 | *.psess 148 | *.vsp 149 | *.vspx 150 | *.sap 151 | 152 | # TFS 2012 Local Workspace 153 | $tf/ 154 | 155 | # Guidance Automation Toolkit 156 | *.gpState 157 | 158 | # ReSharper is a .NET coding add-in 159 | _ReSharper*/ 160 | *.[Rr]e[Ss]harper 161 | *.DotSettings.user 162 | 163 | # JustCode is a .NET coding add-in 164 | .JustCode 165 | 166 | # TeamCity is a build add-in 167 | _TeamCity* 168 | 169 | # DotCover is a Code Coverage Tool 170 | *.dotCover 171 | 172 | # Visual Studio code coverage results 173 | *.coverage 174 | *.coveragexml 175 | 176 | # NCrunch 177 | _NCrunch_* 178 | .*crunch*.local.xml 179 | nCrunchTemp_* 180 | 181 | # MightyMoose 182 | *.mm.* 183 | AutoTest.Net/ 184 | 185 | # Web workbench (sass) 186 | .sass-cache/ 187 | 188 | # Installshield output folder 189 | [Ee]xpress/ 190 | 191 | # DocProject is a documentation generator add-in 192 | DocProject/buildhelp/ 193 | DocProject/Help/*.HxT 194 | DocProject/Help/*.HxC 195 | DocProject/Help/*.hhc 196 | DocProject/Help/*.hhk 197 | DocProject/Help/*.hhp 198 | DocProject/Help/Html2 199 | DocProject/Help/html 200 | 201 | # Click-Once directory 202 | publish/ 203 | 204 | # Publish Web Output 205 | *.[Pp]ublish.xml 206 | *.azurePubxml 207 | # TODO: Uncomment the next line to ignore your web deploy settings. 208 | # By default, sensitive information, such as encrypted password 209 | # should be stored in the .pubxml.user file. 210 | #*.pubxml 211 | *.pubxml.user 212 | *.publishproj 213 | 214 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 215 | # checkin your Azure Web App publish settings, but sensitive information contained 216 | # in these scripts will be unencrypted 217 | PublishScripts/ 218 | 219 | # NuGet Packages 220 | *.nupkg 221 | # The packages folder can be ignored because of Package Restore 222 | **/packages/* 223 | # except build/, which is used as an MSBuild target. 224 | !**/packages/build/ 225 | # Uncomment if necessary however generally it will be regenerated when needed 226 | #!**/packages/repositories.config 227 | # NuGet v3's project.json files produces more ignorable files 228 | *.nuget.props 229 | *.nuget.targets 230 | 231 | # Microsoft Azure Build Output 232 | csx/ 233 | *.build.csdef 234 | 235 | # Microsoft Azure Emulator 236 | ecf/ 237 | rcf/ 238 | 239 | # Windows Store app package directories and files 240 | AppPackages/ 241 | BundleArtifacts/ 242 | Package.StoreAssociation.xml 243 | _pkginfo.txt 244 | 245 | # Visual Studio cache files 246 | # files ending in .cache can be ignored 247 | *.[Cc]ache 248 | # but keep track of directories ending in .cache 249 | !*.[Cc]ache/ 250 | 251 | # Others 252 | ClientBin/ 253 | ~$* 254 | *~ 255 | *.dbmdl 256 | *.dbproj.schemaview 257 | *.jfm 258 | *.pfx 259 | *.publishsettings 260 | orleans.codegen.cs 261 | 262 | # Since there are multiple workflows, uncomment next line to ignore bower_components 263 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 264 | #bower_components/ 265 | 266 | # RIA/Silverlight projects 267 | Generated_Code/ 268 | 269 | # Backup & report files from converting an old project file 270 | # to a newer Visual Studio version. Backup files are not needed, 271 | # because we have git ;-) 272 | _UpgradeReport_Files/ 273 | Backup*/ 274 | UpgradeLog*.XML 275 | UpgradeLog*.htm 276 | 277 | # SQL Server files 278 | *.mdf 279 | *.ldf 280 | *.ndf 281 | 282 | # Business Intelligence projects 283 | *.rdl.data 284 | *.bim.layout 285 | *.bim_*.settings 286 | 287 | # Microsoft Fakes 288 | FakesAssemblies/ 289 | 290 | # GhostDoc plugin setting file 291 | *.GhostDoc.xml 292 | 293 | # Node.js Tools for Visual Studio 294 | .ntvs_analysis.dat 295 | node_modules/ 296 | 297 | # Typescript v1 declaration files 298 | typings/ 299 | 300 | # Visual Studio 6 build log 301 | *.plg 302 | 303 | # Visual Studio 6 workspace options file 304 | *.opt 305 | 306 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 307 | *.vbw 308 | 309 | # Visual Studio LightSwitch build output 310 | **/*.HTMLClient/GeneratedArtifacts 311 | **/*.DesktopClient/GeneratedArtifacts 312 | **/*.DesktopClient/ModelManifest.xml 313 | **/*.Server/GeneratedArtifacts 314 | **/*.Server/ModelManifest.xml 315 | _Pvt_Extensions 316 | 317 | # Paket dependency manager 318 | *.Restore.targets 319 | 320 | # FAKE - F# Make 321 | .fake/ 322 | 323 | # JetBrains Rider 324 | .idea/ 325 | *.sln.iml 326 | 327 | # JetBrains Rider 328 | .ionide/ 329 | 330 | # CodeRush 331 | .cr/ 332 | 333 | # Python Tools for Visual Studio (PTVS) 334 | __pycache__/ 335 | *.pyc 336 | 337 | # Cake - Uncomment if you are using it 338 | # tools/** 339 | # !tools/packages.config 340 | 341 | # Telerik's JustMock configuration file 342 | *.jmconfig 343 | 344 | # BizTalk build output 345 | *.btp.cs 346 | *.btm.cs 347 | *.odx.cs 348 | *.xsd.cs 349 | 350 | ### Emacs ### 351 | # -*- mode: gitignore; -*- 352 | \#*\# 353 | /.emacs.desktop 354 | /.emacs.desktop.lock 355 | *.elc 356 | auto-save-list 357 | tramp 358 | .\#* 359 | 360 | # Org-mode 361 | .org-id-locations 362 | *_archive 363 | 364 | # flymake-mode 365 | *_flymake.* 366 | 367 | # eshell files 368 | /eshell/history 369 | /eshell/lastdir 370 | 371 | # elpa packages 372 | /elpa/ 373 | 374 | # reftex files 375 | *.rel 376 | 377 | # AUCTeX auto folder 378 | /auto/ 379 | 380 | # cask packages 381 | .cask/ 382 | dist/ 383 | 384 | # Flycheck 385 | flycheck_*.el 386 | 387 | # server auth directory 388 | /server/ 389 | 390 | # projectiles files 391 | .projectile 392 | projectile-bookmarks.eld 393 | 394 | # directory configuration 395 | .dir-locals.el 396 | 397 | # saveplace 398 | places 399 | 400 | # url cache 401 | url/cache/ 402 | 403 | # cedet 404 | ede-projects.el 405 | 406 | # smex 407 | smex-items 408 | 409 | # company-statistics 410 | company-statistics-cache.el 411 | 412 | # anaconda-mode 413 | anaconda-mode/ 414 | 415 | ### fsharp ### 416 | lib/debug 417 | lib/release 418 | *.exe 419 | 420 | ### Intellij+all ### 421 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 422 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 423 | 424 | # User-specific stuff: 425 | .idea/**/workspace.xml 426 | .idea/**/tasks.xml 427 | 428 | # Sensitive or high-churn files: 429 | .idea/**/dataSources/ 430 | .idea/**/dataSources.ids 431 | .idea/**/dataSources.xml 432 | .idea/**/dataSources.local.xml 433 | .idea/**/sqlDataSources.xml 434 | .idea/**/dynamic.xml 435 | .idea/**/uiDesigner.xml 436 | 437 | # Gradle: 438 | .idea/**/gradle.xml 439 | .idea/**/libraries 440 | 441 | # CMake 442 | cmake-build-debug/ 443 | 444 | # Mongo Explorer plugin: 445 | .idea/**/mongoSettings.xml 446 | 447 | ## File-based project format: 448 | *.iws 449 | 450 | ## Plugin-specific files: 451 | 452 | # IntelliJ 453 | /out/ 454 | 455 | # mpeltonen/sbt-idea plugin 456 | .idea_modules/ 457 | 458 | # JIRA plugin 459 | atlassian-ide-plugin.xml 460 | 461 | # Cursive Clojure plugin 462 | .idea/replstate.xml 463 | 464 | # Ruby plugin and RubyMine 465 | /.rakeTasks 466 | 467 | # Crashlytics plugin (for Android Studio and IntelliJ) 468 | com_crashlytics_export_strings.xml 469 | crashlytics.properties 470 | crashlytics-build.properties 471 | fabric.properties 472 | 473 | ### Linux ### 474 | 475 | # temporary files which can be created if a process still has a handle open of a deleted file 476 | .fuse_hidden* 477 | 478 | # KDE directory preferences 479 | .directory 480 | 481 | # Linux trash folder which might appear on any partition or disk 482 | .Trash-* 483 | 484 | # .nfs files are created when an open file is removed but is still being accessed 485 | .nfs* 486 | 487 | ### macOS ### 488 | *.DS_Store 489 | .AppleDouble 490 | .LSOverride 491 | 492 | # Icon must end with two \r 493 | Icon 494 | 495 | # Thumbnails 496 | ._* 497 | 498 | # Files that might appear in the root of a volume 499 | .DocumentRevisions-V100 500 | .fseventsd 501 | .Spotlight-V100 502 | .TemporaryItems 503 | .Trashes 504 | .VolumeIcon.icns 505 | .com.apple.timemachine.donotpresent 506 | 507 | # Directories potentially created on remote AFP share 508 | .AppleDB 509 | .AppleDesktop 510 | Network Trash Folder 511 | Temporary Items 512 | .apdisk 513 | 514 | ### MonoDevelop ### 515 | #User Specific 516 | *.usertasks 517 | 518 | #Mono Project Files 519 | *.resources 520 | test-results/ 521 | 522 | ### OSX ### 523 | 524 | # Icon must end with two \r 525 | 526 | # Thumbnails 527 | 528 | # Files that might appear in the root of a volume 529 | 530 | # Directories potentially created on remote AFP share 531 | 532 | ### Vim ### 533 | # swap 534 | [._]*.s[a-v][a-z] 535 | [._]*.sw[a-p] 536 | [._]s[a-v][a-z] 537 | [._]sw[a-p] 538 | # session 539 | Session.vim 540 | # temporary 541 | .netrwhist 542 | # auto-generated tag files 543 | tags 544 | 545 | ### VisualStudioCode ### 546 | .vscode/* 547 | !.vscode/settings.json 548 | !.vscode/tasks.json 549 | !.vscode/launch.json 550 | !.vscode/extensions.json 551 | .history 552 | 553 | ### Windows ### 554 | # Windows thumbnail cache files 555 | Thumbs.db 556 | ehthumbs.db 557 | ehthumbs_vista.db 558 | 559 | # Folder config file 560 | Desktop.ini 561 | 562 | # Recycle Bin used on file shares 563 | $RECYCLE.BIN/ 564 | 565 | # Windows Installer files 566 | *.cab 567 | *.msi 568 | *.msm 569 | *.msp 570 | 571 | # Windows shortcuts 572 | *.lnk 573 | 574 | ### XamarinStudio ### 575 | .packages 576 | 577 | ### Mono Code Coverage ### 578 | TestResults.xml 579 | 580 | ### OpenTK Binding files ### 581 | .bindingsGenerated 582 | src/OpenTK.Graphics/ES11/ES11.cs 583 | src/OpenTK.Graphics/ES11/ES11Enums.cs 584 | src/OpenTK.Graphics/ES20/ES20.cs 585 | src/OpenTK.Graphics/ES20/ES20Enums.cs 586 | src/OpenTK.Graphics/ES30/ES30.cs 587 | src/OpenTK.Graphics/ES30/ES30Enums.cs 588 | src/OpenTK.Graphics/OpenGL2/GL.cs 589 | src/OpenTK.Graphics/OpenGL2/GLEnums.cs 590 | src/OpenTK.Graphics/OpenGL4/GL4.cs 591 | src/OpenTK.Graphics/OpenGL4/GL4Enums.cs 592 | 593 | ### OpenTK AssemblyInfo files ### 594 | **/AssemblyInfo.cs 595 | **/AssemblyInfo.fs 596 | 597 | ### Tooling files "" 598 | tools/ 599 | 600 | ### LaTeX ### 601 | ## Core latex/pdflatex auxiliary files: 602 | *.aux 603 | *.lof 604 | *.lot 605 | *.fls 606 | *.out 607 | *.toc 608 | *.fmt 609 | *.fot 610 | *.cb 611 | *.cb2 612 | .*.lb 613 | 614 | ## Intermediate documents: 615 | *.dvi 616 | *.xdv 617 | *-converted-to.* 618 | # these rules might exclude image files for figures etc. 619 | # *.ps 620 | # *.eps 621 | # *.pdf 622 | 623 | ## Generated if empty string is given at "Please type another file name for output:" 624 | .pdf 625 | 626 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 627 | *.bbl 628 | *.bcf 629 | *.blg 630 | *-blx.aux 631 | *-blx.bib 632 | *.run.xml 633 | 634 | ## Build tool auxiliary files: 635 | *.fdb_latexmk 636 | *.synctex 637 | *.synctex(busy) 638 | *.synctex.gz 639 | *.synctex.gz(busy) 640 | *.pdfsync 641 | *.template 642 | .paket/paket.exe 643 | 644 | ## Build tool directories for auxiliary files 645 | # latexrun 646 | latex.out/ 647 | 648 | ## Auxiliary and intermediate files from other packages: 649 | # algorithms 650 | *.alg 651 | *.loa 652 | 653 | # achemso 654 | acs-*.bib 655 | 656 | # amsthm 657 | *.thm 658 | 659 | # beamer 660 | *.nav 661 | *.pre 662 | *.snm 663 | *.vrb 664 | 665 | # changes 666 | *.soc 667 | 668 | # cprotect 669 | *.cpt 670 | 671 | # elsarticle (documentclass of Elsevier journals) 672 | *.spl 673 | 674 | # endnotes 675 | *.ent 676 | 677 | # fixme 678 | *.lox 679 | 680 | # feynmf/feynmp 681 | *.mf 682 | *.mp 683 | *.t[1-9] 684 | *.t[1-9][0-9] 685 | *.tfm 686 | 687 | # glossaries 688 | *.acn 689 | *.acr 690 | *.glg 691 | *.glo 692 | *.gls 693 | *.glsdefs 694 | 695 | # gnuplottex 696 | *-gnuplottex-* 697 | 698 | # gregoriotex 699 | *.gaux 700 | *.gtex 701 | 702 | # htlatex 703 | *.4ct 704 | *.4tc 705 | *.idv 706 | *.lg 707 | *.trc 708 | *.xref 709 | 710 | # hyperref 711 | *.brf 712 | 713 | # knitr 714 | *-concordance.tex 715 | # TODO Comment the next line if you want to keep your tikz graphics files 716 | *.tikz 717 | *-tikzDictionary 718 | 719 | # listings 720 | *.lol 721 | 722 | # makeidx 723 | *.idx 724 | *.ilg 725 | *.ind 726 | *.ist 727 | 728 | # minitoc 729 | *.maf 730 | *.mlf 731 | *.mlt 732 | *.mtc[0-9]* 733 | *.slf[0-9]* 734 | *.slt[0-9]* 735 | *.stc[0-9]* 736 | 737 | # minted 738 | _minted* 739 | *.pyg 740 | 741 | # morewrites 742 | *.mw 743 | 744 | # nomencl 745 | *.nlg 746 | *.nlo 747 | *.nls 748 | 749 | # pax 750 | *.pax 751 | 752 | # pdfpcnotes 753 | *.pdfpc 754 | 755 | # sagetex 756 | *.sagetex.sage 757 | *.sagetex.py 758 | *.sagetex.scmd 759 | 760 | # scrwfile 761 | *.wrt 762 | 763 | # sympy 764 | *.sout 765 | *.sympy 766 | sympy-plots-for-*.tex/ 767 | 768 | # pdfcomment 769 | *.upa 770 | *.upb 771 | 772 | # pythontex 773 | *.pytxcode 774 | pythontex-files-*/ 775 | 776 | # thmtools 777 | *.loe 778 | 779 | # TikZ & PGF 780 | *.dpth 781 | *.md5 782 | *.auxlock 783 | 784 | # todonotes 785 | *.tdo 786 | 787 | # easy-todo 788 | *.lod 789 | 790 | # xmpincl 791 | *.xmpi 792 | 793 | # xindy 794 | *.xdy 795 | 796 | # xypic precompiled matrices 797 | *.xyc 798 | 799 | # endfloat 800 | *.ttt 801 | *.fff 802 | 803 | # Latexian 804 | TSWLatexianTemp* 805 | 806 | ## Editors: 807 | # WinEdt 808 | *.bak 809 | *.sav 810 | 811 | # Texpad 812 | .texpadtmp 813 | 814 | # LyX 815 | *.lyx~ 816 | 817 | # Kile 818 | *.backup 819 | 820 | # KBibTeX 821 | *~[0-9]* 822 | 823 | # auto folder when using emacs and auctex 824 | auto/* 825 | *.el 826 | 827 | # expex forward references with \gathertags 828 | *-tags.tex 829 | 830 | # standalone packages 831 | *.sta 832 | 833 | ### LaTeX Patch ### 834 | # glossaries 835 | *.glstex 836 | src/OpenGL/*.*/ 837 | gl.xml 838 | src/OpenGL/Extensions 839 | -------------------------------------------------------------------------------- /OpenTK.GLControl.TestForm/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace OpenTK.GLControl.TestForm 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); 32 | menuStrip1 = new System.Windows.Forms.MenuStrip(); 33 | fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 34 | newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 35 | openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 36 | toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); 37 | saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 38 | saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 40 | printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 41 | printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 42 | toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); 43 | exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 44 | editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 45 | undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 46 | redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 47 | toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 48 | cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 49 | copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 | pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 | toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); 52 | selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 | toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 | customizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 55 | optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 56 | helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 57 | contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 | indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 59 | searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 60 | toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); 61 | aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 62 | glControl = new GLControl(); 63 | menuStrip1.SuspendLayout(); 64 | SuspendLayout(); 65 | // 66 | // menuStrip1 67 | // 68 | menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem }); 69 | menuStrip1.Location = new System.Drawing.Point(0, 0); 70 | menuStrip1.Name = "menuStrip1"; 71 | menuStrip1.Size = new System.Drawing.Size(403, 24); 72 | menuStrip1.TabIndex = 1; 73 | menuStrip1.Text = "menuStrip1"; 74 | // 75 | // fileToolStripMenuItem 76 | // 77 | fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { newToolStripMenuItem, openToolStripMenuItem, toolStripSeparator, saveToolStripMenuItem, saveAsToolStripMenuItem, toolStripSeparator1, printToolStripMenuItem, printPreviewToolStripMenuItem, toolStripSeparator2, exitToolStripMenuItem }); 78 | fileToolStripMenuItem.Name = "fileToolStripMenuItem"; 79 | fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); 80 | fileToolStripMenuItem.Text = "&File"; 81 | // 82 | // newToolStripMenuItem 83 | // 84 | newToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("newToolStripMenuItem.Image"); 85 | newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 86 | newToolStripMenuItem.Name = "newToolStripMenuItem"; 87 | newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N; 88 | newToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 89 | newToolStripMenuItem.Text = "&New"; 90 | // 91 | // openToolStripMenuItem 92 | // 93 | openToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("openToolStripMenuItem.Image"); 94 | openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 95 | openToolStripMenuItem.Name = "openToolStripMenuItem"; 96 | openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O; 97 | openToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 98 | openToolStripMenuItem.Text = "&Open"; 99 | // 100 | // toolStripSeparator 101 | // 102 | toolStripSeparator.Name = "toolStripSeparator"; 103 | toolStripSeparator.Size = new System.Drawing.Size(143, 6); 104 | // 105 | // saveToolStripMenuItem 106 | // 107 | saveToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("saveToolStripMenuItem.Image"); 108 | saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 109 | saveToolStripMenuItem.Name = "saveToolStripMenuItem"; 110 | saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S; 111 | saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 112 | saveToolStripMenuItem.Text = "&Save"; 113 | // 114 | // saveAsToolStripMenuItem 115 | // 116 | saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; 117 | saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 118 | saveAsToolStripMenuItem.Text = "Save &As"; 119 | // 120 | // toolStripSeparator1 121 | // 122 | toolStripSeparator1.Name = "toolStripSeparator1"; 123 | toolStripSeparator1.Size = new System.Drawing.Size(143, 6); 124 | // 125 | // printToolStripMenuItem 126 | // 127 | printToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("printToolStripMenuItem.Image"); 128 | printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 129 | printToolStripMenuItem.Name = "printToolStripMenuItem"; 130 | printToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P; 131 | printToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 132 | printToolStripMenuItem.Text = "&Print"; 133 | // 134 | // printPreviewToolStripMenuItem 135 | // 136 | printPreviewToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("printPreviewToolStripMenuItem.Image"); 137 | printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 138 | printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; 139 | printPreviewToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 140 | printPreviewToolStripMenuItem.Text = "Print Pre&view"; 141 | // 142 | // toolStripSeparator2 143 | // 144 | toolStripSeparator2.Name = "toolStripSeparator2"; 145 | toolStripSeparator2.Size = new System.Drawing.Size(143, 6); 146 | // 147 | // exitToolStripMenuItem 148 | // 149 | exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 150 | exitToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 151 | exitToolStripMenuItem.Text = "E&xit"; 152 | exitToolStripMenuItem.Click += exitToolStripMenuItem_Click; 153 | // 154 | // editToolStripMenuItem 155 | // 156 | editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, toolStripSeparator3, cutToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, toolStripSeparator4, selectAllToolStripMenuItem }); 157 | editToolStripMenuItem.Name = "editToolStripMenuItem"; 158 | editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); 159 | editToolStripMenuItem.Text = "&Edit"; 160 | // 161 | // undoToolStripMenuItem 162 | // 163 | undoToolStripMenuItem.Name = "undoToolStripMenuItem"; 164 | undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z; 165 | undoToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 166 | undoToolStripMenuItem.Text = "&Undo"; 167 | // 168 | // redoToolStripMenuItem 169 | // 170 | redoToolStripMenuItem.Name = "redoToolStripMenuItem"; 171 | redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y; 172 | redoToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 173 | redoToolStripMenuItem.Text = "&Redo"; 174 | // 175 | // toolStripSeparator3 176 | // 177 | toolStripSeparator3.Name = "toolStripSeparator3"; 178 | toolStripSeparator3.Size = new System.Drawing.Size(141, 6); 179 | // 180 | // cutToolStripMenuItem 181 | // 182 | cutToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("cutToolStripMenuItem.Image"); 183 | cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 184 | cutToolStripMenuItem.Name = "cutToolStripMenuItem"; 185 | cutToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X; 186 | cutToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 187 | cutToolStripMenuItem.Text = "Cu&t"; 188 | // 189 | // copyToolStripMenuItem 190 | // 191 | copyToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("copyToolStripMenuItem.Image"); 192 | copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 193 | copyToolStripMenuItem.Name = "copyToolStripMenuItem"; 194 | copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C; 195 | copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 196 | copyToolStripMenuItem.Text = "&Copy"; 197 | // 198 | // pasteToolStripMenuItem 199 | // 200 | pasteToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("pasteToolStripMenuItem.Image"); 201 | pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 202 | pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; 203 | pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V; 204 | pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 205 | pasteToolStripMenuItem.Text = "&Paste"; 206 | // 207 | // toolStripSeparator4 208 | // 209 | toolStripSeparator4.Name = "toolStripSeparator4"; 210 | toolStripSeparator4.Size = new System.Drawing.Size(141, 6); 211 | // 212 | // selectAllToolStripMenuItem 213 | // 214 | selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; 215 | selectAllToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 216 | selectAllToolStripMenuItem.Text = "Select &All"; 217 | // 218 | // toolsToolStripMenuItem 219 | // 220 | toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { customizeToolStripMenuItem, optionsToolStripMenuItem }); 221 | toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; 222 | toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20); 223 | toolsToolStripMenuItem.Text = "&Tools"; 224 | // 225 | // customizeToolStripMenuItem 226 | // 227 | customizeToolStripMenuItem.Name = "customizeToolStripMenuItem"; 228 | customizeToolStripMenuItem.Size = new System.Drawing.Size(130, 22); 229 | customizeToolStripMenuItem.Text = "&Customize"; 230 | // 231 | // optionsToolStripMenuItem 232 | // 233 | optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; 234 | optionsToolStripMenuItem.Size = new System.Drawing.Size(130, 22); 235 | optionsToolStripMenuItem.Text = "&Options"; 236 | // 237 | // helpToolStripMenuItem 238 | // 239 | helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { contentsToolStripMenuItem, indexToolStripMenuItem, searchToolStripMenuItem, toolStripSeparator5, aboutToolStripMenuItem }); 240 | helpToolStripMenuItem.Name = "helpToolStripMenuItem"; 241 | helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); 242 | helpToolStripMenuItem.Text = "&Help"; 243 | // 244 | // contentsToolStripMenuItem 245 | // 246 | contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; 247 | contentsToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 248 | contentsToolStripMenuItem.Text = "&Contents"; 249 | // 250 | // indexToolStripMenuItem 251 | // 252 | indexToolStripMenuItem.Name = "indexToolStripMenuItem"; 253 | indexToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 254 | indexToolStripMenuItem.Text = "&Index"; 255 | // 256 | // searchToolStripMenuItem 257 | // 258 | searchToolStripMenuItem.Name = "searchToolStripMenuItem"; 259 | searchToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 260 | searchToolStripMenuItem.Text = "&Search"; 261 | // 262 | // toolStripSeparator5 263 | // 264 | toolStripSeparator5.Name = "toolStripSeparator5"; 265 | toolStripSeparator5.Size = new System.Drawing.Size(119, 6); 266 | // 267 | // aboutToolStripMenuItem 268 | // 269 | aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; 270 | aboutToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 271 | aboutToolStripMenuItem.Text = "&About..."; 272 | aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click; 273 | // 274 | // glControl 275 | // 276 | glControl.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right; 277 | glControl.API = Windowing.Common.ContextAPI.OpenGL; 278 | glControl.APIVersion = new System.Version(3, 3, 0, 0); 279 | glControl.Flags = Windowing.Common.ContextFlags.Debug; 280 | glControl.IsEventDriven = true; 281 | glControl.Location = new System.Drawing.Point(12, 27); 282 | glControl.Name = "glControl"; 283 | glControl.Profile = Windowing.Common.ContextProfile.Core; 284 | glControl.Size = new System.Drawing.Size(379, 211); 285 | glControl.TabIndex = 2; 286 | glControl.Text = "glControl1"; 287 | glControl.Load += glControl_Load; 288 | // 289 | // Form1 290 | // 291 | AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); 292 | AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 293 | ClientSize = new System.Drawing.Size(403, 250); 294 | Controls.Add(glControl); 295 | Controls.Add(menuStrip1); 296 | Name = "Form1"; 297 | Text = "GLControl Test Form"; 298 | menuStrip1.ResumeLayout(false); 299 | menuStrip1.PerformLayout(); 300 | ResumeLayout(false); 301 | PerformLayout(); 302 | } 303 | 304 | #endregion 305 | private System.Windows.Forms.MenuStrip menuStrip1; 306 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; 307 | private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; 308 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; 309 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator; 310 | private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; 311 | private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; 312 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 313 | private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; 314 | private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; 315 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; 316 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; 317 | private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; 318 | private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; 319 | private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; 320 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; 321 | private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; 322 | private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; 323 | private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; 324 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; 325 | private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; 326 | private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; 327 | private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem; 328 | private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; 329 | private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; 330 | private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem; 331 | private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem; 332 | private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; 333 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; 334 | private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; 335 | private GLControl glControl; 336 | } 337 | } 338 | 339 | -------------------------------------------------------------------------------- /OpenTK.GLControl.InputTest/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace OpenTK.GLControl.InputTest 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); 32 | this.menuStrip1 = new System.Windows.Forms.MenuStrip(); 33 | this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 34 | this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 35 | this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 36 | this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); 37 | this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 38 | this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 40 | this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 41 | this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 42 | this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); 43 | this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 44 | this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 45 | this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 46 | this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 47 | this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 48 | this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 49 | this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 | this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 | this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); 52 | this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 | this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 | this.customizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 55 | this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 56 | this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 57 | this.contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 | this.indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 59 | this.searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 60 | this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); 61 | this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 62 | this.glControl = new OpenTK.GLControl.GLControl(); 63 | this.LogTextBox = new System.Windows.Forms.TextBox(); 64 | this.WinFormsInputRadioButton = new System.Windows.Forms.RadioButton(); 65 | this.NativeInputRadioButton = new System.Windows.Forms.RadioButton(); 66 | this.label1 = new System.Windows.Forms.Label(); 67 | this.menuStrip1.SuspendLayout(); 68 | this.SuspendLayout(); 69 | // 70 | // menuStrip1 71 | // 72 | this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); 73 | this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 74 | this.fileToolStripMenuItem, 75 | this.editToolStripMenuItem, 76 | this.toolsToolStripMenuItem, 77 | this.helpToolStripMenuItem}); 78 | this.menuStrip1.Location = new System.Drawing.Point(0, 0); 79 | this.menuStrip1.Name = "menuStrip1"; 80 | this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 3, 0, 3); 81 | this.menuStrip1.Size = new System.Drawing.Size(639, 30); 82 | this.menuStrip1.TabIndex = 1; 83 | this.menuStrip1.Text = "menuStrip1"; 84 | // 85 | // fileToolStripMenuItem 86 | // 87 | this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 88 | this.newToolStripMenuItem, 89 | this.openToolStripMenuItem, 90 | this.toolStripSeparator, 91 | this.saveToolStripMenuItem, 92 | this.saveAsToolStripMenuItem, 93 | this.toolStripSeparator1, 94 | this.printToolStripMenuItem, 95 | this.printPreviewToolStripMenuItem, 96 | this.toolStripSeparator2, 97 | this.exitToolStripMenuItem}); 98 | this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; 99 | this.fileToolStripMenuItem.Size = new System.Drawing.Size(46, 24); 100 | this.fileToolStripMenuItem.Text = "&File"; 101 | // 102 | // newToolStripMenuItem 103 | // 104 | this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); 105 | this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 106 | this.newToolStripMenuItem.Name = "newToolStripMenuItem"; 107 | this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); 108 | this.newToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 109 | this.newToolStripMenuItem.Text = "&New"; 110 | // 111 | // openToolStripMenuItem 112 | // 113 | this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); 114 | this.openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 115 | this.openToolStripMenuItem.Name = "openToolStripMenuItem"; 116 | this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O))); 117 | this.openToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 118 | this.openToolStripMenuItem.Text = "&Open"; 119 | // 120 | // toolStripSeparator 121 | // 122 | this.toolStripSeparator.Name = "toolStripSeparator"; 123 | this.toolStripSeparator.Size = new System.Drawing.Size(221, 6); 124 | // 125 | // saveToolStripMenuItem 126 | // 127 | this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); 128 | this.saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 129 | this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; 130 | this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S))); 131 | this.saveToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 132 | this.saveToolStripMenuItem.Text = "&Save"; 133 | // 134 | // saveAsToolStripMenuItem 135 | // 136 | this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; 137 | this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 138 | this.saveAsToolStripMenuItem.Text = "Save &As"; 139 | // 140 | // toolStripSeparator1 141 | // 142 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 143 | this.toolStripSeparator1.Size = new System.Drawing.Size(221, 6); 144 | // 145 | // printToolStripMenuItem 146 | // 147 | this.printToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem.Image"))); 148 | this.printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 149 | this.printToolStripMenuItem.Name = "printToolStripMenuItem"; 150 | this.printToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P))); 151 | this.printToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 152 | this.printToolStripMenuItem.Text = "&Print"; 153 | // 154 | // printPreviewToolStripMenuItem 155 | // 156 | this.printPreviewToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem.Image"))); 157 | this.printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 158 | this.printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; 159 | this.printPreviewToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 160 | this.printPreviewToolStripMenuItem.Text = "Print Pre&view"; 161 | // 162 | // toolStripSeparator2 163 | // 164 | this.toolStripSeparator2.Name = "toolStripSeparator2"; 165 | this.toolStripSeparator2.Size = new System.Drawing.Size(221, 6); 166 | // 167 | // exitToolStripMenuItem 168 | // 169 | this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 170 | this.exitToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 171 | this.exitToolStripMenuItem.Text = "E&xit"; 172 | this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); 173 | // 174 | // editToolStripMenuItem 175 | // 176 | this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 177 | this.undoToolStripMenuItem, 178 | this.redoToolStripMenuItem, 179 | this.toolStripSeparator3, 180 | this.cutToolStripMenuItem, 181 | this.copyToolStripMenuItem, 182 | this.pasteToolStripMenuItem, 183 | this.toolStripSeparator4, 184 | this.selectAllToolStripMenuItem}); 185 | this.editToolStripMenuItem.Name = "editToolStripMenuItem"; 186 | this.editToolStripMenuItem.Size = new System.Drawing.Size(49, 24); 187 | this.editToolStripMenuItem.Text = "&Edit"; 188 | // 189 | // undoToolStripMenuItem 190 | // 191 | this.undoToolStripMenuItem.Name = "undoToolStripMenuItem"; 192 | this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z))); 193 | this.undoToolStripMenuItem.Size = new System.Drawing.Size(179, 26); 194 | this.undoToolStripMenuItem.Text = "&Undo"; 195 | // 196 | // redoToolStripMenuItem 197 | // 198 | this.redoToolStripMenuItem.Name = "redoToolStripMenuItem"; 199 | this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y))); 200 | this.redoToolStripMenuItem.Size = new System.Drawing.Size(179, 26); 201 | this.redoToolStripMenuItem.Text = "&Redo"; 202 | // 203 | // toolStripSeparator3 204 | // 205 | this.toolStripSeparator3.Name = "toolStripSeparator3"; 206 | this.toolStripSeparator3.Size = new System.Drawing.Size(176, 6); 207 | // 208 | // cutToolStripMenuItem 209 | // 210 | this.cutToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem.Image"))); 211 | this.cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 212 | this.cutToolStripMenuItem.Name = "cutToolStripMenuItem"; 213 | this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X))); 214 | this.cutToolStripMenuItem.Size = new System.Drawing.Size(179, 26); 215 | this.cutToolStripMenuItem.Text = "Cu&t"; 216 | // 217 | // copyToolStripMenuItem 218 | // 219 | this.copyToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem.Image"))); 220 | this.copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 221 | this.copyToolStripMenuItem.Name = "copyToolStripMenuItem"; 222 | this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); 223 | this.copyToolStripMenuItem.Size = new System.Drawing.Size(179, 26); 224 | this.copyToolStripMenuItem.Text = "&Copy"; 225 | // 226 | // pasteToolStripMenuItem 227 | // 228 | this.pasteToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem.Image"))); 229 | this.pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 230 | this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; 231 | this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V))); 232 | this.pasteToolStripMenuItem.Size = new System.Drawing.Size(179, 26); 233 | this.pasteToolStripMenuItem.Text = "&Paste"; 234 | // 235 | // toolStripSeparator4 236 | // 237 | this.toolStripSeparator4.Name = "toolStripSeparator4"; 238 | this.toolStripSeparator4.Size = new System.Drawing.Size(176, 6); 239 | // 240 | // selectAllToolStripMenuItem 241 | // 242 | this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; 243 | this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(179, 26); 244 | this.selectAllToolStripMenuItem.Text = "Select &All"; 245 | // 246 | // toolsToolStripMenuItem 247 | // 248 | this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 249 | this.customizeToolStripMenuItem, 250 | this.optionsToolStripMenuItem}); 251 | this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; 252 | this.toolsToolStripMenuItem.Size = new System.Drawing.Size(58, 24); 253 | this.toolsToolStripMenuItem.Text = "&Tools"; 254 | // 255 | // customizeToolStripMenuItem 256 | // 257 | this.customizeToolStripMenuItem.Name = "customizeToolStripMenuItem"; 258 | this.customizeToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 259 | this.customizeToolStripMenuItem.Text = "&Customize"; 260 | // 261 | // optionsToolStripMenuItem 262 | // 263 | this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; 264 | this.optionsToolStripMenuItem.Size = new System.Drawing.Size(224, 26); 265 | this.optionsToolStripMenuItem.Text = "&Options"; 266 | // 267 | // helpToolStripMenuItem 268 | // 269 | this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { 270 | this.contentsToolStripMenuItem, 271 | this.indexToolStripMenuItem, 272 | this.searchToolStripMenuItem, 273 | this.toolStripSeparator5, 274 | this.aboutToolStripMenuItem}); 275 | this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; 276 | this.helpToolStripMenuItem.Size = new System.Drawing.Size(55, 24); 277 | this.helpToolStripMenuItem.Text = "&Help"; 278 | // 279 | // contentsToolStripMenuItem 280 | // 281 | this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; 282 | this.contentsToolStripMenuItem.Size = new System.Drawing.Size(150, 26); 283 | this.contentsToolStripMenuItem.Text = "&Contents"; 284 | // 285 | // indexToolStripMenuItem 286 | // 287 | this.indexToolStripMenuItem.Name = "indexToolStripMenuItem"; 288 | this.indexToolStripMenuItem.Size = new System.Drawing.Size(150, 26); 289 | this.indexToolStripMenuItem.Text = "&Index"; 290 | // 291 | // searchToolStripMenuItem 292 | // 293 | this.searchToolStripMenuItem.Name = "searchToolStripMenuItem"; 294 | this.searchToolStripMenuItem.Size = new System.Drawing.Size(150, 26); 295 | this.searchToolStripMenuItem.Text = "&Search"; 296 | // 297 | // toolStripSeparator5 298 | // 299 | this.toolStripSeparator5.Name = "toolStripSeparator5"; 300 | this.toolStripSeparator5.Size = new System.Drawing.Size(147, 6); 301 | // 302 | // aboutToolStripMenuItem 303 | // 304 | this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; 305 | this.aboutToolStripMenuItem.Size = new System.Drawing.Size(150, 26); 306 | this.aboutToolStripMenuItem.Text = "&About..."; 307 | this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); 308 | // 309 | // glControl 310 | // 311 | this.glControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 312 | | System.Windows.Forms.AnchorStyles.Left) 313 | | System.Windows.Forms.AnchorStyles.Right))); 314 | this.glControl.API = OpenTK.Windowing.Common.ContextAPI.OpenGL; 315 | this.glControl.APIVersion = new System.Version(3, 3, 0, 0); 316 | this.glControl.Flags = OpenTK.Windowing.Common.ContextFlags.Default; 317 | this.glControl.IsEventDriven = true; 318 | this.glControl.Location = new System.Drawing.Point(14, 36); 319 | this.glControl.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 320 | this.glControl.Name = "glControl"; 321 | this.glControl.Profile = OpenTK.Windowing.Common.ContextProfile.Compatability; 322 | this.glControl.Size = new System.Drawing.Size(611, 235); 323 | this.glControl.TabIndex = 2; 324 | this.glControl.Text = "glControl1"; 325 | // 326 | // LogTextBox 327 | // 328 | this.LogTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 329 | | System.Windows.Forms.AnchorStyles.Right))); 330 | this.LogTextBox.Location = new System.Drawing.Point(14, 315); 331 | this.LogTextBox.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 332 | this.LogTextBox.Multiline = true; 333 | this.LogTextBox.Name = "LogTextBox"; 334 | this.LogTextBox.ReadOnly = true; 335 | this.LogTextBox.Size = new System.Drawing.Size(475, 207); 336 | this.LogTextBox.TabIndex = 3; 337 | // 338 | // WinFormsInputRadioButton 339 | // 340 | this.WinFormsInputRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 341 | this.WinFormsInputRadioButton.AutoSize = true; 342 | this.WinFormsInputRadioButton.Location = new System.Drawing.Point(491, 317); 343 | this.WinFormsInputRadioButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 344 | this.WinFormsInputRadioButton.Name = "WinFormsInputRadioButton"; 345 | this.WinFormsInputRadioButton.Size = new System.Drawing.Size(134, 24); 346 | this.WinFormsInputRadioButton.TabIndex = 4; 347 | this.WinFormsInputRadioButton.TabStop = true; 348 | this.WinFormsInputRadioButton.Text = "WinForms Input"; 349 | this.WinFormsInputRadioButton.UseVisualStyleBackColor = true; 350 | this.WinFormsInputRadioButton.CheckedChanged += new System.EventHandler(this.WinFormsInputRadioButton_CheckedChanged); 351 | // 352 | // NativeInputRadioButton 353 | // 354 | this.NativeInputRadioButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 355 | this.NativeInputRadioButton.AutoSize = true; 356 | this.NativeInputRadioButton.Location = new System.Drawing.Point(491, 350); 357 | this.NativeInputRadioButton.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 358 | this.NativeInputRadioButton.Name = "NativeInputRadioButton"; 359 | this.NativeInputRadioButton.Size = new System.Drawing.Size(111, 24); 360 | this.NativeInputRadioButton.TabIndex = 5; 361 | this.NativeInputRadioButton.TabStop = true; 362 | this.NativeInputRadioButton.Text = "Native Input"; 363 | this.NativeInputRadioButton.UseVisualStyleBackColor = true; 364 | this.NativeInputRadioButton.CheckedChanged += new System.EventHandler(this.NativeInputRadioButton_CheckedChanged); 365 | // 366 | // label1 367 | // 368 | this.label1.AutoSize = true; 369 | this.label1.Location = new System.Drawing.Point(14, 283); 370 | this.label1.Name = "label1"; 371 | this.label1.Size = new System.Drawing.Size(474, 20); 372 | this.label1.TabIndex = 6; 373 | this.label1.Text = "Click or type in the GLControl above to see the input events generated."; 374 | // 375 | // Form1 376 | // 377 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F); 378 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 379 | this.ClientSize = new System.Drawing.Size(639, 539); 380 | this.Controls.Add(this.label1); 381 | this.Controls.Add(this.NativeInputRadioButton); 382 | this.Controls.Add(this.WinFormsInputRadioButton); 383 | this.Controls.Add(this.LogTextBox); 384 | this.Controls.Add(this.glControl); 385 | this.Controls.Add(this.menuStrip1); 386 | this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); 387 | this.Name = "Form1"; 388 | this.Text = "GLControl Input Test"; 389 | this.menuStrip1.ResumeLayout(false); 390 | this.menuStrip1.PerformLayout(); 391 | this.ResumeLayout(false); 392 | this.PerformLayout(); 393 | 394 | } 395 | 396 | #endregion 397 | private System.Windows.Forms.MenuStrip menuStrip1; 398 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; 399 | private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; 400 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; 401 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator; 402 | private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; 403 | private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; 404 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 405 | private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; 406 | private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; 407 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; 408 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; 409 | private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; 410 | private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; 411 | private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; 412 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; 413 | private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; 414 | private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; 415 | private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; 416 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; 417 | private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; 418 | private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; 419 | private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem; 420 | private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; 421 | private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; 422 | private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem; 423 | private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem; 424 | private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; 425 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; 426 | private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; 427 | private GLControl glControl; 428 | private System.Windows.Forms.TextBox LogTextBox; 429 | private System.Windows.Forms.RadioButton WinFormsInputRadioButton; 430 | private System.Windows.Forms.RadioButton NativeInputRadioButton; 431 | private System.Windows.Forms.Label label1; 432 | } 433 | } 434 | 435 | -------------------------------------------------------------------------------- /OpenTK.GLControl.MultiControlTest/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace OpenTK.GLControl.MultiControlTest 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); 32 | menuStrip1 = new System.Windows.Forms.MenuStrip(); 33 | fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 34 | newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 35 | openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 36 | toolStripSeparator = new System.Windows.Forms.ToolStripSeparator(); 37 | saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 38 | saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 39 | toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 40 | printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 41 | printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 42 | toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); 43 | exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 44 | editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 45 | undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 46 | redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 47 | toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); 48 | cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 49 | copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 50 | pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 51 | toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); 52 | selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 53 | toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 54 | customizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 55 | optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 56 | helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 57 | contentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 58 | indexToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 59 | searchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 60 | toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); 61 | aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); 62 | splitContainer1 = new System.Windows.Forms.SplitContainer(); 63 | splitContainer2 = new System.Windows.Forms.SplitContainer(); 64 | glControl1 = new GLControl(); 65 | glControl3 = new GLControl(); 66 | splitContainer3 = new System.Windows.Forms.SplitContainer(); 67 | glControl2 = new GLControl(); 68 | glControl4 = new GLControl(); 69 | menuStrip1.SuspendLayout(); 70 | ((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit(); 71 | splitContainer1.Panel1.SuspendLayout(); 72 | splitContainer1.Panel2.SuspendLayout(); 73 | splitContainer1.SuspendLayout(); 74 | ((System.ComponentModel.ISupportInitialize)splitContainer2).BeginInit(); 75 | splitContainer2.Panel1.SuspendLayout(); 76 | splitContainer2.Panel2.SuspendLayout(); 77 | splitContainer2.SuspendLayout(); 78 | ((System.ComponentModel.ISupportInitialize)splitContainer3).BeginInit(); 79 | splitContainer3.Panel1.SuspendLayout(); 80 | splitContainer3.Panel2.SuspendLayout(); 81 | splitContainer3.SuspendLayout(); 82 | SuspendLayout(); 83 | // 84 | // menuStrip1 85 | // 86 | menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem }); 87 | menuStrip1.Location = new System.Drawing.Point(0, 0); 88 | menuStrip1.Name = "menuStrip1"; 89 | menuStrip1.Size = new System.Drawing.Size(777, 24); 90 | menuStrip1.TabIndex = 1; 91 | menuStrip1.Text = "menuStrip1"; 92 | // 93 | // fileToolStripMenuItem 94 | // 95 | fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { newToolStripMenuItem, openToolStripMenuItem, toolStripSeparator, saveToolStripMenuItem, saveAsToolStripMenuItem, toolStripSeparator1, printToolStripMenuItem, printPreviewToolStripMenuItem, toolStripSeparator2, exitToolStripMenuItem }); 96 | fileToolStripMenuItem.Name = "fileToolStripMenuItem"; 97 | fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); 98 | fileToolStripMenuItem.Text = "&File"; 99 | // 100 | // newToolStripMenuItem 101 | // 102 | newToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("newToolStripMenuItem.Image"); 103 | newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 104 | newToolStripMenuItem.Name = "newToolStripMenuItem"; 105 | newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N; 106 | newToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 107 | newToolStripMenuItem.Text = "&New"; 108 | // 109 | // openToolStripMenuItem 110 | // 111 | openToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("openToolStripMenuItem.Image"); 112 | openToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 113 | openToolStripMenuItem.Name = "openToolStripMenuItem"; 114 | openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O; 115 | openToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 116 | openToolStripMenuItem.Text = "&Open"; 117 | // 118 | // toolStripSeparator 119 | // 120 | toolStripSeparator.Name = "toolStripSeparator"; 121 | toolStripSeparator.Size = new System.Drawing.Size(143, 6); 122 | // 123 | // saveToolStripMenuItem 124 | // 125 | saveToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("saveToolStripMenuItem.Image"); 126 | saveToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 127 | saveToolStripMenuItem.Name = "saveToolStripMenuItem"; 128 | saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S; 129 | saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 130 | saveToolStripMenuItem.Text = "&Save"; 131 | // 132 | // saveAsToolStripMenuItem 133 | // 134 | saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; 135 | saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 136 | saveAsToolStripMenuItem.Text = "Save &As"; 137 | // 138 | // toolStripSeparator1 139 | // 140 | toolStripSeparator1.Name = "toolStripSeparator1"; 141 | toolStripSeparator1.Size = new System.Drawing.Size(143, 6); 142 | // 143 | // printToolStripMenuItem 144 | // 145 | printToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("printToolStripMenuItem.Image"); 146 | printToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 147 | printToolStripMenuItem.Name = "printToolStripMenuItem"; 148 | printToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P; 149 | printToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 150 | printToolStripMenuItem.Text = "&Print"; 151 | // 152 | // printPreviewToolStripMenuItem 153 | // 154 | printPreviewToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("printPreviewToolStripMenuItem.Image"); 155 | printPreviewToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 156 | printPreviewToolStripMenuItem.Name = "printPreviewToolStripMenuItem"; 157 | printPreviewToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 158 | printPreviewToolStripMenuItem.Text = "Print Pre&view"; 159 | // 160 | // toolStripSeparator2 161 | // 162 | toolStripSeparator2.Name = "toolStripSeparator2"; 163 | toolStripSeparator2.Size = new System.Drawing.Size(143, 6); 164 | // 165 | // exitToolStripMenuItem 166 | // 167 | exitToolStripMenuItem.Name = "exitToolStripMenuItem"; 168 | exitToolStripMenuItem.Size = new System.Drawing.Size(146, 22); 169 | exitToolStripMenuItem.Text = "E&xit"; 170 | exitToolStripMenuItem.Click += exitToolStripMenuItem_Click; 171 | // 172 | // editToolStripMenuItem 173 | // 174 | editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, toolStripSeparator3, cutToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, toolStripSeparator4, selectAllToolStripMenuItem }); 175 | editToolStripMenuItem.Name = "editToolStripMenuItem"; 176 | editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); 177 | editToolStripMenuItem.Text = "&Edit"; 178 | // 179 | // undoToolStripMenuItem 180 | // 181 | undoToolStripMenuItem.Name = "undoToolStripMenuItem"; 182 | undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z; 183 | undoToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 184 | undoToolStripMenuItem.Text = "&Undo"; 185 | // 186 | // redoToolStripMenuItem 187 | // 188 | redoToolStripMenuItem.Name = "redoToolStripMenuItem"; 189 | redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y; 190 | redoToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 191 | redoToolStripMenuItem.Text = "&Redo"; 192 | // 193 | // toolStripSeparator3 194 | // 195 | toolStripSeparator3.Name = "toolStripSeparator3"; 196 | toolStripSeparator3.Size = new System.Drawing.Size(141, 6); 197 | // 198 | // cutToolStripMenuItem 199 | // 200 | cutToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("cutToolStripMenuItem.Image"); 201 | cutToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 202 | cutToolStripMenuItem.Name = "cutToolStripMenuItem"; 203 | cutToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X; 204 | cutToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 205 | cutToolStripMenuItem.Text = "Cu&t"; 206 | // 207 | // copyToolStripMenuItem 208 | // 209 | copyToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("copyToolStripMenuItem.Image"); 210 | copyToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 211 | copyToolStripMenuItem.Name = "copyToolStripMenuItem"; 212 | copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C; 213 | copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 214 | copyToolStripMenuItem.Text = "&Copy"; 215 | // 216 | // pasteToolStripMenuItem 217 | // 218 | pasteToolStripMenuItem.Image = (System.Drawing.Image)resources.GetObject("pasteToolStripMenuItem.Image"); 219 | pasteToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Magenta; 220 | pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; 221 | pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V; 222 | pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 223 | pasteToolStripMenuItem.Text = "&Paste"; 224 | // 225 | // toolStripSeparator4 226 | // 227 | toolStripSeparator4.Name = "toolStripSeparator4"; 228 | toolStripSeparator4.Size = new System.Drawing.Size(141, 6); 229 | // 230 | // selectAllToolStripMenuItem 231 | // 232 | selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; 233 | selectAllToolStripMenuItem.Size = new System.Drawing.Size(144, 22); 234 | selectAllToolStripMenuItem.Text = "Select &All"; 235 | // 236 | // toolsToolStripMenuItem 237 | // 238 | toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { customizeToolStripMenuItem, optionsToolStripMenuItem }); 239 | toolsToolStripMenuItem.Name = "toolsToolStripMenuItem"; 240 | toolsToolStripMenuItem.Size = new System.Drawing.Size(46, 20); 241 | toolsToolStripMenuItem.Text = "&Tools"; 242 | // 243 | // customizeToolStripMenuItem 244 | // 245 | customizeToolStripMenuItem.Name = "customizeToolStripMenuItem"; 246 | customizeToolStripMenuItem.Size = new System.Drawing.Size(130, 22); 247 | customizeToolStripMenuItem.Text = "&Customize"; 248 | // 249 | // optionsToolStripMenuItem 250 | // 251 | optionsToolStripMenuItem.Name = "optionsToolStripMenuItem"; 252 | optionsToolStripMenuItem.Size = new System.Drawing.Size(130, 22); 253 | optionsToolStripMenuItem.Text = "&Options"; 254 | // 255 | // helpToolStripMenuItem 256 | // 257 | helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { contentsToolStripMenuItem, indexToolStripMenuItem, searchToolStripMenuItem, toolStripSeparator5, aboutToolStripMenuItem }); 258 | helpToolStripMenuItem.Name = "helpToolStripMenuItem"; 259 | helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); 260 | helpToolStripMenuItem.Text = "&Help"; 261 | // 262 | // contentsToolStripMenuItem 263 | // 264 | contentsToolStripMenuItem.Name = "contentsToolStripMenuItem"; 265 | contentsToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 266 | contentsToolStripMenuItem.Text = "&Contents"; 267 | // 268 | // indexToolStripMenuItem 269 | // 270 | indexToolStripMenuItem.Name = "indexToolStripMenuItem"; 271 | indexToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 272 | indexToolStripMenuItem.Text = "&Index"; 273 | // 274 | // searchToolStripMenuItem 275 | // 276 | searchToolStripMenuItem.Name = "searchToolStripMenuItem"; 277 | searchToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 278 | searchToolStripMenuItem.Text = "&Search"; 279 | // 280 | // toolStripSeparator5 281 | // 282 | toolStripSeparator5.Name = "toolStripSeparator5"; 283 | toolStripSeparator5.Size = new System.Drawing.Size(119, 6); 284 | // 285 | // aboutToolStripMenuItem 286 | // 287 | aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; 288 | aboutToolStripMenuItem.Size = new System.Drawing.Size(122, 22); 289 | aboutToolStripMenuItem.Text = "&About..."; 290 | aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click; 291 | // 292 | // splitContainer1 293 | // 294 | splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; 295 | splitContainer1.Location = new System.Drawing.Point(0, 24); 296 | splitContainer1.Name = "splitContainer1"; 297 | // 298 | // splitContainer1.Panel1 299 | // 300 | splitContainer1.Panel1.Controls.Add(splitContainer2); 301 | // 302 | // splitContainer1.Panel2 303 | // 304 | splitContainer1.Panel2.Controls.Add(splitContainer3); 305 | splitContainer1.Size = new System.Drawing.Size(777, 463); 306 | splitContainer1.SplitterDistance = 380; 307 | splitContainer1.TabIndex = 2; 308 | // 309 | // splitContainer2 310 | // 311 | splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; 312 | splitContainer2.Location = new System.Drawing.Point(0, 0); 313 | splitContainer2.Name = "splitContainer2"; 314 | splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; 315 | // 316 | // splitContainer2.Panel1 317 | // 318 | splitContainer2.Panel1.Controls.Add(glControl1); 319 | // 320 | // splitContainer2.Panel2 321 | // 322 | splitContainer2.Panel2.Controls.Add(glControl3); 323 | splitContainer2.Size = new System.Drawing.Size(380, 463); 324 | splitContainer2.SplitterDistance = 200; 325 | splitContainer2.TabIndex = 0; 326 | // 327 | // glControl1 328 | // 329 | glControl1.API = Windowing.Common.ContextAPI.OpenGL; 330 | glControl1.APIVersion = new System.Version(3, 3, 0, 0); 331 | glControl1.Dock = System.Windows.Forms.DockStyle.Fill; 332 | glControl1.Flags = Windowing.Common.ContextFlags.Default; 333 | glControl1.IsEventDriven = true; 334 | glControl1.Location = new System.Drawing.Point(0, 0); 335 | glControl1.Name = "glControl1"; 336 | glControl1.Profile = Windowing.Common.ContextProfile.Compatability; 337 | glControl1.SharedContext = null; 338 | glControl1.Size = new System.Drawing.Size(380, 200); 339 | glControl1.TabIndex = 0; 340 | glControl1.Text = "glControl1"; 341 | // 342 | // glControl3 343 | // 344 | glControl3.API = Windowing.Common.ContextAPI.OpenGL; 345 | glControl3.APIVersion = new System.Version(3, 3, 0, 0); 346 | glControl3.Dock = System.Windows.Forms.DockStyle.Fill; 347 | glControl3.Flags = Windowing.Common.ContextFlags.Default; 348 | glControl3.IsEventDriven = true; 349 | glControl3.Location = new System.Drawing.Point(0, 0); 350 | glControl3.Name = "glControl3"; 351 | glControl3.Profile = Windowing.Common.ContextProfile.Compatability; 352 | glControl3.SharedContext = glControl1; 353 | glControl3.Size = new System.Drawing.Size(380, 259); 354 | glControl3.TabIndex = 0; 355 | glControl3.Text = "glControl3"; 356 | // 357 | // splitContainer3 358 | // 359 | splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; 360 | splitContainer3.Location = new System.Drawing.Point(0, 0); 361 | splitContainer3.Name = "splitContainer3"; 362 | splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; 363 | // 364 | // splitContainer3.Panel1 365 | // 366 | splitContainer3.Panel1.Controls.Add(glControl2); 367 | // 368 | // splitContainer3.Panel2 369 | // 370 | splitContainer3.Panel2.Controls.Add(glControl4); 371 | splitContainer3.Size = new System.Drawing.Size(393, 463); 372 | splitContainer3.SplitterDistance = 250; 373 | splitContainer3.TabIndex = 0; 374 | // 375 | // glControl2 376 | // 377 | glControl2.API = Windowing.Common.ContextAPI.OpenGL; 378 | glControl2.APIVersion = new System.Version(3, 3, 0, 0); 379 | glControl2.Dock = System.Windows.Forms.DockStyle.Fill; 380 | glControl2.Flags = Windowing.Common.ContextFlags.Default; 381 | glControl2.IsEventDriven = true; 382 | glControl2.Location = new System.Drawing.Point(0, 0); 383 | glControl2.Name = "glControl2"; 384 | glControl2.Profile = Windowing.Common.ContextProfile.Compatability; 385 | glControl2.SharedContext = glControl1; 386 | glControl2.Size = new System.Drawing.Size(393, 250); 387 | glControl2.TabIndex = 0; 388 | glControl2.Text = "glControl2"; 389 | // 390 | // glControl4 391 | // 392 | glControl4.API = Windowing.Common.ContextAPI.OpenGL; 393 | glControl4.APIVersion = new System.Version(3, 3, 0, 0); 394 | glControl4.Dock = System.Windows.Forms.DockStyle.Fill; 395 | glControl4.Flags = Windowing.Common.ContextFlags.Default; 396 | glControl4.IsEventDriven = true; 397 | glControl4.Location = new System.Drawing.Point(0, 0); 398 | glControl4.Name = "glControl4"; 399 | glControl4.Profile = Windowing.Common.ContextProfile.Compatability; 400 | glControl4.SharedContext = glControl1; 401 | glControl4.Size = new System.Drawing.Size(393, 209); 402 | glControl4.TabIndex = 0; 403 | glControl4.Text = "glControl4"; 404 | // 405 | // Form1 406 | // 407 | AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); 408 | AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 409 | ClientSize = new System.Drawing.Size(777, 487); 410 | Controls.Add(splitContainer1); 411 | Controls.Add(menuStrip1); 412 | Name = "Form1"; 413 | Text = "Multi GLControl Test"; 414 | menuStrip1.ResumeLayout(false); 415 | menuStrip1.PerformLayout(); 416 | splitContainer1.Panel1.ResumeLayout(false); 417 | splitContainer1.Panel2.ResumeLayout(false); 418 | ((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit(); 419 | splitContainer1.ResumeLayout(false); 420 | splitContainer2.Panel1.ResumeLayout(false); 421 | splitContainer2.Panel2.ResumeLayout(false); 422 | ((System.ComponentModel.ISupportInitialize)splitContainer2).EndInit(); 423 | splitContainer2.ResumeLayout(false); 424 | splitContainer3.Panel1.ResumeLayout(false); 425 | splitContainer3.Panel2.ResumeLayout(false); 426 | ((System.ComponentModel.ISupportInitialize)splitContainer3).EndInit(); 427 | splitContainer3.ResumeLayout(false); 428 | ResumeLayout(false); 429 | PerformLayout(); 430 | } 431 | 432 | #endregion 433 | private System.Windows.Forms.MenuStrip menuStrip1; 434 | private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; 435 | private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; 436 | private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; 437 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator; 438 | private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; 439 | private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem; 440 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 441 | private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem; 442 | private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem; 443 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; 444 | private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; 445 | private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; 446 | private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem; 447 | private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem; 448 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; 449 | private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem; 450 | private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem; 451 | private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem; 452 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; 453 | private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; 454 | private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem; 455 | private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem; 456 | private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; 457 | private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; 458 | private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem; 459 | private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem; 460 | private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem; 461 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; 462 | private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; 463 | private System.Windows.Forms.SplitContainer splitContainer1; 464 | private System.Windows.Forms.SplitContainer splitContainer2; 465 | private GLControl glControl1; 466 | private GLControl glControl3; 467 | private System.Windows.Forms.SplitContainer splitContainer3; 468 | private GLControl glControl2; 469 | private GLControl glControl4; 470 | } 471 | } 472 | 473 | --------------------------------------------------------------------------------