What API SHOULD I be using?

I’m working at a company where we have a proprietary engine and we would like to be able to load DAE files. For now stationary models will be fine, we do not yet need animation or shader or physics information but we will in the future. After fighting with COLLADA DOM for weeks I had I was finally able to load some stationary models with exactly one texture. This level of functionality however does not even approach what is acceptable, and after spending a few days trying to revise it into something useful by combing through the sample viewer application provided with COLLADA DOM I’m at my wits end. All together I have been able to find next to no documentation, and any implementations and samples I have encountered have been partial and vague or obscenely complex. Then yesterday I ran into a comment stating COLLADA DOM was basically abandoned and people looking into implementing COLLADA should look into OpenCOLLADA. So I grabbed OpenCOLLADA and while it does seem quite a bit simpler I have been unable to find ANY documentation, and have no idea what source I should be using as a reference or sample.

Please, we really want all the features COLLADA offers but at this point I have no idea how to implement it. We are using an in-house engine which uses OpenGL, at the moment we are loading models into render lists and are going to implement VBOs at some point. I wrote an X file loader quite a while ago which works fine but there is no animation support etc. and nobody here really wants anything to do with the X format, we all want DAE. If anyone can point me in the right direction I would really appreciate it. Thank you.

For OpenCOLLADA the best starting point is to read the code. There are multiple implementations ranging from simple to complex:

[ul]- dae23ds

There is a short description available on http://opencollada.org/OpenCOLLADA%20techniques.pdf, too.

Give it a try: it’s very simple to use the API. If you want to document your efforts to provide an easier beginning for other developers you are welcome to do so. That’s what’s open source is all about.

Thank you very much, I will look into those right away and I very much intend to document my efforts so that others do not have the same trouble as I have.

OK, I’ve been working on this when I have had the time (little) and have yet to have any success. Part of this is there being no documentation, a total lack of comments in the source, and no clear direction of what I’m supposed to be using to just read model data. The OpenCOLLADA techniques document simply contains the names of projects that use it; and none of those projects seem to have a reasonably simple implementation. Sirikata for example uses 16+ files simply to interface with OpenCOLLADA. 16! Why should it take more code to use a COLLADA library than it does to write a full parser/loader for an X file? I really don’t want to be negative and I don’t want to complain, I really want to utilize the benefits that COLLADA can provide and it is a very attractive format but this is extremely discouraging. If there is no documentation, why?

I’m implementing a COLLADA translator that turns a .dae file into our proprietary model file format. I’ve run into this exact problem, so I’m going to post my findings.

There are 3 APIs that facilitate loading COLLADA files:

[ul]
[li]COLLADA-DOM[/:m:1ftrwgm8][/li][li]FCollada FREE 3.05B[/:m:1ftrwgm8][/li][li]OpenCOLLADA[/*:m:1ftrwgm8][/ul][/li]
I have researched every API thoroughly, and they are all poorly documented for the beginner.

OpenCOLLADA provides no documentation, only a few projects (the most useful is one that loads a model into Ogre), all of which contain a lot of code that has nothing to do with the API itself. It also requires you to write classes that derive from their “loader” classes, which means that you have to override functionality and constantly refer to their source files to figure out what you’re supposed to be doing. So OpenCOLLADA is out.

COLLADA-DOM is the least beginner friendly, but it’s the official API managed by the contributors of the COLLADA standard, so it will always support the latest version of the specification, which is a big plus if you’re writing a commercial application. Just know, if you want to use COLLADA-DOM you must understand the COLLADA specification very well, because COLLADA-DOM behaves closely like an XML parser:

dae->getDatabase()->getElement(elementPtr, elemIndex, elemName, libName, someVal);

This is the best way to load and save COLLADA, just know that if you plan on going this route, you must devote significant time to learn and understand the COLLADA Standard, and buy the COLLADA book. I’m currently using FCollada but will probably switch to COLLADA-DOM soon.

FCollada is by far the easiest way to load a COLLADA file and get up and running. It has no official documentation, but there are two great student projects that demonstrate how to load a COLLADA document and how to extract the data it contains using the FCollada API.

[ul]
[li]OpenGL COLLADA Loader by Ricardo Lopez[/:m:1ftrwgm8][/li][li]FCollada with DirectX by John Kalberger[/:m:1ftrwgm8][/ul][/li]I actually found the DirectX project to be a greater help. I don’t understand why the developers of these super advanced APIs don’t provide sample projects like these that make it easy to find a “LoadColladaFile()” function that does everything from initialization, to parsing of the most basic and useful model data, such as Vertices and Normals. The only problem with FCollada is that the free version is no longer being developed and supported. Which means that if another big COLLADA release comes out with some features that are absolutely essential, you’re just shit outa luck, unless you pay the licensing fees for the paid version of FCollada. I got a COLLADA file to load and I got the geometry data for the meshes it contained in less than 15 minutes with FCollada, very friendly API.

NOTE: FCollada did not compile for me. I got tons of these errors:

Error	21	error C3163: '_vsnprintf': attributes inconsistent with previous declaration	c:\program files\microsoft visual studio 9.0\vc\include\stdio.h	358

Follow the instructions by “Purga” (last post) on this thread here.

sambatista, thank you very much for that. I actually have a loader written in COLLADA-DOM that took me a significant amount of time to make. Unfortunately I started running into problems when loading went beyond just models with single textures, and it became very apparent loading animations and shader information would be a gargantuan task. Also, COLLADA-DOM is currently behind OpenCOLALDA in terms of “officially” supported COLLADA version and according to various forum posts (which of course don’t really contain any verifiable information) has fewer supported extra features. On top of that, I located what I am assuming is a message from the developers at SonyUSA basically saying they didn’t intend to work on COLLADA-DOM any time soon as it is “working” for current PS3 works and that’s really what they wanted.

So, I know going back to COLLADA-DOM is going to take an immense amount of time to get it doing what I actually want it to, and OpenCOLLADA promises to NOT take so much time. Unfortunately you were very correct in you analyses of it - it’s vague, naming is bizarre, documentation is nowhere to be found, and what documentation I can find I can only assume was written by people with a poor grasp of English. I’m also going off of Japanese documentation, of which there is a reasonable amount for COLLADA-DOM (probably more than in English) but absolutely none for OpenCOLLADA.

I’ll be returning to the COLLADA loader within the next few weeks. At the moment we’re moving into a new office and getting a big load of new employees, so I need to clean up the engine as best I can and get it ready for our new developers to be able to handle without headaches. Once that’s done I’ll have to start tearing up OpenCOLLADA - I really can’t handle the amount of stress COLLADA-DOM would take to make a fully working loader.

—Oh, and by a rough look it appears as if OpenCOLLADA actually uses something like 5 build tools (scons, make, cmake and/or automake?, libtool). Seriously, what the hell!?