Graphics Programs Reference
In-Depth Information
// Matrix.setLookAtM(_ViewMatrix, 0, 0, -20, 50, 0,
0, 0, 0, 1, 0);
Matrix.frustumM(_ProjectionMatrix, 0, -size, size,
-size / ratio, size / ratio, zNear, zFar);
Matrix.multiplyMM(_planeVPMatrix, 0,
_ProjectionMatrix, 0, _ViewMatrix, 0);
System.arraycopy(_planeVPMatrix, 0,
_missilesVPMatrix, 0, 16);
// Matrix.multiplyMM(_missilesVPMatrix, 0,
_ProjectionMatrix, 0, _ViewMatrix, 0);
Matrix.setIdentityM(_tankTMatrix, 0);
Matrix.setIdentityM(_tankRMatrix, 0);
}
Make small changes to the onDrawFrame() method, as shown in Listing 6-12 .
The if blocks before the call to updateModel() method restrict the range of field
_zAngle . Now, we'll start defining the initMissiles() method.
Listing 6-12. TANK FENCE GAME 3/src/com/apress/android/tankfencegame3/
GLES20Renderer.java
public void onDrawFrame(GL10 gl) {
System.gc();
long deltaTime,startTime,endTime;
startTime = SystemClock.uptimeMillis() % 1000;
gl.glClear(GLES20.GL_COLOR_BUFFER_BIT |
GLES20.GL_DEPTH_BUFFER_BIT);
if(GLES20Renderer._zAngle >= 360) {
GLES20Renderer._zAngle = GLES20Renderer._zAngle -
360;
}
if(GLES20Renderer._zAngle <= -360) {
GLES20Renderer._zAngle = GLES20Renderer._zAngle +
360;
}
 
 
Search WWH ::




Custom Search