Once you call glGetTextureHandleARB
to retrieve a handle from a texture, that texture becomes immutable. Not immutable storage, but is completely immutable.
You cannot change any of its parameters. Ever again. There is no undo.
The reason for this is that the handle stores all of the texture's parameters into it internally. So changing those parameters would not affect the handle's copy of them, and allowing such changes to affect every handle that a texture references would cause an undue burden on performance and synchronization.
What you really want is to use glGetTextureSamplerHandleARB
to get a new handle from a texture/sampler pair. So you can create a sampler with whatever sampling parameters you want, then get a new handle for it and the original texture. The sampler's parameters will override those from the texture, and you'll get a new handle out of it that encodes both the texture and sampler's parameters.
Now, you don't want to keep creating handle after handle for these sorts of things. So you should plan out exactly which texture/sampler pairs you need, and create them up-front.