Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


how do i retrieve a color from a texture map?

This topic is 5962 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!