├── GLWpfControl.snk ├── paket.lock ├── .editorconfig ├── paket.dependencies ├── src ├── GLWpfControl │ ├── README.md │ ├── GLWpfControl.csproj │ ├── Interop │ │ ├── PresentationParameters.cs │ │ ├── Enums.cs │ │ └── DXInterop.cs │ ├── paket │ ├── GLWpfControlSettings.cs │ ├── NonReloadingTabControl.cs │ ├── DXGLContext.cs │ ├── GLWpfControl.cs │ └── GLWpfControlRenderer.cs └── Example │ ├── App.xaml.cs │ ├── App.xaml │ ├── AssemblyInfo.cs │ ├── Example.csproj │ ├── MainWindow.xaml.cs │ ├── TabbedMainWindowTest.xaml │ ├── MainWindow.xaml │ ├── TabbedMainWindowTest.xaml.cs │ └── ExampleScene.cs ├── .config └── dotnet-tools.json ├── GLWpfControl.sln.DotSettings ├── LICENSE.md ├── GLWpfControl.sln ├── README.md ├── RELEASE_NOTES.md └── .gitignore /GLWpfControl.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentk/GLWpfControl/HEAD/GLWpfControl.snk -------------------------------------------------------------------------------- /paket.lock: -------------------------------------------------------------------------------- 1 | STORAGE: NONE 2 | RESTRICTION: || (== netcoreapp3.1) (== netstandard2.0) (== netstandard2.1) 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.cs] 2 | 3 | # IDE0090: Use 'new(...)' 4 | csharp_style_implicit_object_creation_when_type_is_apparent = false 5 | -------------------------------------------------------------------------------- /paket.dependencies: -------------------------------------------------------------------------------- 1 | source https://api.nuget.org/v3/index.json 2 | 3 | storage: none 4 | framework: netcoreapp3.1, netstandard2.0, netstandard2.1 -------------------------------------------------------------------------------- /src/GLWpfControl/README.md: -------------------------------------------------------------------------------- 1 | # OpenTK.GLWpfControl 2 | 3 | A native WPF control for OpenTK 4.8.0+ 4 | 5 | Read more about how to use GLWpfControl at: https://github.com/opentk/GLWpfControl -------------------------------------------------------------------------------- /src/Example/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Example { 4 | /// 5 | /// Interaction logic for App.xaml 6 | /// 7 | public partial class App : Application { } 8 | } -------------------------------------------------------------------------------- /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "paket": { 6 | "version": "9.0.2", 7 | "commands": [ 8 | "paket" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Example/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Example/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] -------------------------------------------------------------------------------- /GLWpfControl.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | GL 3 | True 4 | True -------------------------------------------------------------------------------- /src/Example/Example.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | WinExe 4 | netcoreapp3.1 5 | true 6 | false 7 | Example.App 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/GLWpfControl/GLWpfControl.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp3.1 4 | true 5 | OpenTK.Wpf 6 | false 7 | 9.0 8 | true 9 | enable 10 | bin\$(Configuration)\$(TargetFramework) 11 | true 12 | ..\..\GLWpfControl.snk 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/GLWpfControl/Interop/PresentationParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace OpenTK.Wpf.Interop 5 | { 6 | [StructLayout(LayoutKind.Sequential)] 7 | internal struct PresentationParameters 8 | { 9 | public int BackBufferWidth; 10 | public int BackBufferHeight; 11 | public Format BackBufferFormat; 12 | public uint BackBufferCount; 13 | public MultisampleType MultiSampleType; 14 | public int MultiSampleQuality; 15 | public SwapEffect SwapEffect; 16 | public IntPtr DeviceWindowHandle; 17 | public int Windowed; 18 | public int EnableAutoDepthStencil; 19 | public Format AutoDepthStencilFormat; 20 | public int Flags; 21 | public int FullScreen_RefreshRateInHz; 22 | public int PresentationInterval; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/GLWpfControl/paket: -------------------------------------------------------------------------------- 1 | type project 2 | id OpenTK.GLWpfControl 3 | description 4 | A native WPF control for OpenTK 4.8.0+ 5 | 6 | dependencies 7 | OpenTK ~> 4.0 >= 4.8.2 8 | 9 | files 10 | bin\Release\netcoreapp3.1\netcoreapp3.1\GLWpfControl.dll ==> lib\netcoreapp3.1 11 | bin\Release\netcoreapp3.1\netcoreapp3.1\GLWpfControl.pdb ==> lib\netcoreapp3.1 12 | README.md ==> docs 13 | 14 | readme docs\README.md 15 | owners opentk varon 16 | authors Team OpenTK 17 | projectUrl https://www.opentk.net 18 | iconUrl https://raw.githubusercontent.com/opentk/opentk.net/docfx/assets/opentk.png 19 | licenseUrl https://licenses.nuget.org/MIT 20 | licenseExpression MIT 21 | requireLicenseAcceptance false 22 | tags opentk;opengl;wpf;csharp;fsharp;vb;dotnet;mono;graphics;game;scientific;science;3d;2d 23 | copyright 24 | Copyright (c) 2022 Team OpenTK. 25 | 26 | include-pdbs true 27 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 varon 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 | -------------------------------------------------------------------------------- /src/Example/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using OpenTK.Wpf; 4 | 5 | namespace Example { 6 | /// 7 | /// Interaction logic for MainWindow.xaml 8 | /// 9 | public sealed partial class MainWindow { 10 | 11 | ExampleScene mainScene = new ExampleScene(); 12 | ExampleScene insetScene = new ExampleScene(); 13 | 14 | public MainWindow() { 15 | InitializeComponent(); 16 | 17 | // You can start and rely on the Settings property that may be set in XAML or elsewhere in the codebase. 18 | OpenTkControl.Start(); 19 | mainScene.Initialize(); 20 | 21 | // Or, you can suppy a settings object directly. 22 | InsetControl.Start(new GLWpfControlSettings() 23 | { 24 | MajorVersion = 2, 25 | MinorVersion = 1, 26 | RenderContinuously = false, 27 | }); 28 | insetScene.Initialize(); 29 | } 30 | 31 | private void OpenTkControl_OnRender(TimeSpan delta) { 32 | mainScene.Render(); 33 | } 34 | 35 | private void InsetControl_OnRender(TimeSpan delta) { 36 | insetScene.Render(); 37 | } 38 | 39 | private void RedrawButton_OnClick(object sender, RoutedEventArgs e) { 40 | // re-draw the inset control when the button is clicked. 41 | InsetControl.InvalidateVisual(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Example/TabbedMainWindowTest.xaml: -------------------------------------------------------------------------------- 1 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 25 | 26 | 27 | 28 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/Example/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 29 | 35 | 43 |