   creating vbo data from obj files
  Hi all,lately I've been struggling with putting the loaded obj data into a vbo and I did succeed.I wanted to try out the obj loader with a fairly large obj model (1.5Million polys), and it loaded it in 45s, which is quite good because Blender loaded it in approximately the same amount of time, however when I tried to put the vertex data into a vbo, for which I needed to convert the attributes:I store my vertex data in a mesh object which contains:std::vector< std::vector<float> > vertices;std::vector< std::vector<float> > normals;std::vector< std::vector<unsigned int> > faces;that is n number of vertices with 3 components, m number of normals with 3 components, and o number of faces with 9 components (3 components per each poly --> (vertex, texture, normal) indices), just like it was arranged in the obj file.in immediate mode I'd render this data like this:void render::draw_meshes(const mesh& the_mesh){glBegin(GL_TRIANGLES);for (int c = 0; c < the_mesh.faces.size(); c++) //for each face render the 3 polys, for each poly render each attribute{    glNormal3f(the_mesh.normals[the_mesh.faces[c][2] - 1][0],  the_mesh.normals[the_mesh.faces[c][2] - 1][1],  the_mesh.normals[the_mesh.faces[c][2] - 1][2]);    glVertex3f(the_mesh.vertices[the_mesh.faces[c][0] - 1][0],  the_mesh.vertices[the_mesh.faces[c][0] - 1][1],  the_mesh.vertices[the_mesh.faces[c][0] - 1][2]);    glNormal3f(the_mesh.normals[the_mesh.faces[c][5] - 1][0],  the_mesh.normals[the_mesh.faces[c][5] - 1][1],  the_mesh.normals[the_mesh.faces[c][5] - 1][2]);    glVertex3f(the_mesh.vertices[the_mesh.faces[c][3] - 1][0],  the_mesh.vertices[the_mesh.faces[c][3] - 1][1],  the_mesh.vertices[the_mesh.faces[c][3] - 1][2]);    glNormal3f(the_mesh.normals[the_mesh.faces[c][8] - 1][0],  the_mesh.normals[the_mesh.faces[c][8] - 1][1],  the_mesh.normals[the_mesh.faces[c][8] - 1][2]);    glVertex3f(the_mesh.vertices[the_mesh.faces[c][6] - 1][0],  the_mesh.vertices[the_mesh.faces[c][6] - 1][1],  the_mesh.vertices[the_mesh.faces[c][6] - 1][2]);}glEnd();}and this would be just nice, but the performance would be waaaaaaaaay too low.So I convert my data like this:void render::fill_vbos(mesh& the_mesh){typedef GLfloat float_3[3]; //the 3 componentsfloat_3 * tmp_vertices; //3 temporary arrays for datafloat_3 * tmp_normals;GLuint * tmp_faces;float_3 verts[3]; //three attributes for each poly in a facefloat_3 norms[3];//here we actually dont do it the efficient way like it is done in the obj files (where we have like 700k vertices the same amount of normals and 1500k polys), but we have to convert it so that opengl understands our datatmp_vertices = new float_3[the_mesh.faces.size() * 3]; //allocate some space for the data (number of faces * 3 = number of vertices)tmp_normals = new float_3[the_mesh.faces.size() * 3];tmp_faces = new uint[the_mesh.faces.size() * 3]; //allocate some space for the data (number of faces * 3 = numver of vertices all together to be drawn)the_mesh.numverts = 0;the_mesh.numindexes = 0;for (int c = 0; c < the_mesh.faces.size(); c++) //for each face...{    verts[0][0] = the_mesh.vertices[the_mesh.faces[c][0] - 1][0]; //...lets store (temporarily) the 3 polys the face contains    verts[0][1] = the_mesh.vertices[the_mesh.faces[c][0] - 1][1];    verts[0][2] = the_mesh.vertices[the_mesh.faces[c][0] - 1][2];    verts[1][0] = the_mesh.vertices[the_mesh.faces[c][3] - 1][0];    verts[1][1] = the_mesh.vertices[the_mesh.faces[c][3] - 1][1];    verts[1][2] = the_mesh.vertices[the_mesh.faces[c][3] - 1][2];    verts[2][0] = the_mesh.vertices[the_mesh.faces[c][6] - 1][0];    verts[2][1] = the_mesh.vertices[the_mesh.faces[c][6] - 1][1];    verts[2][2] = the_mesh.vertices[the_mesh.faces[c][6] - 1][2];    norms[0][0] = the_mesh.normals[the_mesh.faces[c][2] - 1][0];    norms[0][1] = the_mesh.normals[the_mesh.faces[c][2] - 1][1];    norms[0][2] = the_mesh.normals[the_mesh.faces[c][2] - 1][2];    norms[1][0] = the_mesh.normals[the_mesh.faces[c][5] - 1][0];    norms[1][1] = the_mesh.normals[the_mesh.faces[c][5] - 1][1];    norms[1][2] = the_mesh.normals[the_mesh.faces[c][5] - 1][2];    norms[2][0] = the_mesh.normals[the_mesh.faces[c][8] - 1][0];    norms[2][1] = the_mesh.normals[the_mesh.faces[c][8] - 1][1];    norms[2][2] = the_mesh.normals[the_mesh.faces[c][8] - 1][2];    for (int c3 = 0; c3 < 3; c3++) //for each 3 polys...    {   int c4;   for (c4 = 0; c4 < the_mesh.numverts; c4++) //...search through the vertices we stored in the new array so far, and if we find a match then only store its index   {  if (tmp_vertices[c4][0] == verts[c3][0] andtmp_vertices[c4][1] == verts[c3][1] andtmp_vertices[c4][2] == verts[c3][2] andtmp_normals[c4][0] == norms[c3][0] andtmp_normals[c4][1] == norms[c3][1] andtmp_normals[c4][2] == norms[c3][2])  { tmp_faces[the_mesh.numindexes] = c4; the_mesh.numindexes++; break;  }   }   if (c4 == the_mesh.numverts)   {  tmp_vertices[the_mesh.numverts][0] = verts[c3][0];  tmp_vertices[the_mesh.numverts][1] = verts[c3][1];  tmp_vertices[the_mesh.numverts][2] = verts[c3][2];  tmp_normals[the_mesh.numverts][0] = norms[c3][0];  tmp_normals[the_mesh.numverts][1] = norms[c3][1];  tmp_normals[the_mesh.numverts][2] = norms[c3][2];  tmp_faces[the_mesh.numindexes] = the_mesh.numverts;  the_mesh.numindexes++;  the_mesh.numverts++;   }    }}glGenBuffers(4, the_mesh.vbos); //copy our data into the vbos// Copy data to video memory// Vertex dataglBindBuffer(GL_ARRAY_BUFFER, the_mesh.vbos[the_mesh.VERTEX_VBO]);glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*the_mesh.numverts*3, tmp_vertices, GL_STATIC_DRAW);// Normal dataglBindBuffer(GL_ARRAY_BUFFER, the_mesh.vbos[the_mesh.NORMAL_VBO]);glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*the_mesh.numverts*3, tmp_normals, GL_STATIC_DRAW);// Texture coordinates//glBindBuffer(GL_ARRAY_BUFFER, the_mesh.vbos[the_mesh.TEXTURE_VBO]);//glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*the_mesh.numverts*2, tmp_texcoords, GL_STATIC_DRAW);// IndexesglBindBuffer(GL_ELEMENT_ARRAY_BUFFER, the_mesh.vbos[the_mesh.FACE_VBO]);glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)*the_mesh.numindexes, tmp_faces, GL_STATIC_DRAW);delete [] tmp_vertices; //delete the temporary datadelete [] tmp_normals;delete [] tmp_faces;tmp_vertices = NULL;tmp_normals = NULL;tmp_faces = NULL;}(this is actually from opengl superbible)this conversion makes opengl understand my data, however the loading time triples or worse, sometimes (for great amount of data) it doesn't even load. (that might be because it cant allocate enough space? dont know but my processor still runs at 100%)so my question is: is there a way to reduce this conversion time, or even better somehow make opengl draw my data properly according to index data (that is without converting anything)?Best regards, Yours3!f   