Hello, I’m back to learning collada, and having problems with infamous duck(at least for me).
Duck model can be found here(model bank):
http://www.collada.org/owl/view.php?ses … le_details
What I do is get the vertices array, collect vertex indices from
, shove it in as vertex array and display as GL_LINES, like this
/* sort of load method */
...
domListOfFloats * position_floats = & source->getFloat_array()->getValue();
// pvertices is an instance variable
pvertices = new GLfloat[position_floats->getCount()];
for (unsigned int i=0; i< position_floats->getCount(); i++) {
pvertices[i] = (GLfloat)(*position_floats)[i];
}
and in other method
glVertexPointer(3, GL_FLOAT, 0, [self vertices]);
glEnableClientState(GL_VERTEX_ARRAY);
/* n_vertex_indices are vertex only indices from
, vertex indices have offset 2, so every third is stored in special array */
glDrawElements(GL_LINES, n_vertex_indices, GL_UNSIGNED_SHORT, vertex_indices);
glDisableClientState(GL_VERTEX_ARRAY);
Duck looks like a duck, but there is something wrong, please look at it
http://picasaweb.google.com/ikkipittyy/ … 3680320114
Pretty much all line are crooked and some cross or extend outside the duck…
I’m pretty sure I do something wrong with glDrawElements, I’m quite skeptical I can just draw the duck in on function call. I mean how does it know how to connect lines and such.
Please could someone clarify this for me,
Kind regards