how do i retrieve a color from a texture map?
I''m trying to implement texture mapping similar to gouraud shading but I''m a bit confused. I have an array of unsigned char in which the texture map is stored, say
texture = new unsigned [width*height*3];
After I calculate the coordinates (s,t) after interpolation of the texture coordinates, and I want to look up the color at (s,t) would my color be texture[width*height*s]? That doesn''t seem to work. Any help or insight would be appreciated.
s and t are the x,y coordinates on the textures'' axis, so s == x, and t == y.
"texture[s+t*textureWidth]" would give you the first of your three bytes in the texture map...
hope this helps
"texture[s+t*textureWidth]" would give you the first of your three bytes in the texture map...
hope this helps
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement