Getting x and y position from opengl transform

Hi, is there an easy and fast way to get the x and y position from the opengl transform?
for example,

GL11.glLoadIdentity();
GL11.glRotatef(45,0,0,1);
GL11.glTranslatef(0,10,0);

//-> then somehow get x and y position of current transform

Thanks :slight_smile:

glGetFloatv(GL_MODELVIEW_MATRIX, buffer)

after that, load the 16 values into a matrix class (use the LWJGL one, or google one) and transform your vertex with it.

Thanks Riven :slight_smile:

How do I transform my vertex with it?

Google matrix + vector multiplication. It’s a main component of linear algebra. The x coordinate of the transform is located at row 0, column 3 and the y is at row 1, column 3. OpenGL returns the matrix in column major order (so each column is consecutive), which means that x is element 12 and y is element 13 (and z would be 14).

Thanks lhkbob!

It took me a while to get it, but it works now! :slight_smile: