-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathMainWindow.xaml.cs
44 lines (36 loc) · 1.27 KB
/
MainWindow.xaml.cs
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
using System;
using System.Windows;
using OpenTK.Wpf;
namespace Example {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public sealed partial class MainWindow {
ExampleScene mainScene = new ExampleScene();
ExampleScene insetScene = new ExampleScene();
public MainWindow() {
InitializeComponent();
// You can start and rely on the Settings property that may be set in XAML or elsewhere in the codebase.
OpenTkControl.Start();
mainScene.Initialize();
// Or, you can suppy a settings object directly.
InsetControl.Start(new GLWpfControlSettings()
{
MajorVersion = 2,
MinorVersion = 1,
RenderContinuously = false,
});
insetScene.Initialize();
}
private void OpenTkControl_OnRender(TimeSpan delta) {
mainScene.Render();
}
private void InsetControl_OnRender(TimeSpan delta) {
insetScene.Render();
}
private void RedrawButton_OnClick(object sender, RoutedEventArgs e) {
// re-draw the inset control when the button is clicked.
InsetControl.InvalidateVisual();
}
}
}