I only have projection and model-view matrices while what I want is getting the 2D position of object in the screen. The projection matrix is array of float[16]. For example:
float[] projectionMatrix = new float[16] {
2.6077228, 0.0, 0.0, 0.0,
0.0, 1.9605954, 0.0, 0.0,
-0.010504603, -0.01849866, -1.004008, -1.0,
0.0, 0.0, -20.040081, 0.0
};
The model-view matrix is the same. For example:
float[] modelViewMatrix = new float[16] {
0.78095937, -0.05827314, -0.6218487, 0.0,
0.04460156, 0.9982925, -0.037790783, 0.0,
0.6229988, 0.001786924, 0.78222054, 0.0,
25.339212, -41.582745, -197.50203, 1.0
}
How to find the final position of object [x, y]? Does anyone have experience in this?
Update more details: In my project, everything is calculated inside .so lib. I can only get the projection and modelview matrx. The lib detects an object via camera and now I want to know the 2d position of it on the screen to add some touch events.
modelViewMatrix
, then with theprojectionMatrix
. If that doesn't work, you'll have to be more specify about where exactly you're having problems. – Reto Koradi