Apartado 4.2 practica 3: Colores con VBO entrelazado

parent 3c699dc8
Showing with 21 additions and 0 deletions
......@@ -208,6 +208,7 @@ namespace PAG {
}
void Renderer::creaModelo() {
/* Código para No Entrelazado
GLfloat vertices[] = {
-0.5, -0.5, 0,
0.5, -0.5, 0,
......@@ -235,6 +236,26 @@ namespace PAG {
glBufferData(GL_ARRAY_BUFFER, sizeof(colores), colores, GL_STATIC_DRAW);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat), nullptr);
glEnableVertexAttribArray(1);
*/
/* Código para Entrelazado */
GLfloat vertices[] = {
-0.5, -0.5, 0, 1, 0, 0,
0.5, -0.5, 0, 0, 1, 0,
0 , 0.5, 0, 0, 0, 1
};
GLuint indices[] = {0, 1, 2};
glGenVertexArrays(1, &idVAO);
glBindVertexArray(idVAO);
glGenBuffers(1, idVBO);
glBindBuffer(GL_ARRAY_BUFFER, idVBO[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6*sizeof(GLfloat), nullptr);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6*sizeof(GLfloat), (void *) sizeof(GLfloat[3]));
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glGenBuffers(1, &idIBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idIBO);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment