Looks like it uses GL_TRIANGLES in indexed mode (probably the most common way by far).
That way, each side of your box has 4 vertices. The two triangles used to render the side use 6 indices to refer to the 4 vertices. So you should have 6*4=24 vertices and 6*6=36 indices. That matches your .dae if I'm not mistaken - the <p> XML element contains your 36 indices, the <float_array> element has 72 floats which is the 24 vertices, 3 float coordinates each (24*3=72). On Thu, Oct 27, 2011 at 5:15 PM, John Davis <[email protected]> wrote: > FWIW, > > I am simply taking the data from the xml file and copying it and then > pasting into an array. > I am not doing a automatic read or anything. One thing which puzzles > me is the number of vertices > in the file. > > For instance, a rectangle has six sides. If you use two triangles to > draw each side > that is 6 sides * 2 triangles per side for a total of 12 triangles. > This agrees with .xml file > which says says there are 12 triangles. > > From the xml file: > <triangles count="12" material="Material2"> > <input offset="0" semantic="VERTEX" source="#ID7" /> > <p>0 1 2 1 0 3 4 5 6 5 4 7 8 9 10 9 8 11 12 13 14 > 13 12 15 16 17 18 17 16 19 20 21 22 21 20 23</p> > > > If you use 3 coordinates for each vertice of a triangle and a triangle > has three vertices, > then you have 3 * 3 *12 = 9*12 = 108 values of x, y, and z. > > However the xml file has 72. From the xml file: > <float_array id="ID8" count="72">22.62976164142344 > 29.52755905511811 0 0 0 0 0 29.52755905511811 0 22.62976164142344 0 0 > 22.62976164142344 0 13.77952755905512 0 0 0 22.62976164142344 0 0 0 0 > 13.77952755905512 0 29.52755905511811 13.77952755905512 0 0 0 0 0 > 13.77952755905512 0 29.52755905511811 0 0 29.52755905511811 > 13.77952755905512 22.62976164142344 29.52755905511811 0 0 > 29.52755905511811 0 22.62976164142344 29.52755905511811 > 13.77952755905512 22.62976164142344 29.52755905511811 0 > 22.62976164142344 0 13.77952755905512 22.62976164142344 0 0 > 22.62976164142344 29.52755905511811 13.77952755905512 > 22.62976164142344 0 13.77952755905512 0 29.52755905511811 > 13.77952755905512 0 0 13.77952755905512 22.62976164142344 > 29.52755905511811 13.77952755905512</float_array> > > So I am thinking it does not draw individual triangles using > GL_TRIANGLES mode. Instead it uses > GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN mode where it is sharing vertices. > I'm not sure though. > > Maybe my math is wrong, but if you share triangles the number of verts > required is verts' as this table shows. > > Triangles Verts Verts' > 1 3 3 > 2 6 4 > 3 9 5 > 4 12 6 > 5 15 7 > 6 18 8 > .... verts' = tri+2 > 12 36 14 > > and 36*3 = 108 values > but 14*3 = 42 values not 72 > > John > > On Thu, Oct 27, 2011 at 10:22 AM, J Handal <[email protected]> wrote: >> >> I think is error is due to an incompatible file extension .dae file, >> AFIK android use .obj files with android(and other extensions??) but >> not Collada files. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > > -- > John F. Davis > > 独树一帜 > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

