bindTexture method
Implementation
void bindTexture(
UniformSlot slot,
Texture texture, {
SamplerOptions? sampler,
}) {
if (sampler == null) {
sampler = SamplerOptions();
}
_validateBindableTexture(texture);
sampler._validate();
int uniformTextureIndex = slot._resolvedTextureIndex;
if (uniformTextureIndex < 0) {
throw Exception(
"Failed to bind texture (no texture named '${slot.uniformName}')",
);
}
bool success = _bindTextureIndexed(
slot.shader,
uniformTextureIndex,
texture,
sampler.minFilter.index,
sampler.magFilter.index,
sampler.mipFilter.index,
sampler.widthAddressMode.index,
sampler.heightAddressMode.index,
sampler.maxAnisotropy,
);
if (!success) {
throw Exception("Failed to bind texture");
}
}