Created
December 30, 2012 01:52
-
-
Save agrif/4410502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* create and populate a VBO and VAO */ | |
| glGenBuffers(1, &vbo); | |
| glGenVertexArrays(1, &vao); | |
| glBindVertexArray(vao); | |
| glBindBuffer(GL_ARRAY_BUFFER, vbo); | |
| glBufferData(GL_ARRAY_BUFFER, sizeof(OILVertex) * vertices_length, vertices, GL_STATIC_DRAW); | |
| glVertexPointer(3, GL_FLOAT, sizeof(OILVertex), (void *)offsetof(OILVertex, x)); | |
| glTexCoordPointer(2, GL_FLOAT, sizeof(OILVertex), (void *)offsetof(OILVertex, s)); | |
| glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(OILVertex), (void *)offsetof(OILVertex, color)); | |
| /* draw */ | |
| glDrawElements(GL_TRIANGLES, indices_length, GL_UNSIGNED_INT, indices); | |
| /* free our VBO and VAO */ | |
| glDeleteVertexArrays(1, &vao); | |
| glDeleteBuffers(1, &vbo); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment