Jump to content
  • Advertisement
Sign in to follow this  
EFileTahi-A

Managed DX - C# - Pixel collision

This topic is 3821 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 need to return the pixel color of my backbuffer from a given x,y position, but I don't have a clue how to do it. well, I know I have to get the buffer from the device: Surface s = myDXDevice.GetBackBuffer(); And then lock the surface and use pointers... but how? This is C#. Thank you

Share this post


Link to post
Share on other sites
Advertisement
copying the backbuffer from the GPU is going to be expensive. The solution is to just not do it! If you want pixel perfect collision in 2D space, I suggest you do a simple bounding box collision test and then do a more accurate pixel collision if necessary. You don't want to be polling the backbuffer at runtime.

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!