Using the same texture buffer multiple times with different parameters
I have a texture which I'm using at multiple instances throughout my program.
At each instance I'm applying different texture parameters, which would effectively overwrite each other and generally just cause each other problems.
Is there a way to have multiple texture buffers pointing to the same texture, but with different parameters?
Or what would be the best way of proceeding without having to copy the entire texture?
Any help would be appreciated.
You can either set different sampler objects (see glGenSamplers and friends) while keeping your texture bound (parameters on the sampler object take precedence over those set on the texture) or use texture views (see glTextureView) to share the storage.
Samplers (OpenGL 3.3 and higher) allow you to store the sampling state (filter modes, wrap modes, min/max LoD, LoD bias, compare function/mode and border colour) separately from the texture. When a sampler is bound to a texture unit, the sampler state overrides the equivalent state stored in the texture.
Originally Posted by Silverlan
The minimum (base) and maximum mipmap levels and the R/G/B/A swizzle state are properties of the texture itself and can't be overridden via samplers.
Anisotropy filtering is also limited to the texture and can not be set with samplers. Well, it also still is an EXT function.
ARB_sampler_objects clearly says that max anisotropy is per-sampler state.
Originally Posted by Osbios
Tags for this Thread