From d17d1ac7658b51a0382ea6f7f016ee1fe767c1a8 Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Wed, 24 Mar 2021 11:21:39 +0100 Subject: [PATCH] Added more options to CreateWindowFramebuffer --- SMCode/SM.Base/SM.Base.csproj | 1 - SMCode/SM.Base/Window/RenderPipeline.cs | 17 ++++++++++------- SMCode/SM.OGL/Framebuffer/Framebuffer.cs | 3 +++ SMCode/SM2D/SM2D.csproj | 17 ++++++++--------- SM_TEST/SM_TEST.csproj | 5 ++++- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/SMCode/SM.Base/SM.Base.csproj b/SMCode/SM.Base/SM.Base.csproj index ee29747..c2abcad 100644 --- a/SMCode/SM.Base/SM.Base.csproj +++ b/SMCode/SM.Base/SM.Base.csproj @@ -121,7 +121,6 @@ SM.OGL - diff --git a/SMCode/SM.Base/Window/RenderPipeline.cs b/SMCode/SM.Base/Window/RenderPipeline.cs index 649d11a..f0b5006 100644 --- a/SMCode/SM.Base/Window/RenderPipeline.cs +++ b/SMCode/SM.Base/Window/RenderPipeline.cs @@ -79,7 +79,7 @@ namespace SM.Base.Window foreach (var framebuffer in Framebuffers) framebuffer.Dispose(); - Thread.Sleep(50); + Thread.Sleep(100); foreach (var framebuffer in Framebuffers) framebuffer.Compile(); @@ -90,14 +90,17 @@ namespace SM.Base.Window /// /// /// - public Framebuffer CreateWindowFramebuffer(int multisamples = 0) + public Framebuffer CreateWindowFramebuffer(int multisamples = 0, PixelInformation? pixelInformation = null, bool depth = true) { Framebuffer framebuffer = new Framebuffer(ConnectedWindow); - framebuffer.Append("color", new ColorAttachment(0, PixelInformation.RGBA_LDR, multisamples)); - - RenderbufferAttachment depthAttach = RenderbufferAttachment.Depth; - depthAttach.Multisample = multisamples; - framebuffer.AppendRenderbuffer(depthAttach); + framebuffer.Append("color", new ColorAttachment(0, pixelInformation.GetValueOrDefault(PixelInformation.RGBA_LDR), multisamples)); + + if (depth) + { + RenderbufferAttachment depthAttach = RenderbufferAttachment.Depth; + depthAttach.Multisample = multisamples; + framebuffer.AppendRenderbuffer(depthAttach); + } return framebuffer; } diff --git a/SMCode/SM.OGL/Framebuffer/Framebuffer.cs b/SMCode/SM.OGL/Framebuffer/Framebuffer.cs index e498b67..c5d40a1 100644 --- a/SMCode/SM.OGL/Framebuffer/Framebuffer.cs +++ b/SMCode/SM.OGL/Framebuffer/Framebuffer.cs @@ -18,6 +18,9 @@ namespace SM.OGL.Framebuffer /// protected override bool AutoCompile { get; set; } = true; + /// + /// The window for the screen + /// public static IFramebufferWindow ScreenWindow; /// diff --git a/SMCode/SM2D/SM2D.csproj b/SMCode/SM2D/SM2D.csproj index f4b25f5..d58b4f3 100644 --- a/SMCode/SM2D/SM2D.csproj +++ b/SMCode/SM2D/SM2D.csproj @@ -53,6 +53,14 @@ + + + 3.3.1 + + + + + {8e733844-4204-43e7-b3dc-3913cddabb0d} @@ -63,14 +71,5 @@ SM.OGL - - - 3.3.1 - - - - - - \ No newline at end of file diff --git a/SM_TEST/SM_TEST.csproj b/SM_TEST/SM_TEST.csproj index b84ebe5..5cd19ac 100644 --- a/SM_TEST/SM_TEST.csproj +++ b/SM_TEST/SM_TEST.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {6D4FB8E6-4D0B-4928-8F9E-EF5C2FBF44E8} - Exe + WinExe SM_TEST SM_TEST v4.5.2 @@ -32,6 +32,9 @@ prompt 4 + + + ..\packages\OpenTK.3.3.1\lib\net20\OpenTK.dll