Graphics Programs Reference
Here, we finally discuss the functioning of an application that updates the rendering
on an OpenGL surface using a layout (that we just created). To load that application
into your workspace, import the archive file updowncounter.zip from the
the layout folder, you will see the files updown.xml and counter.xml . The
updown.xml file contains the layout from the previous topic. However, now the
buttons contain ids “up” and “down” defined in the id.xml file (inside res/values
folder), which also contains another id “counter,” corresponding to the TextView
basic styling applied to it.
Buttons are assigned ids so they can be referenced from the Activity defined in
Main.java file. This application contains the Renderer class from the previous ap-
plication with slight modifications.
This application uses an important class Counter (this class will also be used in the
Tank Fence game) to track the number of clicks on the up and down buttons. (The