Reputation: 2607
You can disable texture wrapping in a webgl texture ala
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
If the texture is the same size as the render target, is there any particular advantage to doing this? Are there any performance reasons to do so?
If it matters, here I'm particularly interested in just rendering textures on 2D billboards.
Upvotes: 0
Views: 1666
Reputation: 54642
Functionally, the only reason to change it is that there might be a subtle difference at the edge of the rendered texture if you use linear filtering. For example on the right side of the texture, if wrap is set to REPEAT, the linear filtering would interpolate between the colors of the rightmost and leftmost texels at the edge. With CLAMP_TO_EDGE, it uses the color of the rightmost texels.
Performance should be identical. The only time there could potentially be a performance difference for wrap modes is if the GPU does not natively support one of the modes, and has to emulate it in shader code. But any GPU that is not completely ancient should support both these modes.
I would normally set the values to CLAMP_TO_EDGE unless you specifically need the repeating behavior.
Upvotes: 1