GeomVertexArrayFormat::add_column segfaults.

Hi all,

I’m extending my terrain system PGMM that it can calculate tangent and binormal vectors as well as normal vectors. Because Panda3D does not have a default vertexformat which involves tangent or binormal vectors, so I had to create one myself. This is my code to create the ArrayFormat:

PT(GeomVertexArrayFormat) array;
if(_has_color_map) {

Already at the first add_column it segfaults. Am I doing something wrong?
I tested the same thing in a python shell and it worked there.

EDIT: I just found out that if I don’t make it a PT() but just a normal GeomVertexArrayFormat, it passes, but I get assertion errors from referenceCount.I.

PT means “Pointer To” (with reference counting). So you’ve got an uninitialized pointer. Try this:

PT(GeomVertexArrayFormat) array = new GeomVertexArrayFormat();

Hmm. I must’ve overlooked that one :wink:
Thanks a lot, it works great now!