I solved it. The problem was the “tuplasize” that I was using with the setAttributeBuffer instruction.
It was
Objects[i].indexed_vertices.size() * sizeof(vertex)
Now I changed it to 3 and started passing normals as vertices too, the result code is:
void GLWidget::paintGL()
{
glClearColor(0.4765625, 0.54296875, 0.6171875, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/*
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -10.0f);
*/
editor->setUniformValue("projectMatrix", controller->getProjectionMatrix());
editor->setUniformValue("viewMatrix", controller->getViewMatrix());
/** Ahora para las operaciones especificas de cada objeto **/
for (int i=0; i<Objects.size(); i++)
{
Objects[i].modelmatrix.scale(1.0, 1.0, 1.0);
Objects[i].modelmatrix.rotate(1.0, 0.0, 0.0, 1.0);
editor->setUniformValue("modelMatrix", Objects.at(i).modelmatrix);
glEnableClientState(GL_VERTEX_ARRAY);
editor->enableAttributeArray("vertices");
Objects[i].vertexbuffer->bind();
//glVertexPointer(3, GL_FLOAT, 0, Objects.at(i).indexed_vertices.data());
editor->setAttributeBuffer("vertices", GL_FLOAT, 0, 3); // (PROGRAM_VERTEX_ATTRIBUTE, Objects[i].vertices.data());
//glDisableClientState(GL_VERTEX_ARRAY);
//glEnableClientState(GL_NORMAL_ARRAY);
editor->enableAttributeArray("normals");
Objects[i].normalbuffer->bind();
//glVertexPointer(3, GL_FLOAT, 3, Objects.at(i).indexed_normals.data());
editor->setAttributeBuffer ("normals", GL_FLOAT, 0, 3);
glDisableClientState(GL_VERTEX_ARRAY);
//glDrawArrays(GL_QUADS, 0, Objects[i].vertices.size());
Objects[i].elementbuffer->bind();
glDrawElements(GL_QUADS, Objects[i].indices.size(), GL_UNSIGNED_SHORT, (void*)0);
}
}
This can be marked as Solved.