OK, so I made a library that handles basic OpenGL rendering. It contains three buffers, one for vertices, uv's and normals. In the main render function is where I bind the buffers, enable vertex attributes, and then call glDrawArrays(). But I ran into an unexpected issue that is more engineering based then code based which is that I can only bind one texture at a time. So all the vertices will have the same textures when I draw them, How can I get around this? If you need any more source I will post it.
Main Render Function
glEnableVertexAttribArray(0);
glBindBuffer(GL_ARRAY_BUFFER,this->_VBO);
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER,this->_TBO);
glEnableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER,this->_NBO);
glDrawArrays(GL_TRIANGLES,0,this->polyCount);
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
Buffers:
//Designated Vertex Buffer
std::array<GLfloat,BUFFER_SIZE> BUFFER_1;
UINT bufferIndex1;
//Designated Normal Buffers
std::array<GLfloat,BUFFER_SIZE> BUFFER_2;
UINT bufferIndex2;
//Designated UV Buffer
std::array<GLfloat,BUFFER_SIZE> BUFFER_3;
UINT bufferIndex3;
GL_MAX_TEXTURE_UNITStextures at once. However, yes - state cannot be changed within one draw call (and that's the whole idea of what 'batch' is). Either take e.g. vertex color (or any other attribute) as texture index and take one texture out of many based on it (could be slow, depending on actual data) or split it into separate draw calls. - keltar