-#define BUFFER_OFFSET(i) ((char *)NULL + (i))
-
-GLuint setupBuffers(glm::vec3* vertices, glm::vec3* normals, GLuint progId) {
-
- GLfloat colors[] = {
- 0, 1, 0, 1,
- 1, 0, 0, 1,
- 0, 0, 1, 1,
-
- 0, 1, 0, 1,
- 1, 0, 0, 1,
- 0, 0, 1, 1,
-
- 0, 1, 0, 1,
- 1, 0, 0, 1,
- 0, 0, 1, 1,
-
- 0, 1, 0, 1,
- 1, 0, 0, 1,
- 0, 0, 1, 1,
-
- 0, 1, 0, 1,
- 1, 0, 0, 1,
- 0, 0, 1, 1,
-
- 0, 1, 0, 1,
- 1, 0, 0, 1,
- 0, 0, 1, 1
- };
-
- GLuint numVerts = 18;
-
- GLuint vbo;
- glGenBuffers(1, &vbo);
-
- GLuint vao;
- glGenVertexArrays(1, &vao);
-
- GLuint posId = glGetAttribLocation(progId, "vPosition");
- GLuint colorId = glGetAttribLocation(progId, "vColor");
- GLuint normalLoc = glGetAttribLocation(progId, "vNormal");
-
- GLuint vertsLen = numVerts * 3 * sizeof(GLfloat);
- GLuint colorsLen = numVerts * 4 * sizeof(GLfloat);
- GLuint normalLen = numVerts * 3 * sizeof(GLfloat);
-
- glBindBuffer(GL_ARRAY_BUFFER, vbo);
- glBufferData(GL_ARRAY_BUFFER, vertsLen + colorsLen + normalLen, NULL, GL_STATIC_DRAW);
-
- glBufferSubData(GL_ARRAY_BUFFER, 0, vertsLen, glm::value_ptr(vertices[0]));
- glBufferSubData(GL_ARRAY_BUFFER, vertsLen, colorsLen, colors);
- glBufferSubData(GL_ARRAY_BUFFER, vertsLen + colorsLen, normalLen, glm::value_ptr(normals[0]));
-
- glBindVertexArray(vao);
-
- glEnableVertexAttribArray(posId);
- glVertexAttribPointer(posId, 3, GL_FLOAT, GL_FALSE, 0, 0);