Enabling Texturing

There's one more thing before we can draw our triangle with the texture. We need to bind the texture, and we need to tell OpenGL ES that it should actually apply the texture to all triangles we render. Whether texture mapping is performed or not is another state of OpenGL ES, which we can enable and disable with the following methods:

GL10.glEnable(GL10.GL_TEXTURE_2D); GL10.glDisable(GL10.GL_TEXTURE_2D);

These look vaguely familiar. When we enabled/disabled vertex attributes in the previous sections, we used glEnableClientState()/glDisableClientState(). As I said earlier, those are relics from the infancy of OpenGL itself. There's a reason why those are not merged with glEnable()/glDisable(), but we won't go into that here. Just remember to use glEnableClientState()/glDisableClientState() to enable and disable vertex attributes, and use glEnable()/glDisable() for any other states of OpenGL, such as texturing.

0 0

Post a comment