workaround #344 ?

This commit is contained in:
4sval
2022-12-13 17:51:55 +01:00
parent 2a0dd1eb8a
commit 0327af1bd5
2 changed files with 28 additions and 2 deletions

View File

@@ -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<uint>(Indices, BufferTarget.ElementArrayBuffer);
_vbo = new BufferObject<float>(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)

View File

@@ -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(