XNA Creators Club Online
Page 1 of 1 (1 items)
Sort Posts: Previous Next

How do I read each pixel color of surface with format D3DFMT_A32B32G32R32F

Last post 05-11-2008 11:02 AM by akira32. 0 replies.
  • 05-11-2008 11:02 AM

    How do I read each pixel color of surface with format D3DFMT_A32B32G32R32F

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
      LPDIRECT3DSURFACE9 pDestSurface_New2;
      D3DLOCKED_RECT lrect_New2;
      D3DSURFACE_DESC Desc2;

      m_pShadowMap_QVSM_Surf_EyeDepth->GetDesc(&Desc2);
      V(m_pd3dDevice->CreateOffscreenPlainSurface(Desc2.Width,Desc2.Height,Desc2.Format,D3DPOOL_SYSTEMMEM,&pDestSurface_New2,NULL));//Must be D3DPOOL_SYSTEMMEM for MSDN
      V(m_pd3dDevice->GetRenderTargetData(m_pShadowMap_QVSM_Surf_EyeDepth,pDestSurface_New2));

      hr=pDestSurface_New2->LockRect(&lrect_New2,NULL,D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_READONLY );

      for (LONG y=0;y<(LONG)Desc.Height;y++)
      {
        for (LONG x=0;x<(LONG)Desc.Width;x++)
        {
          float depthFromEye0 = ((float*)lrect_New2.pBits)[y*(lrect_New2.Pitch/(8*sizeof(float)))+x+0];
          float depthFromEye1 = ((float*)lrect_New2.pBits)[y*(lrect_New2.Pitch/(8*sizeof(float)))+x+1];
          float depthFromEye2 = ((float*)lrect_New2.pBits)[y*(lrect_New2.Pitch/(8*sizeof(float)))+x+2];
          float depthFromEye3 = ((float*)lrect_New2.pBits)[y*(lrect_New2.Pitch/(8*sizeof(float)))+x+3];
Page 1 of 1 (1 items) Previous Next