I am learning OpenGL via the Superbible and internet, and a concept that I always see causing trouble is the glBindxxx (See for instance the accepted answer of Concept behind OpenGL's 'Bind' functions for a typical problem related to bindings.)
You can/have to bind buffers (glBindBuffer) before setting them to be used by glVertexAttribPointer. You can/have to bind the VAO (glBindVertexArray) before setting your glVerteyAttribPointer, and so on, with a never ending chain of current binding dependencies.
Sometimes, even if you forget binding something your program might still work if its simple enough, but I have seen lots of people taking too much time to find that the source of their bug is some hidden binding that they were not aware of.
Is there a command in OpenGL to list the last binding? Something similar to glGetAllBindings, and this would return the last bound ID of each glBindxxx functions (a small list of them is below based on Superbible 6th edition)
glBindBuffer glBindBufferBase glBindFrameBuffer glBindImageTexture glBindProgramPipeline glBindSampler glBindTexture glBindTransformFeedback glBindVertexArray glBindVertexBuffer
For instance, if I performed a glBindBuffer with buffer ID 1 as parameter and then again with buffer ID 2, glBindVertexArray with ID 3 and then glBindVertexArray with ID 5, the function would return 2 for glBindBuffer and 5 for glBindVertexArray.
With that, I can always know in which context I am before applying new settings.
I believe this would greatly help anyone needing to understand and debug binding problems.