Pro OpenGL ES for iOS

(singke) #1

26 CHAPTER 1: Computer Graphics: From Then to Now^


The only other section is that which handles the loading and using of the shaders. This
process is to load them first in memory, compile, and then link them. If all works as
planned, they can be turned on with the call to glUseProgram() above.
One of the files, Shader.vsh, intercepts the vertices as the hardware starts processing
them, while the other, Shader.fsh, in effect lets you play with each individual pixel before
it’s sent to the display hardware.

Tweak and Tweak Some More
Whenever I learn some new technology, I start tweaking the values to see what
happens. If it happens the way I expect, I feel as if I’ve just acquired a new super-power.
So, let’s play here.
Let’s tweak a couple of the values just for kicks. First, go to the gCubeVertexData a few
pages up, and change the very first value from 0.0 to 1.0. What do you think you’ll see?
How about Figure 1-10?

Figure 1-10. With one vertex moved out.
Free download pdf