Hi, I solved it. The problem was the “tuplasize” that I was using with the setAttributeBuffer instruction.

It was

Qt Code:
  1. Objects[i].indexed_vertices.size() * sizeof(vertex)
To copy to clipboard, switch view to plain text mode 

Now I changed it to 3 and started passing normals as vertices too, the result code is:

Qt Code:
  1. void GLWidget::paintGL()
  2. {
  3. glClearColor(0.4765625, 0.54296875, 0.6171875, 1.0);
  4. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  5. /*
  6.   glLoadIdentity();
  7.   glTranslatef(0.0f, 0.0f, -10.0f);
  8. */
  9.  
  10. editor->setUniformValue("projectMatrix", controller->getProjectionMatrix());
  11. editor->setUniformValue("viewMatrix", controller->getViewMatrix());
  12.  
  13.  
  14. /** Ahora para las operaciones especificas de cada objeto **/
  15.  
  16. for (int i=0; i<Objects.size(); i++)
  17. {
  18. Objects[i].modelmatrix.scale(1.0, 1.0, 1.0);
  19. Objects[i].modelmatrix.rotate(1.0, 0.0, 0.0, 1.0);
  20. editor->setUniformValue("modelMatrix", Objects.at(i).modelmatrix);
  21.  
  22. glEnableClientState(GL_VERTEX_ARRAY);
  23. editor->enableAttributeArray("vertices");
  24. Objects[i].vertexbuffer->bind();
  25. //glVertexPointer(3, GL_FLOAT, 0, Objects.at(i).indexed_vertices.data());
  26. editor->setAttributeBuffer("vertices", GL_FLOAT, 0, 3); // (PROGRAM_VERTEX_ATTRIBUTE, Objects[i].vertices.data());
  27. //glDisableClientState(GL_VERTEX_ARRAY);
  28.  
  29. //glEnableClientState(GL_NORMAL_ARRAY);
  30. editor->enableAttributeArray("normals");
  31. Objects[i].normalbuffer->bind();
  32. //glVertexPointer(3, GL_FLOAT, 3, Objects.at(i).indexed_normals.data());
  33. editor->setAttributeBuffer ("normals", GL_FLOAT, 0, 3);
  34. glDisableClientState(GL_VERTEX_ARRAY);
  35.  
  36. //glDrawArrays(GL_QUADS, 0, Objects[i].vertices.size());
  37. Objects[i].elementbuffer->bind();
  38. glDrawElements(GL_QUADS, Objects[i].indices.size(), GL_UNSIGNED_SHORT, (void*)0);
  39. }
  40. }
To copy to clipboard, switch view to plain text mode 

Consider this thread as solved