How to perform Mipmapping in WebGL?

I am learning WebGL and reading the book "WebGL Programming Guide". However, the book omitted the topic of mipmapping textures. I tried to find the official OpenGL ES website, but it seems I couldn’t get the answer to my question. None of them asked a similar question in StackOverflow.

Can someone show me, from the very beginning to the end, how to mipmapping textures in WebGL?

+4
source share
1 answer

In WebGL, you can load the mip maps manually - whatever the parameter levelis in gl.texImage2D- or you can just load level 0, and then use gl.generateMipmapthem to be generated for you.

mip , gl.texParameteri, gl.TEXTURE_MIN_FILTER of gl.NEAREST_MIPMAP_LINEAR ( ), gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST gl.LINEAR_MIPMAP_LINEAR.

Mip.

, , gl.generateMipmap(gl.TEXTURE_2D) , , gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR).

+8

Source: https://habr.com/ru/post/1525142/


All Articles