Android Shader Remarks, GPS, Graphics iOS




CS175

Chris Pollett

Nov. 10, 2014

Outline

Introduction

Loading Stuff for OpenGL

Consider the following code which might be placed in a helper class:

public static String readTextFileFromRawResource(final Context context,
        final int resourceId)
{
    final InputStream inputStream = context.getResources().openRawResource(
            resourceId);
    final InputStreamReader inputStreamReader = new InputStreamReader(
            inputStream);
    final BufferedReader bufferedReader = new BufferedReader(
            inputStreamReader);

    String nextLine;
    final StringBuilder body = new StringBuilder();

    try
    {
        while ((nextLine = bufferedReader.readLine()) != null)
        {
            body.append(nextLine);
            body.append('\n');
        }
    }
    catch (IOException e)
    {
        return null;
    }

    return body.toString();
}

Location in Android

LocationManager

LocationListener

Quiz

Which of the following is true?

  1. An Android OvalShape is of type ShapeDrawable.
  2. A minimal OpenGL ES shader program makes use of a vertex shader and a fragment shader.
  3. A GLSurfaceView.Renderer has a method onSurfaceChanged which is always called when the surface needs to be drawn.

Graphics on the iPhone

Getting Context in Quartz

Drawing into a Context

The Coordinate System

Specifying Color

Drawing Images in a Context

Drawing Shapes: Polygons, Lines and Curves

Demo App

UIRandomColor

Constants.h