Sign in to follow this  
SystemFiles

I want to make something like: GetPixelColor

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this