diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 33e71b15..bc9a4c14 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +### 5.5.10 +- [OpenGL/WPF/ThreadedRenderControl] fixed resize + ### 5.5.9 - [OpenGL/WPF] Threaded rendering control diff --git a/src/Application/Aardvark.Application.WPF.GL/ThreadedRenderControl.fs b/src/Application/Aardvark.Application.WPF.GL/ThreadedRenderControl.fs index b589c9c1..fd27a820 100644 --- a/src/Application/Aardvark.Application.WPF.GL/ThreadedRenderControl.fs +++ b/src/Application/Aardvark.Application.WPF.GL/ThreadedRenderControl.fs @@ -190,24 +190,23 @@ type ThreadedRenderControl(runtime : Runtime, debug : IDebugConfig, samples : in textures.Add tex let renderPendingLock = obj() - let mutable renderPending = true + let mutable renderPending = false let mutable disposed = false let renderThread = - let handle = runtime.Context.CreateContext() + startThread <| fun () -> try let ctx = runtime.Context - use __ = ctx.RenderingLock handle + let mutable depth : option = None let mutable realColor : option = None - GL.SetDefaultStates() - GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0) - GL.Disable(EnableCap.Multisample) + + let mutable ctxLock = None while not disposed do lock renderPendingLock (fun () -> @@ -215,6 +214,15 @@ type ThreadedRenderControl(runtime : Runtime, debug : IDebugConfig, samples : in Monitor.Wait renderPendingLock |> ignore renderPending <- false ) + match ctxLock with + | None -> + let handle = runtime.Context.CreateContext() + let h = ctx.RenderingLock handle + ctxLock <- Some h + GL.SetDefaultStates() + GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0) + GL.Disable(EnableCap.Multisample) + | Some _ -> () match task with | Some task -> @@ -417,6 +425,7 @@ type ThreadedRenderControl(runtime : Runtime, debug : IDebugConfig, samples : in ctx.Delete colorTex GL.Check() pushNewTexture fboSize + x.ForceRedraw() x.SwapBuffers() @@ -425,19 +434,20 @@ type ThreadedRenderControl(runtime : Runtime, debug : IDebugConfig, samples : in override x.OnPaint(e) = + //Log.line "PAINT VER 3" base.OnPaint(e) - if not loaded then - let screenSize = V2i(x.ClientSize.Width, x.ClientSize.Height) - let fboSize = V2i(max 1 (int (round (float screenSize.X * subsampling))), (int (round (float screenSize.Y * subsampling)))) - if fboSize <> sizes.Value then - useTransaction transaction (fun () -> sizes.Value <- fboSize) + let screenSize = V2i(x.ClientSize.Width, x.ClientSize.Height) + let fboSize = V2i(max 1 (int (round (float screenSize.X * subsampling))), (int (round (float screenSize.Y * subsampling)))) + if fboSize <> sizes.Value then + transact (fun () -> sizes.Value <- fboSize) + if not loaded then pushNewTexture fboSize - - lock presentTextures (fun () -> - while presentTextures.Count = 0 do - Monitor.Wait presentTextures |> ignore - ) + x.ForceRedraw() + // lock presentTextures (fun () -> + // while presentTextures.Count = 0 do + // Monitor.Wait presentTextures |> ignore + // ) loaded <- true