12
\$\begingroup\$

This is mostly a documentation question. I hope this is the proper place to ask and not, for example, programmers or stackoverflow.

I did not read the OpenGL specification, but from books (Red Book) and various tutorial, I cannot properly grasp how different objects and parts of the API interact and relate.

For example, I know that if a VAO is bound, then binding a VBO and setting an attribute will result in the VBO being bound to the VAO.

But there are many objects, their relation may vary. For example, the VAO is completely unrelated to the current shading program, but the outcome of drawing operations may depend on both of them.

Among all the various OpenGL components, I can see some relations like A-binds-to-B or A-and-B-are-used-by-C. All these relations concur in determining how one can alter the state of the context, how can change things, how can save things together and optimize.

I am looking for resources explaining just these relations. Like an UML diagram, a graph, or even a text document, which does not focus about the calls, but describes in a compact way how the various OpenGL components interact and relate one to each other.

Do you know where to find such a resource?

\$\endgroup\$
7
  • 3
    \$\begingroup\$ Great question. I've got my whole OpenGL library/engine up and running without a super clear answer to that key question. \$\endgroup\$ Commented Oct 25, 2015 at 21:49
  • 1
    \$\begingroup\$ Binding a VBO does not bind it to a VAO. This is instead achieved with glVertexAttribPointer(). The diagram for OpenGL objects would be fairly shallow and simple, there aren't actually more than a handful of different objects in OpenGL. VAOs use buffers for attributes. Buffer textures are backed by buffers. Framebuffers have texture attachments. Drawing commands use the current VAO, current program, current framebuffer, current sampler settings, and current index buffer / indirect buffer. You could probably draw the diagram yourself. \$\endgroup\$ Commented Oct 25, 2015 at 22:14
  • 1
    \$\begingroup\$ Sorry, I'm not going to draw a picture for you. \$\endgroup\$ Commented Oct 25, 2015 at 23:14
  • 2
    \$\begingroup\$ Good question, and from where I stand, good luck getting a comprehensive answer without placing a considerable bounty on it. \$\endgroup\$
    – Engineer
    Commented Oct 26, 2015 at 19:57
  • 2
    \$\begingroup\$ The design of OpenGL is a great argument on why you shouldn't use global variables ;) (the whole API is one huge mess of global data) \$\endgroup\$
    – glampert
    Commented Oct 27, 2015 at 2:23

1 Answer 1

7
\$\begingroup\$

So, I tried painting my own diagram. It's not comprehensive, mostly because I am not interesting in some things right now, but also because I wanted it to be readable (even if it's not a formally specified graph, I think it should be easily readable).

Also, since seems to be of interest to some people, I want to share it here to get feedback and have it checked. I used the OpenGL wiki as a reference to check the correctness, but I may have introduced mistakes.

Also, if the information provided is not enough for you, or I left out important relations which are worthy to be included in the diagram, feel free to suggest it, and I will try to keep it updated.

OpenGL binding-relation diagram

Again, feel free to report errors, issues or suggestions, they're warmly welcomed.

EDIT

  1. Relation between drawing and attributes was missing: attributes must be enabled to be effective when rendering
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .