Per-Texture Unit Parameters

Is there any way I can do multi-texturing in a shader, but still have the parameters effect per-texture unit?

Here’s my code so far, if this isn’t possible, then I don’t mind hard-coding a linear interpolation filter in the shader code itself by uniforms.


setParametei(this.getTarget(), GL11.GL_TEXTURE_MAG_FILTER, filter);
setParametei(this.getTarget(), GL11.GL_TEXTURE_MIN_FILTER, filter);

setParametei(this.getTarget(), GL11.GL_TEXTURE_WRAP_S, clamp);
setParametei(this.getTarget(), GL11.GL_TEXTURE_WRAP_T, clamp);

GL13.glActiveTexture(GL13.GL_TEXTURE0 + unit);
GL11.glBindTexture(target, textureID);

ja. u could use sampler-objects for that.

https://www.opengl.org/wiki/Sampler_Object

  • bind same texture to multiple pipes, say 1 2 3.

  • bind a sampler (for instance linear sampling) object to pipe 1

  • bind another sampler (nearest sampling) to pipe 2

  • bind another sampler (st-repeat or something) to pipe 3

  • assign uniforms :

shader.uniform("tex_linear", 1);
shader.uniform("tex_nearest", 2);
shader.uniform("tex_repeat", 3);
  • in the shader use :
uniform sampler2D tex_linear;
uniform sampler2D tex_nearest;
uniform sampler2D tex_repeat;

tho’ maybe i just missed what you’re looking for.

I meant multiple textures being bound at once, with different texture units, with different parameters. So far it isn’t working. Multi texturing is, but not setting the parameters.

if you mean parameter which are available through sampler-objects, it should work.

Yeah, but it’s not working so far, it seems that the parameters of the texture I’m binding only effect the texture bound before.