小编Mat*_*att的帖子

OpenGL ES 2.0相机问题

我正在使用Android和OpenGL ES 2.0,我遇到了一个问题,我无法真正解决这个问题.在图像http://i.imgur.com/XuCHF.png中,我基本上有一个形状来代表中间的船只,当它移动到侧面时,它会向消失点伸展.我想要完成的是让船在移动时保持其大部分形状.我相信这可能是由于我的矩阵,但我看过的每一种资源似乎都使用相同的方法.

//Setting up the projection matrix
final float ratio = (float) width / height;
final float left = -ratio;
final float right = ratio;
final float bottom = -1.0f;
final float top = 1.0f;
final float near = 1.0f;
final float far = 1000.0f;
Matrix.frustumM(projection_matrix, 0, left, right, bottom, top, near, far);

//Setting the view matrix
Matrix.setLookAtM(view_matrix, 0, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f);

//Setting the model matrix
Matrix.setIdentityM(model_matrix, 0);
Matrix.translateM(model_matrix, 0, 2f, …
Run Code Online (Sandbox Code Playgroud)

android opengl-es matrix opengl-es-2.0

5
推荐指数
1
解决办法
4076
查看次数

标签 统计

android ×1

matrix ×1

opengl-es ×1

opengl-es-2.0 ×1