Jump to content
  • Advertisement
Sign in to follow this  
skcin7

How to get PIXEL INFORMATION from a LPDIRECT3DTEXTURE9?

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

A friend and I are making a very simple Arkanoid-style 2 dimensional game with DirectX 9. All sprites are created as bitmaps, and we use LPDIRECT3DTEXTURE9 to load the bitmaps into the program. We have encountered a problem because many of our sprites have rounded edges, and we need to develop a precise method of collision detection. For sprites with rounded edges, we use the RGB value 255,0,255 for transparency, and we need to know which pixels of each texture are transparent or not. How can you get the pixel information from a LPDIRECT3DTEXTURE9 texture?

Thank you in advance for any help you may provide. We are seriously stumped and no information online seems to have helped us thus far.

Share this post


Link to post
Share on other sites
Advertisement
It's also worth noting that it's usually a bad idea to use the graphics used for rendering in collision detection because locking the texture can be potentially slow. It'd be best to lock the texture once (at load time), and store a bitmask of the collision (So 8 pixels worth of collision information in 1 byte).

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net 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!