Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- delete [] pVerts; // Obj is loaded now, we don't need these anymore
- delete [] pTexts;
- delete [] pNorms;
- /*
- struct vert_t{ double x; double y; double z;};
- struct norm_t{ double x; double y; double z;};
- struct text_t{ double u; double v; double w;};
- struct colr_t{ double r; double g; double b;};
- struct vertex_t{ vert_t vert; norm_t norm; text_t text; }; // this is the openglpassed one
- */
- glGenBuffers(1, &eid);
- glBindBuffer(GL_ARRAY_BUFFER, eid);
- glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_t) * faces * 3, pVertexes, GL_STATIC_DRAW); // Copy data to the GPU
- unsigned short* pIndices = new unsigned short[faces * 3];
- for(unsigned int i = 0; i < faces * 3; i++)
- pIndices[i] = i;
- glGenBuffers(1, &aid);
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, aid);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short) * faces * 3, pIndices, GL_STATIC_DRAW);
- delete [] pIndices;
- delete [] pVertexes;
- FacesLoaded = faces;
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement