having some trouble with the geometry integration sample

Hello all,

I’m new to collada and I’m having some trouble with the geometry integration sample (from the programming giude).

My problems start very early on, and they appear to be initialisation issues…
I’m sure I’ve missed something from the programming giude, but I’m not sure what.

Here’s what happens:

I start by calling intRegisterElements(), which then calls intGeometry::registerElement()
(all the other XXX::registerElements() methods have been commented out since I only need geometry for now).

Right after this, I get a segmentation fault trying to access a NULL pointer.
This happens in
daeMetaElement *
if ( _Meta != NULL ) return _Meta;

_Meta = new daeMetaElement;
_Meta->setName( "geometry" );
_Meta->registerClass(intGeometry::create, &_Meta);



return _Meta;


It sees _Meta as NULL (the intGeometry _Meta) and it news it.
Then when it tries to do
it bombs out because the domGeometry _Meta is NULL.

I’ve looked through the code and saw that the domGeometry::_Meta gets newed by domGeometry::registreElement().

QUESTION 1: Where should this get called from? Is there some sort of initialisation code I need to run before I can use any of this?

QUESTION 2: After I call “new DAE” for my daeObject, do I need to call daeObject->setDatabase(0) ? I’ve noticed that to get to the geometry of my object after it’s been loaded, I need to go through the database…I’m assuming creating the default one (by passing NULL) should be ok, right?

Thx in advance for any help,

The problem most likely is that you aren’t supposed to call intRegisterElements on your own. You are supposed to pass the function as an argument to DAE::setIntegrationLibrary(). Then it will call the function when it is appropriate. Hmm I see that the integration example doesn’t actually show how to use the integration library it creates. The programming guide does have a section on this. In summary it says to do this

// Instantiate the reference implementation
daeObject = new DAE;
//register the integration objects

I personally don’t think the integration classes are that useful. If you want to discuss this more feel free to ask about it.

Hope that helps,


Thank you for your response. As I said I’m fairly new to COLLADA (which so far looks awesome by the way) and I’ve set myself the simple task of:

  • create a cube in maya/blender/whatever (no textures, no lights, nothing…just a simple cube)
  • export it as a .dae (1.4)
  • load it into my game engine and render it on screen

Looking at the sample code, it’s not very clear how to set things up properly, so I followed the section on the programming guide (which led to this seg fault).

I’ll try your suggestion below shortly…Are there any docs/links or example programs that show how you can get to the geometry of an object you’ve exported from a DCC package?

Also, is there any cleaning up code I’m meant to be running during shutdown?
There are a lot of registerXXX, createXXX, etc. methods but I don’t see any unregisterXXX, destroyXXX, etc. methods…

Thanx again,

The COLLADA RT project is an openGL sample viewer. It is available from the same source forge project page as the COLLADA DOM. The CrtSceneRead.cpp file should have everything you need as an example for loading COLLADA, well everything except comments explaining what is going on.

As of COLLADA 1.4.1 DOM 1.2.0 (the newest release of the DOM), the cleaning up of the API will happen for you when you destroy the last instance of DAE. You will see older implementations that call DAE::cleanup() at the end of their code but that is no longer neccisary.