tsherif/picogl.js

Texture constructor options.generateMipmaps is ignored

Closed this issue · 1 comments

Hello!,
It seems the generateMipmaps option is ignored in the Texture constructor.
I think this line:

this.mipmaps = (minFilter === CONSTANTS.LINEAR_MIPMAP_NEAREST || minFilter === CONSTANTS.LINEAR_MIPMAP_LINEAR);

Should also check options.generateMipmaps.

(just in case; I'm creating a texture from a Float32Array, giving type, internalFormat and generateMipmaps :false)

The generateMipMaps option is no longer supported directly. I see that it's still mentioned in the documentation, so I'll fix that.

The relevant line for mipmap generation is this one:

let generateMipmaps = this.mipmaps && data.length === 1;

Basically, if you only pass one layer and use a min filter that requires mip maps, the mip maps will automatically be generated. So for your case, passing minFilter: PicoGL.LINEAR when creating the texture will prevent generation of mipmaps.