From 0327af1bd55105e3aa13d7e486d789a05dfab958 Mon Sep 17 00:00:00 2001 From: 4sval Date: Tue, 13 Dec 2022 17:51:55 +0100 Subject: [PATCH] workaround #344 ? --- FModel/Views/Snooper/Model.cs | 5 +++-- FModel/Views/Snooper/SnimGui.cs | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/FModel/Views/Snooper/Model.cs b/FModel/Views/Snooper/Model.cs index c8d73658..c56504f8 100644 --- a/FModel/Views/Snooper/Model.cs +++ b/FModel/Views/Snooper/Model.cs @@ -211,6 +211,7 @@ public class Model : IDisposable public void Setup(Options options) { _handle = GL.CreateProgram(); + var broken = GL.GetInteger(GetPName.MaxTextureUnits) == 0; _ebo = new BufferObject(Indices, BufferTarget.ElementArrayBuffer); _vbo = new BufferObject(Vertices, BufferTarget.ArrayBuffer); @@ -221,7 +222,7 @@ public class Model : IDisposable _vao.VertexAttributePointer(2, 3, VertexAttribPointerType.Float, _vertexSize, 4); // normal _vao.VertexAttributePointer(3, 3, VertexAttribPointerType.Float, _vertexSize, 7); // tangent _vao.VertexAttributePointer(4, 2, VertexAttribPointerType.Float, _vertexSize, 10); // uv - _vao.VertexAttributePointer(5, 1, VertexAttribPointerType.Float, _vertexSize, 12); // texture index + if (!broken) _vao.VertexAttributePointer(5, 1, VertexAttribPointerType.Float, _vertexSize, 12); // texture index _vao.VertexAttributePointer(6, 4, VertexAttribPointerType.Float, _vertexSize, 13); // color _vao.VertexAttributePointer(7, 4, VertexAttribPointerType.Float, _vertexSize, 17); // boneids _vao.VertexAttributePointer(8, 4, VertexAttribPointerType.Float, _vertexSize, 21); // boneweights @@ -232,7 +233,7 @@ public class Model : IDisposable for (var i = 0; i < Materials.Length; i++) { if (!Materials[i].IsUsed) continue; - Materials[i].Setup(options, NumTexCoords); + Materials[i].Setup(options, broken ? 1 : NumTexCoords); } if (HasMorphTargets) diff --git a/FModel/Views/Snooper/SnimGui.cs b/FModel/Views/Snooper/SnimGui.cs index ade5925b..9449ef6b 100644 --- a/FModel/Views/Snooper/SnimGui.cs +++ b/FModel/Views/Snooper/SnimGui.cs @@ -6,6 +6,7 @@ using FModel.Framework; using ImGuiNET; using OpenTK.Windowing.Common; using System.Numerics; +using System.Text; using FModel.Settings; using OpenTK.Graphics.OpenGL4; @@ -238,6 +239,30 @@ public class SnimGui } }); + Modal("GPU OpenGL Info", ImGui.MenuItem("GPU Info"), () => + { + var s = new StringBuilder(); + s.AppendLine($"MaxTextureImageUnits: {GL.GetInteger(GetPName.MaxTextureImageUnits)}"); + s.AppendLine($"MaxTextureUnits: {GL.GetInteger(GetPName.MaxTextureUnits)}"); + s.AppendLine($"MaxVertexTextureImageUnits: {GL.GetInteger(GetPName.MaxVertexTextureImageUnits)}"); + s.AppendLine($"MaxCombinedTextureImageUnits: {GL.GetInteger(GetPName.MaxCombinedTextureImageUnits)}"); + s.AppendLine($"MaxGeometryTextureImageUnits: {GL.GetInteger(GetPName.MaxGeometryTextureImageUnits)}"); + s.AppendLine($"MaxTextureCoords: {GL.GetInteger(GetPName.MaxTextureCoords)}"); + s.AppendLine($"Renderer: {_renderer}"); + s.AppendLine($"Version: {_version}"); + ImGui.TextWrapped(s.ToString()); + ImGui.Separator(); + + var size = new Vector2(120, 0); + ImGui.InvisibleButton("", size * 4); + ImGui.SameLine(); + ImGui.SetItemDefaultFocus(); + if (ImGui.Button("OK", size)) + { + ImGui.CloseCurrentPopup(); + } + }); + Modal("About Snooper", ImGui.MenuItem("About"), () => { ImGui.TextWrapped(