I'm Having trouble expanding the geometry from primitives.

Basically, I’m trying to render the mesh from the texturedcube example.
The data points seem to expand out to invalid coordinates, and so I’m wondering if the documentation is correct, or if I’ve somehow misinterpreted it.

Here is the file that I’m using for my example. (I got it from the examples on another part of this forum)
http://home.comcast.net/~abradsn/texturedcube.dae

Here is a picture describing my problem.
http://home.comcast.net/~abradsn/Geometry-From-Textured-Cube.JPG

Thanks,
Brad

You have to read the polygons input semantics in order to see which array you get your information.

This example probably has three semantics values:


<input semantic="VERTEX">
<input semantic="NORMAL">
<input semantic="TEXCOORD">

or something similar. The VERTEX semantic point to a source element that have vertex specific data. This source element have an accessor that tells you what data the vertices contains. This means it can have, and will likely have, POSITION data, but it can also have NORMAL and TEXCOORD data per vertex and not as in the input semantics, per face.
NORMAL and TEXCOORD semantics have sources that points to their respective look-up-arrays.

From your picture it seems you read every index as a x, y and z position. This is wrong.
The first occurrence in the first

elements is:



0 0 0 2 1 1 3 2 2 1 3 3</p>

IF you have the above semantics than this face consist of vertices 0, 2, 3 and 1. The normals is from index 0, 1, 2, 3 and the texture coordinates for the vertices are from index 0, 1, 2 and 3 in the source array pointed to from the input semantic of TEXCOORD.
And each vertex consist of a x, y and z element. So this first face consists of coordinates (-50, 50, 50), (-50, -50, 50), (50, -50, 50 ) and (50, 50, 50 ).

What, I’m still not sure about is how I read them in correctly. Or maybe I do have an idea and just need to confirm that it is what you are saying.

Basically are you saying that (probably according to the technique or semantic or something) that these indices break down as follows:
0 0 0 2 1 1 3 2 2 1 3 3

Broken down by groups of three:

0 0 0
2 1 1
3 2 2
1 3 3

From left to right.
The first vertical row indicates the indices for the vertices.
The normals are the next vertical row.
The texCoords are the last vertical row.

What about the last primitive with data like? It looks like this.
5 20 20 7 21 21 6 22 22 4 23 23

5 20 20
7 21 21
6 22 22
4 23 23

So, If I am understanding correctly, then the polygon for this face is made up of the indices at (5, 7, 6, 4).
50, 50, -50
50, -50, -50
-50, -50, -50
-50, 50, -50

Yes that is correct if the order of the input elements are:

<input semantic="VERTEX">
<input semantic="NORMAL">
<input semantic="TEXCOORD">

Awesome! Thanks.