Jump to content
  • Advertisement
Sign in to follow this  
yk_cadcg

[solved][dx10]why can't readback the clicked pixel?

This topic is 3834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

methodology is correct; forgot to multiply MVP before drawing. -------------------------- hi, i mouse-click in the dx10 window, hope to readback the pixel's color:
	GetCursorPos(&g_picked.pos);
	ScreenToClient(DXUTGetHWND(), &g_picked.pos);
        ...here new a 1x1 staging texture for rendertarget pTexRT;
	D3D10_BOX box = {g_picked.pos.x, g_picked.pos.y, 0, g_picked.pos.x + 1, g_picked.pos.y + 1, 1};
	pd3dDevice->CopySubresourceRegion(pTexStage, 0, 0, 0, 0, pTexRT, 0, &box);
	D3D10_MAPPED_TEXTURE2D mappedTex;
	pTexStage->Map(0, D3D10_MAP_READ, NULL, &mappedTex);
	float* pSrc = (float*)mappedTex.pData;
pSrc can't get my desired color. Confusing fact: when viewing pTexRT in PIX, the pixel at g_picked.pos is exactly what i want; but when manually writing pTexRT to .pfm and viewing it in HDRShop, the pixel i want is at another position. Did i miss something? Great thanks for suggestions! [Edited by - yk_cadcg on June 11, 2008 9:37:19 PM]

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!