Skip to content

InvalidOperation in OpenGL Tutorials/Tutorial 1.3 - Textures #1968

@bamfbamf

Description

@bamfbamf

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
  1. Open OpenGL Tutorials/Tutorial 1.3 - Textures example.
  2. 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;
}
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions