【发布时间】:2016-10-26 22:55:11
【问题描述】:
我正在为谷歌纸板开发一个应用程序,它将流式传输两个视频,每只眼睛一个,以模拟 3D 视觉。我只打算使用 google vr sdk 来模拟将应用于每一帧的双目畸变,但是从this example 不清楚哪个函数实际应用了畸变。
/**
* Draws a frame for an eye.
*
* @param eye The eye to render. Includes all required transformations.
*/
@Override
public void onDrawEye(Eye eye) {
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
...
// Apply the eye transformation to the camera.
Matrix.multiplyMM(mView, 0, eye.getEyeView(), 0, mCamera, 0);
// Set the position of the light
Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 0, LIGHT_POS_IN_WORLD_SPACE, 0);
// Build the ModelView and ModelViewProjection matrices
// for calculating cube position and light.
float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR);
Matrix.multiplyMM(mModelView, 0, mView, 0, mModelCube, 0);
Matrix.multiplyMM(mModelViewProjection, 0, perspective, 0, mModelView, 0);
drawCube();
// Draw the rest of the scene.
...
}
这段代码sn-p是这样描述的:
这是事件的顺序:
- 宝物进入眼界。
- 我们应用投影矩阵。这提供了为指定眼睛渲染的场景。
- Google VR SDK 会自动应用失真来渲染最终场景。
然而,这第三步实际上并没有被解释。由于我不是渲染和图像,只是使用现实生活中的视频,我只需要使用应用失真的代码部分,但我不清楚这是如何发生的。
如果有人有任何想法,请告诉我。
【问题讨论】:
标签: android rendering virtual-reality google-vr