Рисую skybox, потом модель:
glVertexPointer(3, GL_FLOAT, 0, part->v.begin());
glTexCoordPointer(2, GL_FLOAT, 0, part->vt.begin());
glNormalPointer(GL_FLOAT,0, part->vn.begin());
foreach (Part::FaceGroup faceGroup, part->faceGroup) {
Surface *surface = faceGroup.surface;
if(!surface) {qWarning()<<faceGroup.name; break;}
GLfloat color[4];
Surface::fillGLfloat(surface->ambient, &color[0]);
glMaterialfv(GL_FRONT, GL_AMBIENT, &color[0]);
Surface::fillGLfloat(surface->diffuse, &color[0]);
glMaterialfv(GL_FRONT, GL_DIFFUSE, &color[0]);
if(!surface->textureNameAmbient.isEmpty()) {
glBindTexture(GL_TEXTURE_2D, textureIds[surface->textureNameAmbient]);
glEnable(GL_TEXTURE_2D);
} else if(!surface->textureNameDiffuse.isEmpty()) {
glBindTexture(GL_TEXTURE_2D, textureIds[surface->textureNameDiffuse]);
glEnable(GL_TEXTURE_2D);
} else
glDisable(GL_TEXTURE_2D);
glDrawElements(GL_TRIANGLES, faceGroup.f.size(), GL_UNSIGNED_INT, (GLint*)&faceGroup.f[0]);
}
Если в initilizeGL разкоментировать строчку, экран становиться черный
vbo.create();
// vbo.bind(); vbo.allocate(vertData.constData(), vertData.count() * sizeof(GLfloat));