I have a DirectX IDirect3DSurface9 object. How can I get the RGB values from the surface?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should call IDirect3DSurface9::LockRect, take a look at this http://msdn.microsoft.com/en-us/library/windows/desktop/bb205896(v=vs.85).aspx . This function returns D3DLOCKED_RECT structure which contains a pointer to the surface data. If you know the format of the surface, you are able to read RGB values. For example: if the surface’s format is D3DFMT_R8G8B8, each three consecutive bytes will be the red, green and blue components of the surface’s pixels.