Access the current translation point

Hello,

I’ve got a bunch of code uses ofTranslate, ofRotate, pushMatrix and popMatrix to move around and draw stuff in different locations.

At certain points I want to emit particles at the current point of translation. How do I access this?

I found that I could use ofGetCurrentRenderer to get access to the renderer object, and this has the matrixStack inside it, which is where I think the information I need is. But matrixStack is private, so I’m not sure how I can read the current translation?

Any help would be very much appreciated!

I decided that the only way I could work this out was to maintain my own copy of ofMatrixStack. I make translate, rotate, push and pop it whenever I make changes to the main stack with ofTranslate etc.

Is there a better way to do this?

we have plans to get the current modelview and projection matrices with OF functions by now unless you are working with the new programmable renderer you can use:

  
  
GLfloat matrix[16];   
glGetFloatv (GL_MODELVIEW_MATRIX, matrix);  
ofMatrix4x4 m(matrix);  
  

That gives me a slightly different matrix than my own matrixstack->getCurrentMatrix() gives me. I think the issue might be with my code though so I’ll look a bit deeper…

Thanks for the hint.

Couldn’t find any functions for this, are they implemented yet?

they are in master or in the RC for 0.8.1