public void OnDrawEye(EyeTransform transform) { GLES20.GlClear(GLES20.GlColorBufferBit | GLES20.GlDepthBufferBit); positionParam = GLES20.GlGetAttribLocation(glProgram, "a_Position"); normalParam = GLES20.GlGetAttribLocation(glProgram, "a_Normal"); colorParam = GLES20.GlGetAttribLocation(glProgram, "a_Color"); texCoordParam = GLES20.GlGetAttribLocation(glProgram, "a_texcoord"); GLES20.GlEnableVertexAttribArray(positionParam); GLES20.GlEnableVertexAttribArray(normalParam); GLES20.GlEnableVertexAttribArray(colorParam); GLES20.GlEnableVertexAttribArray(texCoordParam); CheckGlError("mColorParam"); // Apply the eye transformation to the camera. Matrix.MultiplyMM(view, 0, transform.GetEyeView(), 0, camera, 0); // Set the position of the light Matrix.MultiplyMV(lightPosInEyeSpace, 0, view, 0, lightPosInWorldSpace, 0); GLES20.GlUniform3f(lightPosParam, lightPosInEyeSpace[0], lightPosInEyeSpace[1], lightPosInEyeSpace[2]); // Build the ModelView and ModelViewProjection matrices // for calculating cube position and light. Matrix.MultiplyMM(modelView, 0, view, 0, modelCube, 0); Matrix.MultiplyMM(modelViewProjection, 0, transform.GetPerspective(), 0, modelView, 0); DrawCube(); // Set mModelView for the floor, so we draw floor in the correct location Matrix.MultiplyMM(modelView, 0, view, 0, modelFloor, 0); Matrix.MultiplyMM(modelViewProjection, 0, transform.GetPerspective(), 0, modelView, 0); DrawFloor(transform.GetPerspective()); }
public void OnDrawEye(EyeTransform transform) { // clear buffer. // 画面をクリアする。 GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); float[] prj = transform.GetPerspective(); OpenTK.Matrix4 prjMat = MatrixFromArray(ref prj); Shader.SetProjection(prjMat); // apply left/right eye matrix. float[] eye = transform.GetEyeView(); OpenTK.Matrix4 eyeMat = MatrixFromArray(ref eye); OpenTK.Matrix4 lookat = Matrix4.LookAt(-Vector3.UnitZ, Vector3.Zero, Vector3.UnitY); // 手前から、Y軸を上にして、原点を見る視点。 Shader.SetLookAt(lookat * eyeMat); // 左目または右目の視点にする。 // draw shape. // 図形を描画する。 Shader.IdentityMatrix(); Shader.Rotate(Rotate, Vector3.UnitY); Shader.SetMaterial(OpenTK.Graphics.Color4.Red); Shape.Draw(Shader); }
public void OnDrawEye(EyeTransform transform) { game.Draw(transform.GetEyeView(), transform.GetPerspective()); }
public void OnDrawEye (EyeTransform transform) { game.Draw (transform.GetEyeView (), transform.GetPerspective ()); }