Mapping 2D image texture to a triangulated model


I have a ray tracer code. It runs fine and produces correct scene (of a triangulated model) without any textures.

Can anybody tell me how to map 2D texture images onto the scene, in CUDA, with different materials corresponding to different textures?

PS : I am not using OpenGL for displaying. I calculate colour values and generate a PPM image.