How do I use texture coordinates of a .obj file in OpenGL? I have an obj file, with texture coordinates (indicated by vt). How would I use this to load textures in OpenGL?
The OBJ file itself doesn't contain the texture, only the texture co-ordinates (which describe how to map a texture onto the surface of the mesh.) The texture is an image file (such as a PNG) whose path is given by the accompanying .mtl file. You need to parse the .mtl file to get the path to the image file, then use an image-loading library (such as DevIL) to load the image into memory. Once you have the pixels of the image, you can use glTexImage2D to load that image into a texture, which can be accessed from your fragment shader using a sampler2D.