Jump to content
  • Advertisement
Sign in to follow this  
vbuser1338

2d coords to 1d coords

This topic is 4897 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 am having troubles of trying to create a formula that takes 2-d coords and turn them into 1-d array coords. I know for simple one it would be i = x +(y * arraywidth) but I need one that will get the alpha value out of a texture. So when I go 0 , 0 it will give me index 3,the byte in which the first alpha value is in. Then when I get 1,0 it would give me 7. Do you get what I mean. I can't seem to get one made. The closest I got was working for the first row of y's but then when I go to the next row like 0,1 it won't work. Can someone please help me out with this math? Thanks, vbuser

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • 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!