Advertisement
RoshHoul

Untitled

Apr 6th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. glBindBuffer(GL_ARRAY_BUFFER, VBO);
  2. glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(GLfloat), &vertices[0], GL_STATIC_DRAW);
  3.  
  4. 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
  5. // an array of indices in order to draw different
  6. glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(GLint), &indices[0], GL_STATIC_DRAW);
  7.  
  8. // position coordinate attribute
  9. 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 //
  10. glEnableVertexAttribArray(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement