我有一个可在高分辨率设备上运行的动态壁纸,特别是在galaxy s3和nexus 7上。 我已经在htc one x上测试了它,这也是一个720p设备,但壁纸似乎是按比例放大的。 我不拥有htc x所以我无法检查壁纸的屏幕尺寸。 壁纸适用于openGL 2.0,因此它可能是相机z值,但为什么它看起来与nexus 7或s3不同? 有没有人知道问题可能是什么?
谢谢!
编辑:这是视图初始化代码:
// Adjust the viewport based on geometry changes,
// such as screen rotation
GLES20.glViewport(0, 0, width, height);
// Create the projection matrix so that it converts the 3000px grid to actual screen dimensions, centered (letterboxed)
Matrix.frustumM(mProjMatrix, 0, -(width / 3000.0f) / 2.0f, (width / 3000.0f) / 2.0f, -(height / 3000.0f) / 2.0f, (height / 3000.0f) / 2.0f, 3, 7);
// Set the camera position (View matrix)
Matrix.setLookAtM(mVMatrix, 0, 0.0f, 0, 3.0f, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);
`
我使用3000x3000像素"虚拟"元素放置的网格,然后使用投影矩阵将其设置为letterbox。它在N7或S3上运行良好,但Z值在One X上看起来很好。
所有顶点都设置为Z为0。