If it doesn’t exist yet, wouldn’t this be a useful addition?

Thijs

]]>void jgraphics_get_matrix(t_jgraphics *g, t_jmatrix *matrix);

void jgraphics_set_matrix(t_jgraphics *g, const t_jmatrix *matrix);

-Joshua

]]>For nested transformations you would have to (re)store the matrix for every level. I would prefer the elegance and simplicity of a push/pop interface.

It’s no big deal. I’ll roll my own.

Thijs

]]>#define MY_PUSH_TRANSFORM(g) { t_jmatrix mpush; jgraphics_get_matrix(g, &mpush);

#define MY_POP_TRANSFORM(g) jgraphics_set_matrix(g, &mpush); }

Otherwise, yes, you’ll need to build and maintain your own stack.

-Joshua

]]>Your approach is probably more efficient, since the matrices are stored on the program stack, and mine on the heap, but I don’t think it’ll matter much.

I can’t think of a scenario in my code where the push/pop calls would come from separate functions but I do want to use nested push/pop calls within one function, and I think it’s cleaner this way.

Best,

Thijs