OpenGL 4.5 Unform buffer use example

I am writing an interface library to OpenGL from Fortran, I would like to add uniform buffer support but I also want to use the latest OpenGL use model for uniform buffers to keep it simple and not have to deal with legacy UBO stuff.

There are a lot of older examples and I don’t want to have to deal with a lot of the legacy binding stuff.

Do you have any links or code snippets I can use for a minimal OpenGL 4.3+ implementation?

Thanks ahead of time.

There isn’t really any “legacy UBO stuff”. UBOs haven’t gone anywhere and haven’t really changed in any way.

The only things you might consider legacy are issues surrounding UBOs. There’s the fact that a UBO binding index can be specified in the shader, but that merely means you don’t need to set it in the code. That’s hardly something that is the responsibility of an “interface library”. And the use of direct state access APIs from GL 4.5 affect all buffer objects, not just UBOs.

I think I will just simplify it to using the binding index in the shader and simplify the interface. It looks like I can minimize it down to simple bind / bindBufferRange / bufferData into a single call then and call bufferData on updates.

I haven’t looked at direct state access yet, I just want to get to a simple spinning textured cube that can used as a baseline template.