Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- glBindBuffer(GL_ARRAY_BUFFER, VBO);
- glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(GLfloat), &vertices[0], GL_STATIC_DRAW);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO); // EBO is similar to VBO in a way that it also allows to pass user defined values for the vertices but we have to specify
- // an array of indices in order to draw different
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLint), &indices[0], GL_STATIC_DRAW);
- // position coordinate attribute
- glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0); // 6 * sizeof(GLfloat) if we are including colors and texture coords besides our vertex position coordinates //
- glEnableVertexAttribArray(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement