Graphics Programs Reference
In-Depth Information
2,3,1,
0,2,1,
Similarly, the sets of indices from "4,5,1," to "14,10,15," correspond to the
index short array for the Player object. The short array tankISA (in the init-
tank method) is composed of these indices; they have been copied from the “in-
dex:” block. As discussed, the label “size:<NUMBER > ” above this set specifies the
count of indices to be passed as an argument to glDrawElements :
size:84
4,5,1,
..
14,10,15,
The label “size:84” in the “index:” block specifies the count of indices for the
Player object (please note that the Player object is the tank initialized in the init-
tank method). Because of this, in the onDrawFrame method, the following
call is made: GLES20.glDrawElements(GLES20.GL_TRIANGLES, 84,
GLES20.GL_UNSIGNED_SHORT, _tankISB); .
In Figure 4-51 (screen shot from the TANK FENCE ELEMENTS 1 application),
the color of the tank is made yellow by directly writing to the gl_FragColor
shader variable— gl_FragColor = vec4(1.0,1.0,0.0,1); . Instead of dir-
ectly writing to this variable, the application TANK FENCE ELEMENTS 2 includes
the per-vertex colors copied from the “color:” block at the bottom of
tankFence5.txt file (recall that, while modeling the tank, we colored it
blue— Figure 4-35 ) . By now, you should understand the kind of shader variables used
for this purpose—an attribute variable (say aColor ) and a varying variable (say
vColor ), each of type vec4 . The TANK FENCE ELEMENTS 3 application adds
other objects-Plane and Enemy. It is left as an exercise for you to go through this
application.
Basic Components in the Blender Interface:
Screenshots
 
Search WWH ::




Custom Search