我開始繪製Quad,但是當我開始玩Vertices時,我發現X座標已翻轉。繼承人圖片顯示我的意思:OpenGL ES 2.0 X軸被翻轉了嗎?
這裏是我的頂點 - 指數和紋理座標,我真的沒有顯示。
static final int COORDS_PER_VERTEX = 3;
static float positionCoords[] = {
-0.5f, 0.5f, 0.0f, // top left
-0.5f, -0.5f, 0.0f, // bottom left
0.5f, -0.5f, 0.0f, // bottom right
0.5f, 0.5f, 0.0f }; // top right
static final int COORDS_PER_TEXTURE = 2;
static float textureCoords[] = {
0.0f, 0.0f,
0.0f, 1.0f,
1.0f, 1.0f,
1.0f, 0.0f, };
private final short indices[] = { 0, 1, 2 };
這就是我改變Projection和View Matrices的地方。
public void onSurfaceChanged(GL10 naGl, int width, int height)
{
Log.d(TAG, "GL Surface Changed - Setting Up View");
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width/height;
Matrix.frustumM(ProjectionMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
Matrix.setLookAtM(ViewMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
}
它爲什麼會被「倒退」。我還認爲我的相機可能位於物體的後面,因此如果我在物體後面,那麼在三維空間中將會是正面的。
我假設你的意思是X座標? (橫軸)。 – Tim 2012-08-05 18:30:37
哦哇是的,謝謝 – 2012-08-05 18:31:59