Shader.cs - Added IDisposable interface

This commit is contained in:
miku-666
2023-11-01 10:18:48 +01:00
parent a9eec9a3ee
commit df9bd4cd24

View File

@@ -10,7 +10,7 @@ using OpenTK.Graphics.OpenGL;
namespace PckStudio.Rendering
{
internal class Shader
internal class Shader : IDisposable
{
private int _programId;
private Dictionary<string, int> locationCache = new Dictionary<string, int>();
@@ -31,6 +31,12 @@ namespace PckStudio.Rendering
GL.UseProgram(0);
}
public void Dispose()
{
Unbind();
GL.DeleteProgram(_programId);
}
public void SetUniform1(string name, int value)
{
int location = GetUniformLocation(name);