/** * Draws a frame for an eye. * * @param eye The eye to render. Includes all required transformations. */ public void OnDrawEye(Eye eye) { GLES20.GlEnable(GLES20.GlDepthTest); GLES20.GlClear(GLES20.GlColorBufferBit | GLES20.GlDepthBufferBit); CheckGLError("colorParam"); // Apply the eye transformation to the camera. Matrix.MultiplyMM(view, 0, eye.GetEyeView(), 0, camera, 0); // Set the position of the light Matrix.MultiplyMV(lightPosInEyeSpace, 0, view, 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(modelView, 0, view, 0, modelCube, 0); Matrix.MultiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); DrawCube(); // Set modelView for the floor, so we draw floor in the correct location Matrix.MultiplyMM(modelView, 0, view, 0, modelFloor, 0); Matrix.MultiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); DrawFloor(); }
/** * Draws a frame for an eye. * * @param eye The eye to render. Includes all required transformations. */ public void OnDrawEye (Eye eye) { GLES20.GlEnable (GLES20.GlDepthTest); GLES20.GlClear (GLES20.GlColorBufferBit | GLES20.GlDepthBufferBit); CheckGLError ("colorParam"); // Apply the eye transformation to the camera. Matrix.MultiplyMM (view, 0, eye.GetEyeView (), 0, camera, 0); // Set the position of the light Matrix.MultiplyMV (lightPosInEyeSpace, 0, view, 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 (modelView, 0, view, 0, modelCube, 0); Matrix.MultiplyMM (modelViewProjection, 0, perspective, 0, modelView, 0); DrawCube (); // Set modelView for the floor, so we draw floor in the correct location Matrix.MultiplyMM (modelView, 0, view, 0, modelFloor, 0); Matrix.MultiplyMM (modelViewProjection, 0, perspective, 0, modelView, 0); DrawFloor (); }