Jump to content
  • Advertisement
Sign in to follow this  

Pixel Data from Sprites in Direct3D9?

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

How do I access pixel data from either sprites or textures in Direct3D9, June SDK Release? I wish to do some per-pixel collision detection on my 2D objects. Thanks, John Sedlak

Share this post

Link to post
Share on other sites
I think I should have mentioned I am using C#, the site is helping a bit, but I am stuck here...

private static void CheckSlow(object obj1, object obj2)
Texture temp1, temp2;
Rectangle rect1, rect2;
int pitch1, pitch2;

temp1 = ((IDrawable)obj1).GetTexture();
temp2 = ((IDrawable)obj2).GetTexture();

temp1.LockRectangle(0, rect1, LockFlags.Discard, pitch1);
temp2.LockRectangle(0, rect2, LockFlags.Discard, pitch2);

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!