public void DrawInRect(GLKView view, CGRect rect) { GL.ClearColor(0.65f, 0.65f, 0.65f, 1f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Oes.BindVertexArray(vertexArray); effect.PrepareToDraw(); GL.DrawArrays(BeginMode.Triangles, 0, Monkey.MeshVertexData.Length / 6); }
public void Draw(object sender, GLKViewDrawEventArgs args) { GL.ClearColor(0.65f, 0.65f, 0.65f, 1f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Oes.BindVertexArray(vertexArray); effect.PrepareToDraw(); GL.DrawArrays(BeginMode.Triangles, 0, Monkey.MeshVertexData.Length / 8); }
public override void Draw(RectangleF rect) { UpdateCubes(); GL.ClearColor(0.15f, 0.15f, 0.15f, 1); GL.Clear(ClearBufferMask.ColorBufferBit); GL.Clear(ClearBufferMask.DepthBufferBit); GL.Oes.BindVertexArray(vertexArray); for (int i = 0; i < NumLittleCubes; i++) { var cube = littleCube [i]; var translationX = ((i - 1) * UnitLittleCubeWidth) - (scrollOffset.X * UnitLittleCubeWidth / LittleCubeWidth); var cubeMatrix = Matrix4.CreateTranslation(translationX, 2.8f, -7); cubeMatrix = Matrix4.Mult(Matrix4.CreateFromAxisAngle(new Vector3(cube.XAxis, cube.YAxis, cube.ZAxis), cube.RotationRadians), cubeMatrix); effect.Light0.DiffuseColor = new Vector4(cube.Red, cube.Green, cube.Blue, 1.0f); effect.Transform.ModelViewMatrix = cubeMatrix; effect.PrepareToDraw(); GL.DrawArrays(BeginMode.Triangles, 0, 36); } var bigCubeMatrix = Matrix4.CreateTranslation(0, -0.5f, -3); bigCubeMatrix = Matrix4.Mult(Matrix4.CreateFromAxisAngle(new Vector3(bigCube.XAxis, bigCube.YAxis, bigCube.ZAxis), bigCube.RotationRadians), bigCubeMatrix); effect.Light0.DiffuseColor = new Vector4(bigCube.Red, bigCube.Green, bigCube.Blue, 0.5f); effect.Transform.ModelViewMatrix = bigCubeMatrix; effect.PrepareToDraw(); GL.DrawArrays(BeginMode.Triangles, 0, 36); }