News for hackers. Stuff that matters.
Re:Mechanical Watch by kragen on Wednesday May 04, 2022 @07:51PM (#31267466)
Though boilerplate is never acceptable, most of that is constant-factor overhead, not per-triangle overhead, and tutorialspoint is not a site you should trust under any circumstances. See my links above for better sources.

If you put more vertices and indices in Step 2 you can draw an arbitrarily complex 3-D object with this same code.

And there's a lot of stuff in GLSL where you can program directly with high-level concepts like vectors, normals, and partial derivatives, instead of expressing them by hand the way you would in C.

Re:Mechanical Watch by woojoo666 on Wednesday May 04, 2022 @07:58PM (#31267533)
Using a framework is also constant factor overhead (at least in LoC, which is what I assume we're talking about here)
Re:Mechanical Watch by kragen on Wednesday May 04, 2022 @08:19PM (#31267718)
Right, and that's what the glslCanvas project I linked above is, though in this case it's negative overhead if you're just counting the lines of code you have to maintain :)
Re:Mechanical Watch by woojoo666 on Wednesday May 04, 2022 @09:14PM (#31268165)
Ah gotcha. Yeah I was alluding to ThreeJS, a very powerful and standard framework for webgl
Re:Mechanical Watch by kragen on Wednesday May 04, 2022 @09:28PM (#31268261)
Yeah, ThreeJS is awesome! glslCanvas is just for drawing with shaders, not for general 3-D.