Lab archive: lab-8.zip Lab solutions: lab-8-solved.zip
Polygons in OpenGL are made up of multiple triangles. To draw a square, you have to draw two triangles. Modify the lab starter code such that it draws a colored square. Remember, respect clockwise or counter clockwise order for drawing polygons, otherwise you will have problems later on.
(Hint: GL_TRIANGLE_STRIP)
To use gestures, you have to add an OnTouchListener to the view or overwrite the onTouchEvent of the activity or GLSurfaceView. The received MotionEvent will contain the gesture type and the position. You want to capture ACTION_MOVE and get X and Y position, and then transmit them to the step method, and use them for modifying one of the rotation parameters (rx, ry, or rz). Remember to return true, otherwise you will not receive any more events.
Look in the settings menu under “Developer Options”.
There are 4 options of interest:
In Eclipse switch to Tracer perspective (Window > Open Perspective > Other). In the context bar there should be two new icons: Open existing trace and Connect to a device. Use the second one, choose the device and use the package and activity name of the application: package com.android.gl2jni and activity GL2JNIActivity.