resetius / graphtoys

Cross-platform simple 3d engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support indexed draw

resetius opened this issue · comments

Subj

std::vector<unsigned int> indices;

// fill "indices" as needed

// Generate a buffer for the indices
 GLuint elementbuffer;
 glGenBuffers(1, &elementbuffer);
 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);
 glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);