Mipmap and GLSL question

I have a quite simple question about using mipmaps and glsl. Just for the record, I never used mipmaps before, but I need to use in my project since I have a quite big textures.

I already know how to load mipmaps textures etc. My question is, inside GLSL, do I need to always use textureLod function or using texture2D will calculate the optimal lod?

It’s not a matter of picking between textureLod and texture2D. textureLod is from GLSL 1.30 and above; texture2D is from before 1.30 and shouldn’t be used in 1.30 or better shaders. The choice is between textureLod and texture.

Also it’s not a choice, because they do two different things. textureLod is for you specifically picking an LOD to sample from. texture is for when you want OpenGL to pick the LOD for you. You use them for two different things. Unless you have a real need to write an LOD algorithm, you should be using texture.

thank you very much, this was the answer I was looking for.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.