Link to home
Start Free TrialLog in
Avatar of Rezer
Rezer

asked on

GetPixel() returning wrong value (Windows API)

I'm using GetDC() to get a device context for the entire screen followed by GetPixel() to check the color of a pixel within a DirectX application.  Most frequently the color returned is the correct, expected value.  However, occasionally when no colors have changed GetPixel() performed on the same x and y will return an incorrect, completely unrelated value and I'm having a hard time pinpointing why.  The only thing I can come up with is that GetPixel() is returning values from the back buffer occasionally while it's still being rendered in memory, but I'm not sure on that at all.

So, any idea what's causing this behavior, and if so, how would I go about preventing it?
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial