1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
float points[] = {
-50, -50.f, 0.0f,
50.f, -50.f, 0.0f,
0.f, 50.f, 0.0f
};
glGenBuffers(1, &m_vertexVBO);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexVBO);
glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(float), points, GL_STATIC_DRAW);
/*---SNIP---*/
glGenVertexArrays(1, &m_vao);
glBindVertexArray(m_vao);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexVBO);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
/*---SNIP---*/
glBindVertexArray(m_vao);
glDrawArrays(GL_TRIANGLES, 0, 3);
|