Summary
I'm porting C++ code to Silk and found that my custom Shader class, when I do Shader.Use(), was reporting InvalidOperation error.
After debugging original code of the lesson I found that the error starts after _gl.Uniform1(location, 0); is set for texture, way before _gl.UseProgram(_program); is executed.
Original code doesn't check for error, so that's why it works.
Steps to reproduce
- Platform: Desktop Windows 10 v.22H2
- Framework Version: .NET 8
- API: OpenGL
- API Version: OpenGL 4.5+ Core
- Open
OpenGL Tutorials/Tutorial 1.3 - Textures example.
- Add this code before
_gl.Uniform1(location, 0); which is currently at line 275:
var errCode = _gl.GetError();
if (errCode != GLEnum.NoError)
{
Console.WriteLine($"Before Uniform1(): {errCode}");
_window.IsClosing = true;
return;
}
- Add this code after
_gl.Uniform1(location, 0); which is currently at line 275:
errCode = _gl.GetError();
if (errCode != GLEnum.NoError)
{
Console.WriteLine($"After Uniform1(): {errCode}");
_window.IsClosing = true;
return;
}
Comments
I'm not sure what causes the problem.
Summary
I'm porting C++ code to Silk and found that my custom Shader class, when I do Shader.Use(), was reporting
InvalidOperationerror.After debugging original code of the lesson I found that the error starts after
_gl.Uniform1(location, 0);is set for texture, way before_gl.UseProgram(_program);is executed.Original code doesn't check for error, so that's why it works.
Steps to reproduce
OpenGL Tutorials/Tutorial 1.3 - Texturesexample._gl.Uniform1(location, 0);which is currently at line 275:_gl.Uniform1(location, 0);which is currently at line 275:Comments
I'm not sure what causes the problem.