I want to make something like: GetPixelColor

Started by
2 comments, last by Evil Steve 14 years, 1 month ago
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!
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
Omg you guys know to much xD
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.

This topic is closed to new replies.

Advertisement