Android, OpenGL convert vertices values to pixels
I'm creating application to Android using OpenGL开发者_运维百科 ES.
I created rectangle using following vertices.private float vertices[] = {
-1.0f, 0.5f, 0.0f, // 0, Top Left
-1.0f, -0.5f, 0.0f, // 1, Bottom Left
1.0f, -0.5f, 0.0f, // 2, Bottom Right
1.0f, 0.5f, 0.0f, // 3, Top Right
};
private short[] indices = { 0, 1, 2, 0, 2, 3 };
How do find location in pixels for this rectangle.It depends on your viewport, projection and model view matrices. position of a vertex on the screen is calculated with the formula like: projectionMatrix * modelviewMatrix * vertex
find some useful explanations here: http://robertokoci.com/world-view-projection-matrix-unveiled/ http://db-in.com/blog/2011/04/cameras-on-opengl-es-2-x/
精彩评论