Jump to content
  • Advertisement
Sign in to follow this  
fernandoc1

OpenGL Collada loader from scratch

This topic is 2598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to load a collada mesh and draw it with OpenGL primitives.
Currently I don't care about normals, animations and other Collada properties.
My idea is to parse the file until I find the mesh tag, then I find the float array, and read the values to a array.


<mesh>
<source id="Cube-mesh-positions">
<float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
<technique_common>
<accessor source="#Cube-mesh-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>



My problem is to figure out the order that I should put the vertexes to be drawn properly.

Share this post


Link to post
Share on other sites
Advertisement
Thanks for your suggestion. I'm going to try assimp, it looks to be complete.
However, I wish to try to draw Collada meshes by myself to learn a little about how it is done.
I only wish to know what is the order that I should read and draw the coodinates.

Share this post


Link to post
Share on other sites

I want to load a collada mesh and draw it with OpenGL primitives.
Currently I don't care about normals, animations and other Collada properties.
My idea is to parse the file until I find the mesh tag, then I find the float array, and read the values to a array.


<mesh>
<source id="Cube-mesh-positions">
<float_array id="Cube-mesh-positions-array" count="24">1 1 -1 1 -1 -1 -1 -0.9999998 -1 -0.9999997 1 -1 1 0.9999995 1 0.9999994 -1.000001 1 -1 -0.9999997 1 -1 1 1</float_array>
<technique_common>
<accessor source="#Cube-mesh-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>



My problem is to figure out the order that I should put the vertexes to be drawn properly.





http://www.khronos.o...da_spec_1_5.pdf have a look at the collada specification!!!
i'm intersting in learning this too :) just read a few lines of the spec
the accessor defines the format of the float array (id <-> source matches)
the float array is just a data repository, and it's cut by the accessor into 8 elements of 3 strides
what i think, means the format of the float array looks like this: XYZ XYZ XYZ XYZ XYZ XYZ XYZ XYZ

edit: but that's just the vertex position, you definitely need and index array too ! ... btw that are the 8 corners of a cube with 0,0,0 in center


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!