Domanda

I would like to access different levels of detail in my GLSL fragment program. I'm currently stuck with using legacy OpenGL, including GLSL 1.2. Unfortunately, I don't have control over that.

I see that the texture2DLod() method exists, but it appears it can only be used in a vertex program.

I have read this question, but they appear to be working with GLSL 1.4 or later. Unfortunately, I do not have that option.

Is there any way in a GLSL 1.2 fragment program to sample a specific mipmap level?

If there's no function for doing it directly, is it possible to send the mipmaps in as separate textures without doing 8 copies?

È stato utile?

Soluzione

It is not possible for a fragment shader (in GLSL 1.20) to access a specific texture mipmap. However, you can always change the base/max mipmap levels of a texture before you use it. By setting them both to the same level, you force any texture accesses from that texture to use a specific mipmap level.

Now, you can't make these separate textures (unless you're using NVIDIA hardware and have access to ARB_texture_view). So you'll have to live with changing the texture's base/max level every time you want to pick a new mipmap.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top