4 ms·
I think you can find a good enough mapping. But the core confusions are still there, you have to build a manual list of things to ignore: 1. Never use old-scho
by Jasper_ 5y ago
I think you can find a good enough mapping. But the core confusions are still there, you have to build a manual list of things to ignore:
1. Never use old-school glUniforms (use UBOs)
2. Never use the old glTexImage functions (use glTexStorage)
3. Always use the new DSA stuff (don't bother with the old binding stuff, except when they forgot to make DSA replacements)
4. Don't bother using render buffers, just use textures.
5. Make sure to use the new, new, new vertex buffer system (or just move your vertex fetching to pulling), VAOs are unfortunate
6. Still too easy to accidentally stall the mainloop with accidental stalls (e.g. never call glReadPixels unless you have a PBO bound)
You still have an unfortunate thing in the case of the default FBO, which gives you a depth buffer on your scanout you probably don't want. Maybe there's a way configure out of that, I forget if e.g. eglChooseConfig lets you opt out of the depth buffer, but I don't believe it's possible on wgl/glx.
There's others I can think of but you just have to be extra careful and the number of concepts still obscures how a GPU works. Maybe I'll write more about this at some point.
- robertwinkler 5y agoI suspected you'd say something like this. I'm going to respond to each and then my overall response. I think I used UBOs once, just to try them from a textbook example. They seemed like a pain for no gain for my use case. I've never even heard of glTexStorage. Looking into it, it didn't come out till 4.2 (and glTextureStorage 4.5). Reading about it, I can't see the point if you never load anything other than level 0. DSA stuff likewise didn't come out till 4.5. I've rarely rendered to anything other than the default FBO but I can get behind just using textures when I need to rather than RBOs (I think that's what I did anyway). Never understood why they existed. I don't know what the "new, new, new vertex buffer system" is but I assume it's not available until 4.5+ I'm not sure I've ever called glReadPixels. Maybe once a long time ago? I'm not sure why you wouldn't want a depth buffer by default for 3D rendering. So clearly what I consider the cutoff for Modern OpenGL is not new enough to match the GPU or maximize performance. I accept that. I think matching the GPU and/or maximizing performance is irrelevant and even detrimental to learning. In addition, targeting OpenGL 4.5 or newer will rule out people with older hardware. My desktop is from 2011 for example and I know plenty of people have even older hardware that still works fine. A newbie graphics developer isn't going to be doing anything that remotely strains the GPU (even an iGPU). They're probably not even going to get to rendering to textures, let alone doing anything other than simple forward rendering. They're not going to be using more than 2 or 3 relatively simple shaders in a program with at most a handful of uniforms and inputs. They're not going to be using the geometry shader, let alone the tessellation shaders. That can come later, if they want to keep going. In an intro course, other than the basics of graphics, they'll probably be covering things tangential to actual graphics that help with functionality, like AABBs, various mesh data structures and their pros and cons, maybe somethings about splines or basic animation, things like that. A year after my intro 3D graphics course (fall 2011 iirc), I took an "independent study" supervised by the same professor that we called "Advanced Shading" that consisted of 3 self directed projects over the semester. They were basic shadow mapping, basic deferred rendering, and a poor attempt at simulating global illumination. I have never done any of those 3 things (or anything more advanced) since then. That should give an idea of where I'm coming from. I think the problem is the confusion between what I consider Modern OpenGL (ie a broadly supported good abstraction level and API for learning), and what people consider Modern Graphics best/common practices. What's good and essential for professional graphics development is not the best place to start for learning the fundamentals. The comments elsewhere in this thread about how modern techniques are practically making triangles irrelevant is a good example. EDIT: clarification