Hey everyone,
Recently I have been following some OpenGL tutorials that use freeglut and glew on windows and I’ve managed to get them all working and understand the basic steps you need to do to get a mesh onto the screen. However I am a little bit in the dark when it comes to getting multiple meshes on the screen. At this point in time I have not tried it yet, since I felt like asking someone who has done it before will prevent me from making the ‘newb’ mistakes someone else maybe ran into a bit further down the road when he/she started using OpenGL.
The current steps I follow for a single mesh are (not showing all parameters for every function) :
GLuint vao;
GLuint vbo;
GLuint indexBufferID;
GLuint textureBufferID;
GLuint textureCoordID;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(1, &vbo);
glBindBuffers(GL_ARRAY_BUFFER, vbo);
glBufferData(...);
glBufferSubData(..., vertices);
glBufferSubData(..., normals);
glBufferSubData(..., uvs);
glGenBuffers(1, &indexBufferID);
glBindBuffer(GL_ELEMENT_ARRAY, indexBufferID);
glBufferData(..., indices, ...);
// Texture stuff...
I left out the texturing stuff, since I feel when I know the other steps I should be able to work with textures as well. However advise is always appreciated! So my question is: What is the best way to render multiple meshes and what trade-offs are there to keep in mind?
Kind regards,
Dijego