marco0999 Cheater Reputation: 0
Joined: 28 Jun 2020 Posts: 29 Location: Italy
|
Posted: Thu Sep 15, 2022 11:50 pm Post subject: Get a pixel color on directx11 from the screen |
|
|
Hi,
I need to do function like:
Code: |
RGBTRIPLE GetPixelColor(int x, int y) |
to get a color on a single pixel on directx 11 from the actual frame in my screen
For the moment I have this code:
//For each Call to Present() do the following:
Code: |
//Get Device
ID3D11Device* device;
HRESULT gd = pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&device);
assert(gd == S_OK);
//Get context
ID3D11DeviceContext* context;
device->GetImmediateContext(&context);
//get back buffer
ID3D11Texture2D* backbufferTex;
HRESULT gb = pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2d), (LPVOID*)&backbufferTex);
assert(gb == S_OK); |
I'am not an expert on directx.
I ask how I can get the pixel color of coordinate x,y from buffer or context or other.
Can you help me please ?
Thanks !
|
|