For this you use transformation matrices. You need three matrices to do what you want, the object matrix (giving its position and rotation), the camera matrix (giving the camera position and orientation in space) and the projection matrix (which causes perspective, i.e. far from small, big things nearby).
:
float[] model = new float[16];
float[] camera = new float[16];
float[] projection = new float[16];
float[] modelview = new float[16];
float[] mvp = new float[16];
float f_scene_rotation_x = 10, f_scene_rotation_y = 30;
Matrix.setIdentityM(camera, 0);
Matrix.translateM(camera, 0, 0, 0, -2.5f);
Matrix.rotateM(camera, 0, f_scene_rotation_y, 1, 0, 0);
Matrix.rotateM(camera, 0, f_scene_rotation_x, 0, 1, 0);
Matrix.setIdentityM(model, 0);
Matrix.translateM(model, 0, 1, 2, 0.5f);
int mWidth = 640, mHeight = 480;
perspective(projection, 0, 90, (float)mWidth / mHeight, .1f, 1000.0f);
Matrix.multiplyMM(modelview, 0, camera, 0, model, 0);
Matrix.multiplyMM(mvp, 0, projection, 0, modelview, 0);
GLES20.glUseProgram(xxx);
GLES20.glUniformMatrix4fv(yyy, 1, false, GLES20.GL_FALSE, mvp);
, OpenGL ES 2.0. , glLoadMatrix() ( mvp). OpenGL ES 1.0 glRotatef()/glTranslatef(), .
, (). , - Android, :
public static void perspective(float[] matrix, int moffset, float f_fov, float f_aspect, float f_near, float f_far)
{
float f_w, f_h;
f_h = (float)(Math.tan(f_fov * Math.PI / 180 * .5f)) * f_near;
f_w = f_h * f_aspect;
Matrix.frustumM(matrix, moffset, -f_w, f_w, -f_h, f_h, f_near, f_far);
}
, ...