4 ms·
I do recommend writing some DSA-like helpers for OpenGL, its global state is annoying to wrangle and not that meaningful to the actual GPU. The tricky part of O
by Jasper_ 6y ago
I do recommend writing some DSA-like helpers for OpenGL, its global state is annoying to wrangle and not that meaningful to the actual GPU. The tricky part of OpenGL is understanding when something is a bad API accident and when something is actually meaningful.
Texture bindings are a good example of something that came about mostly by accident, as they didn't want to break legacy code. So we went from "the texture" to "the current texture", and then had to introduce "the active texture" once multi sampling entered the picture.
- Twisol 6y agoCould you expand on what you mean by "DSA-like helpers"?
- akdas 6y ago100% agreed that I'll be writing abstractions as the program grows. But without understanding the underlying APIs, I don't know which abstractions to write. As another commenter asked: what does "DSA-like helpers" mean in this case?
- Jasper_ 6y agoDSA is Direct State Access, it's an OpenGL extension to remove some (not all!) of the more annoying binding state. https://www.khronos.org/opengl/wiki/Direct_State_Access https://www.khronos.org/opengl/wiki/Direct_State_Access
- Twisol 6y agoAh, so for "DSA-like helpers" you're suggesting additional helpers that will take care of binding the given object, making manipulations, and unbinding it?
- Jasper_ 6y agoYep. Though it's a lot trickier than just bind/unbind, e.g. if you have a VAO bound, you need to unbind the VAO before binding a vertex buffer, or else you might have overwritten the VAO's vertex buffer binding slot. And I've encountered many, many similar cases like that and edge cases, especially around framebuffer management. The OpenGL programming model is unfortunate.