Archived

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

mtaber

getting pixel color from a texture

Recommended Posts

I have a question about this. I am creating a hexagonal map, and I need to use a hex map to figure out an ''offset'' to determine exactly which hex in the map array the cursor is on top of. I have a hex mousemap that I''m using, and when I load it as a surface, I can figure out where the cursor is supposed to be just fine. But, I''ve gone and decided that I''d like to load the map as a set of textures so that I can scale it to any size that I want. So far, this has worked well, with the sole exception of determining the offset in the hex housemap. The problem is that when I scale the LPD3DXSPRITE''s that I''m using, I need to figure out how to text the pixels within the texture. Essentially, I have a 64x64 .dds file that is loaded as a texture. Then, I map it over a 32x32 sprite object. This is done for all of the map objects. When I''m testing to see which hex should be highlighted, how do I get the pixel information that is contained within that texture? Essentially, I need to take the 32x32 texture and test a specific pixel color within it. Anyone have any ideas?
Looking for an honest video game publisher? Visit www.gamethoughts.com

Share this post


Link to post
Share on other sites
I''ve been wrestling with the same subject, and found some information. Unfortunately is not as simple as tex[1][2] From what I have read, there''s something called "pitch" which needs to be taken into account when doing these operations. After a while I just decided to pre-generate this information and load it separately. Not the best solution but oh well...

There are 10 kinds of people: those who know binary and those who don''t

Share this post


Link to post
Share on other sites
Can you explain a bit more or maybe give me the links to the resources you were using? Your explanation was a bit more vague that I would have liked. I''ve asked a similar question to this in the past and got absolutely nobody to answer me.


Looking for an honest video game publisher? Visit www.gamethoughts.com

Share this post


Link to post
Share on other sites
I don''t play with textures much but I think you have to lock a rect
or something, I searched the DX9 SDK Docs and I found help, search
for the following keywords "Lock NEAR texture " and you''ll
find some help too.

Hope that helps

KaMiKaZe

Share this post


Link to post
Share on other sites