libgdx/libgdx — pull request #558 by xoppa (2013-09-05 15:20:50+00:00)
Title: Texture, add unsafeSetWrap and unsafeSetFilter (and some other changes)

The glTexParameter values are stored with the texture, but DefaultTextureBinder caches them with the bind unit, resulting into parameters not set (see issue 1650).

The best place to store the texture context (glTexParameter values) would be in the Texture class, but that leads to three problems:
- Texture always (re)binds the texture on setWrap and setFilter
- Texture always sets the parameter, even if its the same
- Texture forces you to use the TextureWrap and TextureFilter enums

For the first two problems I added the unsafeSetWrap and unsafeSetFilter methods, which assumes the texture is already bound and compares the previous value to avoid unneeded GL calls.

For the third problem I changed TextureDescriptor to use the TextureWrap and TextureFilter enums. Which I think for those values is fine. I haven't looked into other values yet (swizzle etc.).

On a side note: I can see how this can cause other problems e.g. when using 3d or depth textures (it might require DepthComponent (and consorts) to be added to the Format enum of Pixmap and perhaps the Gdx2DPixmap equivalent). I haven't looked in depth into this.