Jump to content
  • Advertisement
Sign in to follow this  
SystemFiles

I want to make something like: GetPixelColor

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

Oke I need a function to get the color of a pixel I want to get the pixel with X and Y. Something like this: D3DCOLOR CColors::GetPixelColor( FLOAT X, FLOAT Y ) { return PixelColor; } You got some links/msdn/tutorials for me or a complete function :D Thanks!

Share this post


Link to post
Share on other sites
Advertisement
you can access any surface/texture after locking and unlocking it on the graphicscard like you would access any other array. the bits you expect to be in the array may vary depending on the format. if you want to access a pixel color of the whole rendered frame you could render it to a target surface and access that!

greets flery

random discussion on the topic: http://windows-tech.info/5/778c98873046f5f3.php

Share this post


Link to post
Share on other sites
It's worth noting that doing it this way is extremely slow. And if you're using this to access the backbuffer, expect your app to be running at X seconds per frame rather than X frames per second.

Locking a resource is a pretty expensive thing to do - you should lock the resource ONCE, read multiple pixel values, and then unlock it.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!