View Full Version : texture2D vs textureLOD
01-20-2012, 06:38 AM
Can anybody explain me in short what is the difference between texture2D and textureLod, and when one should be preferred over the other?
01-20-2012, 06:54 AM
texture2D has been deprecated in favor of texture. However, if you are targeting GLSL 1.10 , you can still use texture2D.
texture2D is used in the fragment shader.
textureLod is used in the vertex shader since the derivatives are not computed. There are no derivatives because a vertex is just a point. You need to select the mipmap yourself.
Some texture functions (non-“Lod” and non-“Grad” versions) may require implicit derivatives. Implicit
derivatives are undefined within non-uniform control flow and for vertex shader texture fetches.
01-20-2012, 10:13 AM
Ok, and what is mipmap? (if this question is too stupid fell free not to answer...).
01-20-2012, 12:48 PM
Please read the Texture article on the OpenGL Wiki (http://www.opengl.org/wiki/Texture).
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.