Cycle of broken code while learning GL

It seems the problem with learning OpenGL is that there many code samples that only work in very limited situations and which are uncommented and poorly explained.
Therefore when a person is trying to adapt some uncommented and mysterious sample code to their project, they find it doesn’t work even though the author claims it certainly will.
So then they try another piece of uncommented/mysterious sample code, which doesn’t work for the same reason or doesn’t work because it was added on top of the previous adaptation.
As a result the learner goes from broken code to broken code, adding some small modification that looks legit but which further breaks the code, rinse and repeat.
At some point they no longer recognize their code because there are artifacts from many samples, none of which helped the code work.
Maybe in the end the code magically works, but the samples were uncommented and poorly explained so there is a mystery as to why but the learner is wary of changing it, lest it break for no clear reason.

There’s nothing that can be done about that. Anybody can make sample code for OpenGL and there’s nothing anybody can do to force them to write it correctly.

Are there any example 3D OpenGL programs out there that are commented line by line?
So far I haven’t found anything.

Almost certainly not, nor should there be.

Line-by-line commenting doesn’t make sense. Low-ish-level graphics programming is not something beginning programmers need to engage with. It’s a task for someone who has a solid grasp of the fundamentals of programming.

In any example of decent size, there are going to be plenty of lines of code that are just shuffling values around.

Also, comments just cannot be significant enough to teach you anything meaningful without utterly dwarfing the size of the code they’re commenting. A simple function like glDrawElements(...) could be commented with “do an indexed draw”, but that means nothing. What is a “draw”? What is an “indexed draw” compared to a non-“indexed” one? What are you drawing with? Where is the data for that draw coming from?

The difficult part of graphics programming is understanding the concepts, not the line-by-line code.

I’ve got a very good grasp of programming. What I don’t know about is the arcane rules of OpenGL.
Line by line comments are very useful because they help explain the concealed information and secrets that it seems you don’t want to provide. You’re not more important than other programmers just because you know some secret information.

How many “arcane secrets” do you think are behind the line glUseProgram(prog_id);? Do you think that a comment could adequately explain all of them without being multiple paragraphs long?

My point is that if someone did that, the “source code” would consist of paragraph after paragraph of documentation (incomplete documentation at that), followed by a single line of code. That makes it incredibly difficult to follow code.

I’m not trying to hide information; I’m talking about what counts as an effective way to present it. And what you’re talking about simply is not effective.