OpenGL - Texture mapping in the vertex or fragment shader?

advertisements

Is there texture of an object/triangles mapped in the fragment shader or the vertex shader?

Whether if it is on the vertex or fragment shader, if you are programming shaders it's something that you have to code yourself right? Without shader you just assinged the tex coords and opengl mapps it without you knowing, but with shaders you have to do it yourself, right?


Usually the texturing happens in the fragment shader. This is the place where triangle's fragments gain a color.

Usually in the vertex shader you calculate texture coords (or simply pass them through from vertex attribs without special computation).

I wrote usually because right now you can use textures in all shaders: vertex, geometry, tesselation.

See here for further information.