can someone point me to correct method of initialising transformations. I created a pointer to ALLEGRO_TRANSFORM and invoked al_identity_tranform on it.
"/build/allegro5-F6iykb/allegro5-5.2.6.0/src/transformations.c:147: al_identity_transform: Assertion `trans' failed.
Aborted (core dumped)"
This is the error
You're passing a pointer? Does it actually point to an ALLEGRO_TRANSFORM?
Generally you pass in a transform like this:
// This is allocated on the stack ALLEGRO_TRANSFORM transform; // Pass a pointer to a stack-allocated pointer al_identity_transform(&transform);
Sounds like you might be doing something like this:
// This is a pointer to NULL ALLEGRO_TRANSFORM* transform = NULL; al_identity_transform(transform); // bad
Basically, al_identity_transform expects the memory for the transform you provide to be allocated. So it needs to pointer to an object on the stack (or in the heap, if the transform is a field in a class or struct).
A class or struct field is not implicitly on the heap at all. Where it is allocated depends on how you define an instance of it. I know (hope) Erin knows that, but the OP may not.
I wrote this on my phone so hopefully I didn't miss any typos. If the OP or anyone doesn't understand this ask questions! That's what we're here for!
Problem Solved! Thankyou everyone who replied , and yes I was making the mistake of declaring a pointer without actually allocating memory for the ALLEGRO_TRANSFORM struct
Glad you and Erin got it solved.