Index: /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/ISSMVisual.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/ISSMVisual.java	(revision 14072)
+++ /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/ISSMVisual.java	(revision 14073)
@@ -3,35 +3,25 @@
 
 import android.app.Activity;
-import android.content.Context;
-import android.opengl.GLES20;
+import android.content.DialogInterface.OnClickListener;
 import android.opengl.GLSurfaceView;
-import android.opengl.GLSurfaceView.Renderer;
 import android.os.Bundle;
-import android.util.AttributeSet;
 import android.view.Menu;
 import android.view.View;
-import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.FrameLayout;
-import android.widget.RelativeLayout;
 import android.widget.SeekBar;
 import android.widget.SeekBar.OnSeekBarChangeListener;
 import android.widget.TextView;
-import android.widget.Toast;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;	 
-import java.nio.ShortBuffer;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10; 
 
 public class ISSMVisual extends Activity implements OnSeekBarChangeListener
 {
 	private SeekBar bar;
-    private TextView txtStatus, txtValue;
+    private TextView /*txtStatus,*/ txtValue;
     private GLSurfaceView mGLView;
 	private FrameLayout frame;
+	
     @Override
-    public void onCreate(Bundle savedInstanceState) {
+    public void onCreate(Bundle savedInstanceState) 
+    {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_issmvisual);
@@ -40,5 +30,15 @@
         bar.setOnSeekBarChangeListener(this); // set seekbar listener
         txtValue = (TextView)findViewById(R.id.value);
-        txtStatus = (TextView)findViewById(R.id.status);
+        Button reset = (Button)findViewById(R.id.button1);
+        reset.setOnClickListener(new View.OnClickListener()
+        {
+            public void onClick(View v) 
+            {
+            	frame.removeView(mGLView);
+            	mGLView = new MyGLSurfaceView(ISSMVisual.this);
+            	frame.addView(mGLView);
+            }
+        });
+        //txtStatus = (TextView)findViewById(R.id.status);
         
         mGLView = new MyGLSurfaceView(this);
@@ -46,31 +46,27 @@
         frame.addView(mGLView);
     }
-
-
-	@Override
-    public void onProgressChanged(SeekBar seekBar, int val,
+	public void onProgressChanged(SeekBar seekBar, int val,
     		boolean fromUser) 
     {
     	// change progress text label with current Seekbar value
-    	txtValue.setText("Value: " + val);
-    	txtStatus.setText("Status: changing");
+    	txtValue.setText("alpha value = " + val);
+    	//txtStatus.setText("Status: changing");
     }
 	
-    @Override
-    public void onStartTrackingTouch(SeekBar seekBar) 
+    public void onStartTrackingTouch(SeekBar seekBar) {/*txtStatus.setText("Status: Starting to track touch");*/}
+    
+    public void onStopTrackingTouch(SeekBar seekBar) 
     {
-    	txtStatus.setText("Status: Starting to track touch");
-
+    	seekBar.setSecondaryProgress(seekBar.getProgress()); // set the shade of the previous value.
+    	
+    	//txtStatus.setText("Status: Ended tracking touch");
+    	frame.removeView(mGLView);
+    	mGLView = new MyGLSurfaceView(this);
+        frame.addView(mGLView);
     }
     
     @Override
-    public void onStopTrackingTouch(SeekBar seekBar) 
+    protected void onPause() 
     {
-    	seekBar.setSecondaryProgress(seekBar.getProgress()); // set the shade of the previous value.
-    	txtStatus.setText("Status: Ended tracking touch");
-    }
-    
-    @Override
-    protected void onPause() {
         super.onPause();
         // The following call pauses the rendering thread.
@@ -82,5 +78,6 @@
     
     @Override
-    protected void onResume() {
+    protected void onResume() 
+    {
         super.onResume();
         // The following call resumes a paused rendering thread.
@@ -90,5 +87,4 @@
     }
 
-    
     @Override
     public boolean onCreateOptionsMenu(Menu menu) 
Index: /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/MyGLRenderer.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/MyGLRenderer.java	(revision 14072)
+++ /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/MyGLRenderer.java	(revision 14073)
@@ -25,224 +25,270 @@
 import android.opengl.GLES20;
 import android.opengl.GLSurfaceView;
-
-public class MyGLRenderer implements GLSurfaceView.Renderer {
-
-    private Triangle mTriangle1, mTriangle2, mTriangle3;
-
-    @Override
-    public void onSurfaceCreated(GL10 unused, EGLConfig config) {
-
+import android.opengl.Matrix;
+
+public class MyGLRenderer implements GLSurfaceView.Renderer 
+{
+	public volatile float mAngle;
+	
+	/**
+	 * Store the model matrix. This matrix is used to move models from object space (where each model can be thought
+	 * of being located at the center of the universe) to world space.
+	 */
+	private float[][] mModelMatrix;
+	
+	/**
+	 * Store the view matrix. This can be thought of as our camera. This matrix transforms world space to eye space;
+	 * it positions things relative to our eye.
+	 */
+	private float[][] mViewMatrix;
+
+	/** Store the projection matrix. This is used to project the scene onto a 2D viewport. */
+	private float[][] mProjectionMatrix;
+
+	/** Allocate storage for the final combined matrix. This will be passed into the shader program. */
+	private float[][] mMVPMatrix;
+
+	/** This will be used to pass in the transformation matrix. */
+	private int mMatrixHandle;
+	
+    private FloatBuffer[] triangleVert;
+    
+    private float[][] triangleData2DArr;
+    
+    private int mPositionHandle;
+    
+    private int mColorHandle;
+    
+	/** How many bytes per float. */
+    private final int mBytesPerFloat = 4;
+
+    /** How many elements per vertex. */
+    private final int mStrideBytes = 7 * mBytesPerFloat;
+
+    /** Offset of the position data. */
+    private final int mPositionOffset = 0;
+
+    /** Size of the position data in elements. */
+    private final int mPositionDataSize = 3;
+
+    /** Offset of the color data. */
+    private final int mColorOffset = 3;
+
+    /** Size of the color data in elements. */
+    private final int mColorDataSize = 4;	
+
+    public MyGLRenderer(float[][] vertices)
+    {	
+    	triangleData2DArr = new float[vertices.length][21];
+    	triangleVert = new FloatBuffer[vertices.length];
+    	
+    	for (int i = 0; i < vertices.length; i++)
+    	{
+    		for (int j = 0; j < 21; j++)
+    			triangleData2DArr[i][j] = vertices[i][j]; 
+    	}
+	    		
+	    // initialize vertex byte buffer for shape coordinates
+    	for (int i = 0; i < vertices.length; i++)
+    	{
+    		triangleVert[i] = ByteBuffer.allocateDirect(triangleData2DArr[i].length * mBytesPerFloat)
+    													.order(ByteOrder.nativeOrder()).asFloatBuffer();
+    		triangleVert[i].put(triangleData2DArr[i]).position(0);
+    	}
+    }
+    
+    public void onSurfaceCreated(GL10 unused, EGLConfig config) 
+    {
         // Set the background frame color
-        GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
-
-        mTriangle1 = new Triangle(
-        0.0f,  0.6f, 0.0f,   // top
-       -0.5f, -0.3f, 0.0f,   // bottom left
-        0.5f, -0.3f, 0.0f,
-        0.0f, 0.0f, 1.0f, 1.0f);   // bottom right
-        //mTriangle = new Triangle();
-        
-        mTriangle2 = new Triangle(
-        -0.5f, -0.3f, 0.0f,
-         0.0f, -1.0f, 0.0f,
-         0.5f,  -0.3f, 0.0f,
-         1.0f, 0.0f, 0.0f, 1.0f);
-        
-        mTriangle3 = new Triangle(
-        0.0f,  0.6f, 0.0f,
-        0.5f, -0.3f, 0.0f,
-        1.0f,  0.6f, 0.0f,
-        1.0f, 1.0f, 0.0f, 1.0f);
-    }
-
-    @Override
-    public void onDrawFrame(GL10 unused) {
-
-        // Draw background color
-        GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
-
-        // Draw triangle
-        mTriangle1.draw(); 
-        mTriangle2.draw();
-        mTriangle3.draw();
-    }
-
-    @Override
-    public void onSurfaceChanged(GL10 unused, int width, int height) {
+        GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+        
+		// Position the eye behind the origin.
+		final float eyeX = 0.0f;
+		final float eyeY = 0.0f;
+		final float eyeZ = 1.5f;
+
+		// We are looking toward the distance
+		final float lookX = 0.0f;
+		final float lookY = 0.0f;
+		final float lookZ = -5.0f;
+
+		// Set our up vector. This is where our head would be pointing were we holding the camera.
+		final float upX = 0.0f;
+		final float upY = 1.0f;
+		final float upZ = 0.0f;
+
+		// Set the view matrix. This matrix can be said to represent the camera position.
+		// NOTE: In OpenGL 1, a ModelView matrix is used, which is a combination of a model and
+		// view matrix. In OpenGL 2, we can keep track of these matrices separately if we choose.
+		mViewMatrix = new float[triangleVert.length][16];
+		
+		for (int i = 0; i < triangleVert.length; i++)
+			Matrix.setLookAtM(mViewMatrix[i], 0, eyeX, eyeY, eyeZ, lookX, lookY, lookZ, upX, upY, upZ);
+        
+		final String vertexShader =
+				"uniform mat4 u_MVPMatrix;      \n"		// A constant representing the combined model/view/projection matrix.
+			  + "attribute vec4 a_Position;     \n"		// Per-vertex position information we will pass in.
+			  + "attribute vec4 a_Color;        \n"		// Per-vertex color information we will pass in.			  
+			  + "varying vec4 v_Color;          \n"		// This will be passed into the fragment shader.
+			  + "void main()                    \n"		// The entry point for our vertex shader.
+			  + "{                              \n"
+			  + "   v_Color = a_Color;          \n"		// Pass the color through to the fragment shader. 
+			  											// It will be interpolated across the triangle.
+			  + "   gl_Position = u_MVPMatrix   \n" 	// gl_Position is a special variable used to store the final position.
+			  + "               * a_Position;   \n"     // Multiply the vertex by the matrix to get the final point in 			                                            			 
+			  + "}                              \n";    // normalized screen coordinates.
+
+			final String fragmentShader =
+				"precision mediump float;       \n"		// Set the default precision to medium. We don't need as high of a											// precision in the fragment shader.				
+			  + "varying vec4 v_Color;          \n"		// This is the color from the vertex shader interpolated across the 
+			  											// triangle per fragment.			  
+			  + "void main()                    \n"		// The entry point for our fragment shader.
+			  + "{                              \n"
+			  + "   gl_FragColor = v_Color;     \n"		// Pass the color directly through the pipeline.		  
+			  + "}                              \n";												
+
+    	   
+        int vertexShaderHandle = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
+		// Pass in the shader source.
+		GLES20.glShaderSource(vertexShaderHandle, vertexShader);
+
+		// Compile the shader.
+		GLES20.glCompileShader(vertexShaderHandle);
+
+		// Get the compilation status.
+		final int[] compileStatus1 = new int[1];
+		GLES20.glGetShaderiv(vertexShaderHandle, GLES20.GL_COMPILE_STATUS, compileStatus1, 0);
+
+		// If the compilation failed, delete the shader.
+		if (compileStatus1[0] == 0) 
+		{				
+			GLES20.glDeleteShader(vertexShaderHandle);
+			vertexShaderHandle = 0;
+		}
+		
+         
+    	int fragmentShaderHandle = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
+		// Pass in the shader source.
+		GLES20.glShaderSource(fragmentShaderHandle, fragmentShader);
+
+		// Compile the shader.
+		GLES20.glCompileShader(fragmentShaderHandle);
+
+		// Get the compilation status.
+		final int[] compileStatus2 = new int[1];
+		GLES20.glGetShaderiv(fragmentShaderHandle, GLES20.GL_COMPILE_STATUS, compileStatus2, 0);
+
+		// If the compilation failed, delete the shader.
+		if (compileStatus2[0] == 0) 
+		{				
+			GLES20.glDeleteShader(fragmentShaderHandle);
+			fragmentShaderHandle = 0;
+		}
+
+        
+        int mProgram = GLES20.glCreateProgram();
+		// Bind the vertex shader to the program.
+		GLES20.glAttachShader(mProgram, vertexShaderHandle);			
+
+		// Bind the fragment shader to the program.
+		GLES20.glAttachShader(mProgram, fragmentShaderHandle);
+
+		// Bind attributes
+		GLES20.glBindAttribLocation(mProgram, 0, "a_Position");
+		GLES20.glBindAttribLocation(mProgram, 1, "a_Color");
+
+		// Link the two shaders together into a program.
+		GLES20.glLinkProgram(mProgram);
+
+		// Get the link status.
+		final int[] linkStatus = new int[1];
+		GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linkStatus, 0);
+
+		// If the link failed, delete the program.
+		if (linkStatus[0] == 0) 
+		{				
+			GLES20.glDeleteProgram(mProgram);
+			mProgram = 0;
+		}
+		
+		for (int i = 0; i < triangleVert.length; i++)
+		{
+			mMatrixHandle = GLES20.glGetUniformLocation(mProgram, "u_MVPMatrix");        
+	        mPositionHandle = GLES20.glGetAttribLocation(mProgram, "a_Position");
+	        mColorHandle = GLES20.glGetAttribLocation(mProgram, "a_Color");
+		}
+        
+        // Add program to OpenGL environment
+        GLES20.glUseProgram(mProgram);
+    }
+    
+    public void onSurfaceChanged(GL10 unused, int width, int height) 
+    {
         // Adjust the viewport based on geometry changes,
         // such as screen rotation
         GLES20.glViewport(0, 0, width, height);
-    }
-
-    public static int loadShader(int type, String shaderCode){
-
-        // create a vertex shader type (GLES20.GL_VERTEX_SHADER)
-        // or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
-        int shader = GLES20.glCreateShader(type);
-
-        // add the source code to the shader and compile it
-        GLES20.glShaderSource(shader, shaderCode);
-        GLES20.glCompileShader(shader);
-
-        return shader;
+        
+		// Create a new perspective projection matrix. The height will stay the same
+		// while the width will vary as per aspect ratio.
+		final float ratio = (float) width / height;
+		
+		mProjectionMatrix = new float[triangleVert.length][16];
+		for (int i = 0; i < triangleVert.length; i++)
+			Matrix.frustumM(mProjectionMatrix[i], 0, -ratio*1.4f, ratio*1.4f, -1.4f, 1.4f, 1.4f, 14f);
+    }
+    
+    public void onDrawFrame(GL10 glUnused) 
+    {
+    	// Draw background color
+    	GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
+    	
+    	mModelMatrix = new float[triangleVert.length][16];
+        // Draw the triangle facing straight on.
+    	for (int i = 0; i < triangleVert.length; i++)
+    		Matrix.setIdentityM(mModelMatrix[i], 0);
+    		
+    	mMVPMatrix = new float[triangleVert.length][16];
+    	draw(triangleVert); 
+
+    }
+
+    private void draw(final FloatBuffer[] aTriangleBuffer)
+    {
+    	for (int i = 0; i < aTriangleBuffer.length; i++)
+    	{
+	        // Pass in the position information
+	        aTriangleBuffer[i].position(mPositionOffset);
+	        GLES20.glVertexAttribPointer(mPositionHandle, mPositionDataSize, GLES20.GL_FLOAT, false,
+	                				     mStrideBytes, aTriangleBuffer[i]);
+	        
+	        GLES20.glEnableVertexAttribArray(mPositionHandle);
+	     
+	        
+	        // Pass in the color information
+	        aTriangleBuffer[i].position(mColorOffset);
+	        GLES20.glVertexAttribPointer(mColorHandle, mColorDataSize, GLES20.GL_FLOAT, false,
+	                					 mStrideBytes, aTriangleBuffer[i]);
+	        
+	        GLES20.glEnableVertexAttribArray(mColorHandle);
+	        
+	        Matrix.setRotateM(mModelMatrix[i], 0, mAngle, 0, 0, -1.0f);
+
+			// This multiplies the view matrix by the model matrix, and stores the result in the MVP matrix
+	        // (which currently contains model * view).
+	        Matrix.multiplyMM(mMVPMatrix[i], 0, mViewMatrix[i], 0, mModelMatrix[i], 0);
+	        
+	        // This multiplies the modelview matrix by the projection matrix, and stores the result in the MVP matrix
+	        // (which now contains model * view * projection).
+	        Matrix.multiplyMM(mMVPMatrix[i], 0, mProjectionMatrix[i], 0, mMVPMatrix[i], 0);
+	        
+	        GLES20.glUniformMatrix4fv(mMatrixHandle, 1, false, mMVPMatrix[i], 0);
+	        
+	        // Draw the triangle
+	        GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
+	        
+	        // Disable vertex array
+	        GLES20.glDisableVertexAttribArray(mPositionHandle);
+    	}
     }
 
 }
-
-class Triangle 
-{
-
-    private final String vertexShaderCode =
-        "attribute vec4 vPosition;" +
-        "void main() {" +
-        "  gl_Position = vPosition;" +
-        "}";
-
-    private final String fragmentShaderCode =
-        "precision mediump float;" +
-        "uniform vec4 vColor;" +
-        "void main() {" +
-        "  gl_FragColor = vColor;" +
-        "}";
-
-    private final FloatBuffer vertexBuffer;
-    private final int mProgram;
-    private int mPositionHandle;
-    private int mColorHandle;
-
-    // number of coordinates per vertex in this array
-    static final int COORDS_PER_VERTEX = 3;
-    float triangleCoords[] ; /*){ // in counterclockwise order:
-         0.0f,  0.6f, 0.0f,   // top
-        -0.5f, -0.3f, 0.0f,   // bottom left
-         0.5f, -0.3f, 0.0f};  */ // bottom right
-         
-        /* -0.55f, -0.35f, 0.0f,
-         0.0f, -1.2f, 0.0f,
-         0.55f,  -0.35f, 0.0f
-    };*/
-    
-    private final int vertexCount = 9 / COORDS_PER_VERTEX;
-    private final int vertexStride = COORDS_PER_VERTEX * 4; // bytes per vertex
-
-    // Set color with red, green, blue and alpha (opacity) values
-    float color[];
-    //private final FloatBuffer colorBuffer;
-    private final int colorCount = 4/COORDS_PER_VERTEX;
-    
-    public Triangle() 
-    {
-        // initialize vertex byte buffer for shape coordinates
-        ByteBuffer bb = ByteBuffer.allocateDirect(
-                // (number of coordinate values * 4 bytes per float)
-                triangleCoords.length * 4);
-        // use the device hardware's native byte order
-        bb.order(ByteOrder.nativeOrder());
-
-        // create a floating point buffer from the ByteBuffer
-        vertexBuffer = bb.asFloatBuffer();
-        // add the coordinates to the FloatBuffer
-        vertexBuffer.put(triangleCoords);
-        // set the buffer to read the first coordinate
-        vertexBuffer.position(0);
-
-        /*ByteBuffer bb1 = ByteBuffer.allocateDirect(color.length*4);
-        bb1.order(ByteOrder.nativeOrder());
-        colorBuffer = bb1.asFloatBuffer();
-        colorBuffer.put(color);
-        colorBuffer.position(0);*/
-        
-        //GLES20.glEnableVertexAttribArray(1);
-        //GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, colorBuffer);
-        
-        // prepare shaders and OpenGL program
-        int vertexShader = MyGLRenderer.loadShader(GLES20.GL_VERTEX_SHADER,
-                                                   vertexShaderCode);
-        int fragmentShader = MyGLRenderer.loadShader(GLES20.GL_FRAGMENT_SHADER,
-                                                     fragmentShaderCode);
-
-        mProgram = GLES20.glCreateProgram();             // create empty OpenGL Program
-        GLES20.glAttachShader(mProgram, vertexShader);   // add the vertex shader to program
-        GLES20.glAttachShader(mProgram, fragmentShader); // add the fragment shader to program
-        GLES20.glLinkProgram(mProgram);                  // create OpenGL program executables
-    }
-    public Triangle(float x1, float y1, float z1,
-    			    float x2, float y2, float z2,
-    			    float x3, float y3, float z3,
-    			    float c1, float c2, float c3, float c4) 
-    {
-    	triangleCoords = new float[9];
-    	color = new float[4];
-    	triangleCoords[0] = x1;
-    	triangleCoords[1] = y1;
-    	triangleCoords[2] = z1;
-    	triangleCoords[3] = x2;
-    	triangleCoords[4] = y2;
-    	triangleCoords[5] = z2;
-    	triangleCoords[6] = x3;
-    	triangleCoords[7] = y3;
-    	triangleCoords[8] = z3;
-    	color[0] = c1;
-    	color[1] = c2;
-    	color[2] = c3;
-    	color[3] = c4;
-        // initialize vertex byte buffer for shape coordinates
-        ByteBuffer bb = ByteBuffer.allocateDirect(
-                // (number of coordinate values * 4 bytes per float)
-                triangleCoords.length * 4);
-        // use the device hardware's native byte order
-        bb.order(ByteOrder.nativeOrder());
-
-        // create a floating point buffer from the ByteBuffer
-        vertexBuffer = bb.asFloatBuffer();
-        // add the coordinates to the FloatBuffer
-        vertexBuffer.put(triangleCoords);
-        // set the buffer to read the first coordinate
-        vertexBuffer.position(0);
-
-        /*ByteBuffer bb1 = ByteBuffer.allocateDirect(color.length*4);
-        bb1.order(ByteOrder.nativeOrder());
-        colorBuffer = bb1.asFloatBuffer();
-        colorBuffer.put(color);
-        colorBuffer.position(0);*/
-           
-        // prepare shaders and OpenGL program
-        int vertexShader = MyGLRenderer.loadShader(GLES20.GL_VERTEX_SHADER,
-                                                   vertexShaderCode);
-        int fragmentShader = MyGLRenderer.loadShader(GLES20.GL_FRAGMENT_SHADER,
-                                                     fragmentShaderCode);
-
-        mProgram = GLES20.glCreateProgram();             // create empty OpenGL Program
-        GLES20.glAttachShader(mProgram, vertexShader);   // add the vertex shader to program
-        GLES20.glAttachShader(mProgram, fragmentShader); // add the fragment shader to program
-        GLES20.glLinkProgram(mProgram);                  // create OpenGL program executables
-    }
-
-    public void draw() 
-    {
-        // Add program to OpenGL environment
-        GLES20.glUseProgram(mProgram);
-
-        // get handle to vertex shader's vPosition member
-        mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
-
-        // Enable a handle to the triangle vertices
-        GLES20.glEnableVertexAttribArray(mPositionHandle);
-
-        // Prepare the triangle coordinate data
-        GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
-                                     GLES20.GL_FLOAT, false,
-                                     vertexStride, vertexBuffer);
-
-        // get handle to fragment shader's vColor member
-        mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");
-
-        // Set color for drawing the triangle
-        //GLES20.glUniform4fv(mColorHandle, 0, color, 0);
-        //GLES20.glVertexAttrib4f(0, 0.5f, 0.5f, 0.0f, 1.0f);
-        //GLES20.glVertexAttribPointer(mPositionHandle, 4, GLES20.GL_FLOAT, false, stride, offset)
-        GLES20.glUniform4fv(mColorHandle, 1, color, 0);
-        // Draw the triangle
-        GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);
-    }
-}
Index: /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/MyGLSurfaceView.java
===================================================================
--- /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/MyGLSurfaceView.java	(revision 14072)
+++ /issm/trunk-jpl/src/android/ISSM_Visual/src/com/example/issm_visual/MyGLSurfaceView.java	(revision 14073)
@@ -3,19 +3,80 @@
 import android.content.Context;
 import android.opengl.GLSurfaceView;
+import android.view.MotionEvent;
 
 
-class MyGLSurfaceView extends GLSurfaceView {
-
-    public MyGLSurfaceView(Context context) {
+class MyGLSurfaceView extends GLSurfaceView 
+{
+	private MyGLRenderer mRend;
+    public MyGLSurfaceView(Context context) 
+    {
         super(context);
 
         // Create an OpenGL ES 2.0 context.
         setEGLContextClientVersion(2);
+        
+        final int NMAX_TRIANGLES = 2000;
+        final int MAX_VERTICES = 21;
+        
+        float f[][] = new float[NMAX_TRIANGLES][MAX_VERTICES];
+        int n, random;
+		for (int i = 0; i < f.length; i++)
+		{
+			for (int j = 0; j < MAX_VERTICES; j++)
+			{
+				if (j == 6 || j == 13 || j == 20) continue;
+				n = 1;
+		        random = (int)(Math.floor((Math.random()*10)+1));
+		        if (random <= 5) n = -1;
+		        
+				f[i][j] = (float)(Math.random()*n);
+			}
+		}
 
+        mRend = new MyGLRenderer(f);
+        
         // Set the Renderer for drawing on the GLSurfaceView
-        setRenderer(new MyGLRenderer());
+        setRenderer(mRend);
 
         // Render the view only when there is a change in the drawing data
         setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
     }
+    
+    private final float TOUCH_SCALE_FACTOR = 180.0f / 320;
+    private float mPreviousX;
+    
+    private float mPreviousY;
+    @Override
+    public boolean onTouchEvent(MotionEvent e) {
+        // MotionEvent reports input details from the touch screen
+        // and other input controls. In this case, you are only
+        // interested in events where the touch position changed.
+
+        float x = e.getX();
+        float y = e.getY();
+
+        switch (e.getAction()) {
+            case MotionEvent.ACTION_MOVE:
+
+                float dx = x - mPreviousX;
+                float dy = y - mPreviousY;
+
+                // reverse direction of rotation above the mid-line
+                if (y > getHeight() / 2) {
+                  dx = dx * -1 ;
+                }
+
+                // reverse direction of rotation to left of the mid-line
+                if (x < getWidth() / 2) {
+                  dy = dy * -1 ;
+                }
+
+                mRend.mAngle += (dx + dy) * TOUCH_SCALE_FACTOR;  // = 180.0f / 320
+                requestRender();
+        }
+
+        mPreviousX = x;
+        mPreviousY = y;
+        return true;
+    }
 }
