PDA

View Full Version : Using the same texture buffer multiple times with different parameters



Silverlan
10-28-2013, 05:16 AM
Hey,

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.

carsten neumann
10-28-2013, 05:57 AM
You can either set different sampler objects (see glGenSamplers (http://www.opengl.org/sdk/docs/man/xhtml/glGenSamplers.xml) 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 (http://www.opengl.org/sdk/docs/man/xhtml/glTextureView.xml)) to share the storage.

GClements
10-28-2013, 06:09 AM
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?
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.

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.

Osbios
10-28-2013, 06:21 AM
Anisotropy filtering is also limited to the texture and can not be set with samplers. Well, it also still is an EXT function.

arekkusu
10-28-2013, 08:42 AM
Anisotropy filtering is also limited to the texture and can not be set with samplers.
ARB_sampler_objects clearly says that max anisotropy is per-sampler state.