Simple Collada To OpenGL ES

Hello,

I’m trying to render a simple cube using a Collada file exported from 3ds max. The DAE file is below. I would just like to start by pulling the information manually out of the Collada file to better understand the Collada format. With that said, can somebody help me understand how to come up with the vertices needed for openGL ES using the position array and the P element array? I know this has to be easier than I’m making it out to be on my side. I exported Triangle data rather than polygons which I figured that is what I would need. Any help would be greatly appreciated! (I’m not worrying about texture coordinates at this time)

Thanks, -B-

<?xml version="1.0" encoding="utf-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
  <asset>
    <contributor>
      <author>encoreadmin</author>
      <authoring_tool>COLLADAMax NextGen;  Version: 0.9.5;  Revision: 447;  Platform: x64;  Configuration: Release Max2009</authoring_tool>
    </contributor>
    <created>2009-07-24T23:07:55</created>
    <modified>2009-07-24T23:07:55</modified>
    <unit name="inch" meter="0.0254"/>
    <up_axis>Z_UP</up_axis>
  </asset>
  <library_effects>
    <effect id="ColorEffectR0G0B0">
      <profile_COMMON>
        <technique sid="common">
          <phong>
            <ambient>
              <color>0 0 0 1</color>
            </ambient>
            <diffuse>
              <color>0 0 0 1</color>
            </diffuse>
            <specular>
              <color>1 1 1 1</color>
            </specular>
            <shininess>
              <float>10</float>
            </shininess>
            <reflective>
              <color>0 0 0 1</color>
            </reflective>
            <transparent>
              <color>1 1 1 1</color>
            </transparent>
            <transparency>
              <float>1</float>
            </transparency>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
    <effect id="ColorEffectR214G228B153">
      <profile_COMMON>
        <technique sid="common">
          <phong>
            <ambient>
              <color>0.839216 0.894118 0.6 1</color>
            </ambient>
            <diffuse>
              <color>0.839216 0.894118 0.6 1</color>
            </diffuse>
            <specular>
              <color>1 1 1 1</color>
            </specular>
            <shininess>
              <float>10</float>
            </shininess>
            <reflective>
              <color>0 0 0 1</color>
            </reflective>
            <transparent>
              <color>1 1 1 1</color>
            </transparent>
            <transparency>
              <float>1</float>
            </transparency>
          </phong>
        </technique>
      </profile_COMMON>
    </effect>
  </library_effects>
  <library_materials>
    <material id="ColorEffectR0G0B0-material" name="ColorEffectR0G0B0-material">
      <instance_effect url="#ColorEffectR0G0B0"/>
    </material>
    <material id="ColorEffectR214G228B153-material" name="ColorEffectR214G228B153-material">
      <instance_effect url="#ColorEffectR214G228B153"/>
    </material>
  </library_materials>
  <library_geometries>
    <geometry id="geom-Box01" name="Box01">
      <mesh>
        <source id="geom-Box01-positions">
          <float_array id="geom-Box01-positions-array" count="24">-16.0772 -12.8617 0 16.0772 -12.8617 0 -16.0772 12.8617 0 16.0772 12.8617 0 -16.0772 -12.8617 21.865 16.0772 -12.8617 21.865 -16.0772 12.8617 21.865 16.0772 12.8617 21.865</float_array>
          <technique_common>
            <accessor source="#geom-Box01-positions-array" count="8" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="geom-Box01-normals">
          <float_array id="geom-Box01-normals-array" count="72">0 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0 1 0 0 1 0 0 1 0 0 1 0 -1 0 0 -1 0 0 -1 0 0 -1 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 -1 0 0 -1 0 0 -1 0 0 -1 0 0</float_array>
          <technique_common>
            <accessor source="#geom-Box01-normals-array" count="24" stride="3">
              <param name="X" type="float"/>
              <param name="Y" type="float"/>
              <param name="Z" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <source id="geom-Box01-map-channel1">
          <float_array id="geom-Box01-map-channel1-array" count="36">0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 0</float_array>
          <technique_common>
            <accessor source="#geom-Box01-map-channel1-array" count="12" stride="3">
              <param name="S" type="float"/>
              <param name="T" type="float"/>
              <param name="P" type="float"/>
            </accessor>
          </technique_common>
        </source>
        <vertices id="geom-Box01-vertices">
          <input semantic="POSITION" source="#geom-Box01-positions"/>
        </vertices>
        <triangles material="ColorMaterial" count="12">
          <input semantic="VERTEX" source="#geom-Box01-vertices" offset="0"/>
          <input semantic="NORMAL" source="#geom-Box01-normals" offset="1"/>
          <input semantic="TEXCOORD" source="#geom-Box01-map-channel1" offset="2" set="1"/>
          

0 0 9 2 1 11 3 2 10 3 2 10 1 3 8 0 0 9 4 4 8 5 5 9 7 6 11 7 6 11 6 7 10 4 4 8 0 8 4 1 9 5 5 10 7 5 10 7 4 11 6 0 8 4 1 12 0 3 13 1 7 14 3 7 14 3 5 15 2 1 12 0 3 16 4 2 17 5 6 18 7 6 18 7 7 19 6 3 16 4 2 20 0 0 21 1 4 22 3 4 22 3 6 23 2 2 20 0</p>
        </triangles>
      </mesh>
      <extra>
        <technique profile="3dsMAX">
          <max_box>
            <generateuvs>1</generateuvs>
            <height>21.865</height>
            <heightsegments>1</heightsegments>
            <length>25.7235</length>
            <lengthsegments>1</lengthsegments>
            <width>32.1543</width>
            <widthsegments>1</widthsegments>
          </max_box>
        </technique>
      </extra>
    </geometry>
  </library_geometries>
  <library_visual_scenes>
    <visual_scene id="MaxScene">
      <node id="node-Scene_Root" name="Scene_Root">
        <node id="node-Box01" name="Box01">
          <translate>-0.321544 1.40551e-008 -0.321544</translate>
          <rotate>-1 0 0 -90</rotate>
          <instance_geometry url="#geom-Box01">
            <bind_material>
              <technique_common>
                <instance_material symbol="ColorMaterial" target="#ColorEffectR214G228B153-material"/>
              </technique_common>
            </bind_material>
          </instance_geometry>
        </node>
      </node>
    </visual_scene>
  </library_visual_scenes>
  <scene>
    <instance_visual_scene url="#MaxScene"/>
  </scene>
</COLLADA>

The COLLADA RT viewer is loading COLLADA files using the DOM, and rendering with OpenGL.
Source code is available there: http://collada-dom.svn.sourceforge.net/ … /trunk/rt/

You can build this project and look at the source to see how this works ?