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
If you are using vertex arrays and shaders, your vertices (v) can be indexed and stored in an element array buffer and your texture coordinates should be pass to the vertex shader to be send and used by the fragment shader. I recommend you to visit the site https://learnopengl.com/.