Hi, I’m learning OpenGL 3.3.0 right now, and I’d like to know if the way I understand VBOs so far is correct. I haven’t read anything about VAOs yet, so this is just me trying to comprehend what VBOs do when I use certain functions in the code.
After declaring 3 vertices that form a triangle primitive using a float array, that vertex data sits there in code, OpenGL isn’t ‘aware’ of it. In order to make OpenGL ‘aware’ of it, I need to send that vertex data to the Vertex Shader. How do I send this information? Through a VBO. So, basically, a VBO is a memory on the GPU that stores my vertex data (my triangle). So, if I were to break it down, it would be something like this:
GLuint VBO; // I declare my VBO glGenBuffers(1, &VBO); // I create an ID for my VBO, that ID will be GL_ARRAY_BUFFER glBindBuffer(GL_ARRAY_BUFFER, VBO); // I bind the ID to the VBO glBufferData(GL_ARRAY_BUFFER, sizeof(triangle), triangle, GL_STATIC_DRAW); // let's ignore GL_STATIC_DRAW here, I know what that does. So basically, here I'm saying: // that vertex data (triangle vertices) that I've declared, I'm going to store it in the VBOs ID, then I'll // specify the size of that vertex data, and then I'll specify the vertex data itself.
So basically, a VBO collects all the vertex data information, stores it within, and sends it to the Vertex Shader (which is a bunch of code), which is the 1st step in the Pipeline Rendering process.
VBO > send info to > Vertex Shader or Vertex Shader collects info from VBO which is located in the GPU memory (either way).
This is how I understand things so far. I want to know if the way I understand it, function by function, is correct. Otherwise, I find myself writing functions that I learn by memory but have no idea what they mean.
Do I understand how this works? Or am I confused?