Sampling a texel array

Hi all,

I am trying to sample 2048x2048 lightmap texture, I get the texels into an unsigned char * before uploading the texture to vram, I now have the raw pixels to play with.
I want to sample these texels in my loop so I raycast the mesh find a uv coord using barycentric coordinates. Now I want to sample the texels using that uv coord.