From 45d45395c4c7ec7fdc6bac2e3324baeab6af2c38 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 2 Dec 2020 14:17:00 +0100 Subject: [PATCH] fix GLWpfControlSettings --- .../Preview/ModelPreview.vb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb index 120c64e..d3c7165 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb @@ -11,6 +11,7 @@ Imports System.Windows.Forms.Integration Imports OpenTK.Mathematics Imports System.Windows.Input Imports Key = OpenTK3.Input.Key +Imports OpenTK.Wpf Namespace PreviewN @@ -136,8 +137,8 @@ Namespace PreviewN Me.glControlHost.Name = "glControl1" Me.glControlHost.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom Me.glControlHost.Location = New Point(0, 0) - Me.glControlHost.MinimumSize = New Size(600, 120) Me.glControlHost.Size = Me.ClientSize + Me.glControlHost.MinimumSize = New Size(600, 120) Me.glControlHost.TabIndex = 0 Me.glControlHost.TabStop = False Me.glControlHost.Child = glControl1 @@ -149,7 +150,12 @@ Namespace PreviewN 'Toolkit.Init() - Dim controlSettings As New Wpf.GLWpfControlSettings + + Dim controlSettings As New GLWpfControlSettings With + { + .RenderContinuously = False, + .GraphicsProfile = Windowing.Common.ContextProfile.Compatability + } glControl1.Start(controlSettings) AddHandler glControl1.MouseWheel, AddressOf glControl1_Wheel ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControl1.Width / glControl1.Height, 100.0F, 100000.0F) @@ -257,8 +263,8 @@ Namespace PreviewN Private Sub glControl1_Resize(sender As Object, e As EventArgs) Handles glControlHost.Resize 'glControl1.Context.Update(glControl1.WindowInfo) - GL.Viewport(0, 0, glControl1.Width, glControl1.Height) - ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControl1.Width / glControl1.Height, 100.0F, 100000.0F) + GL.Viewport(0, 0, glControlHost.Width, glControlHost.Height) + ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControlHost.Width / glControlHost.Height, 100.0F, 100000.0F) glControlHost.Invalidate() End Sub