Tried rendering the sphere without success
All checks were successful
Gitea Actions Demo / Scan the project (push) Successful in 29s

This commit is contained in:
2024-01-02 16:02:24 +01:00
parent 8470304859
commit cf14c9a79e
9 changed files with 135 additions and 53 deletions

View File

@ -4,6 +4,7 @@ using System.Numerics;
namespace Nebulix.Rendering;
// TODO: make IDisposable
public class Shader
{
private readonly GL _glContext;
@ -21,7 +22,7 @@ public class Shader
_shaderProgramId = CreateProgram(vertexShader, fragmentShader);
}
public void Use() { _glContext.UseProgram(_shaderProgramId); }
public void Use() => _glContext.UseProgram(_shaderProgramId);
#region Set uniforms
public void SetInt(string name, int value)

View File

@ -11,17 +11,14 @@ namespace Nebulix.Rendering;
[Serializable]
public class ShaderCompileException : Exception
{
protected ShaderType _shaderType;
protected ShaderType ShaderType;
public ShaderCompileException(ShaderType shaderType) : base("Unable to compile shader.") { _shaderType = shaderType; }
public ShaderCompileException(ShaderType shaderType, string message) : base(message) { _shaderType = shaderType; }
public ShaderCompileException(ShaderType shaderType, string message, Exception inner) : base(message, inner) { _shaderType = shaderType; }
protected ShaderCompileException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
public ShaderCompileException(ShaderType shaderType) : base("Unable to compile shader.") { ShaderType = shaderType; }
public ShaderCompileException(ShaderType shaderType, string message) : base(message) { ShaderType = shaderType; }
public ShaderCompileException(ShaderType shaderType, string message, Exception inner) : base(message, inner) { ShaderType = shaderType; }
public override string ToString()
{
return $"Type of Shader: '{_shaderType}'" + "\n" + Message;
return $"Type of Shader: '{ShaderType}'" + "\n" + Message;
}
}

View File

@ -13,7 +13,4 @@ public class ShaderLinkException : Exception
public ShaderLinkException() : base("Error occured while trying to link a shader.") { }
public ShaderLinkException(string message) : base(message) { }
public ShaderLinkException(string message, Exception inner) : base(message, inner) { }
protected ShaderLinkException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
}