Archived

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

Reading greyscale values of a bitmap file into an array

This topic is 5004 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

Hello. I have a 1024 by 1024 8 bit greyscale bitmap. I can load it into my program to view it, etc. I have it as a texture. But... How do I get the dark / light values in the texture? I need to store them into an array to use them as a heightmap. Otherwise, how do I read all of the rgb value into an array instaed? (perhaps I will use red for height, green for texture, and blue for shadow mapping) Anyway, please let me know how to do this. Thanks.

Share this post


Link to post
Share on other sites
IDirect3DTexture9::LockRect This will let you get all all of the RGB data, all contained in a (mostly) simple array. The most complicated part is dealing with the pitch (bytes per row), and that isn''t really complicated anyway. So basically, it''s quite easy.

Share this post


Link to post
Share on other sites