I have a array texture of which I would like some of its sub-images have wrap modes of GL_REPEAT and others to be GL_CLAMP_TO_EDGE.
From my research, I haven't found a clear answer. It appears Sampler Objects may be what I'm looking for, however I'm unsure as to how to go about implementing this.
As current I have a sampler class which looks like this:
class TextureSampler {
public:
unsigned int id;
TextureSampler();
TextureSampler(unsigned int wrapS, unsigned int wrapT, unsigned int filterMin, unsigned int filterMag);
~TextureSampler();
void bind(unsigned int textureId);
void unbind(unsigned int textureId);
};
As you can expect the constructor simply sets all the wrap and filter parameters.
I bind with this glBindSampler(textureId, id);. The textureId being that from glGenTextures() and the id from glGenSamplers().
Now when it comes to my implementation, I've created two samplers, one for repeating wrap mode and another for edge clamping. This is where things are a bit murky. I've got two samplers, one texture array... it doesn't seem possible to bind both samplers at the same time and yet how do I access both types in the fragment shader? Google has not been much help and I've read parts of the ARB_sampler_objects extension to see if it had useful information and it seemed to say ...
- Should sampler objects be made visible to the shading language. This is left for a future extension.
I am using GL 4.3, so this is extension is not built-in, however that quote leaves me wondering if I've approached this all wrong. What is the correct approach to this? Is this possible with a single texture array?