Advertisement Jump to content
Sign in to follow this  

2d coords to 1d coords

This topic is 4989 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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!