mono/MonoGame — pull request #889 by shilrobot (2012-10-19 23:34:53+00:00)
Title: Fix for issue #847, "SamplerStates aren't properly applied when active texture changes"

What we would consider sampler state in D3D is stored per-texture in GL, so you have to have the correct active texture unit & texture bindings active before you call glTexParameter within SamplerState.Activate().

This change stores the "last SamplerState used" on the Texture instance, to avoid redundant glTexParameter calls.

It's possible this might make some redundant glActiveTexture parameters in cases where you use a single texture with frequently changing sampler states, maybe there is a better way to design this... it would be nice if it was somehow integrated with the related loop in TextureCollection.SetTextures().