Pro OpenGL ES for iOS

(singke) #1

154 CHAPTER 5: Textures^


glTranslatef(0.0f,0.5f,0.0f);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glTranslatef(0.0f,-1.0f,0.0f);

glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_NEAREST);

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisableClientState(GL_VERTEX_ARRAY);

glDisableClientState(GL_TEXTURE_COORD_ARRAY);

if(!(counter%100))
{
if(direction==1.0)
direction=-1.0;
else
direction=1.0;
}

transZ+=(.10*direction);

rotation += 1.0;
counter++;
}
Grab a copy of setClipping() and move it over here, then call it from your initialzation
code in viewDidLoad().
If that compiles and runs OK, you should see something like Figure 5-19.
Free download pdf