Graphics Programs Reference
In-Depth Information
updateModel(Counter.getUpDownValue(),
GLES20Renderer._zAngle);
if(GLES20Renderer._missiles.size() > 0) {
initMissiles();
}
renderModel(gl);
endTime = SystemClock.uptimeMillis() % 1000;
deltaTime = Math.abs(endTime - startTime);
if (deltaTime < 20) {
try {
Thread.sleep(20 - deltaTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
The initMissiles Method
In the initMissiles() method ( Listing 6-13 ), we create the required buffers for
the missiles. As you may have guessed it, the buffers created in this method will be
used in the renderModel() method, when glDrawElements() is called to
render the missiles, as shown in Listing 6-14 .
Listing 6-13. TANK FENCE GAME 3/src/com/apress/android/tankfencegame3/
GLES20Renderer.java
private void initMissiles() {
ListIterator<Missile> missileIterator =
_missiles.listIterator();
float[] missilesVFA = new
float[GLES20Renderer._missiles.size() * 3];
short[] missilesISA = new
short[GLES20Renderer._missiles.size()];
int vertexIterator = -1;
short indexIterator = -1;
while(missileIterator.hasNext()) {
 
 
 
Search WWH ::




Custom Search