Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

D3DFMT_R32F Format Values ?

This topic is 2134 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

Hi guys,

 

I'm rendering my depth values to a D3DFMT_R32F texture that I want to save as a bitmap (or copy to clipboard) to see what it looks like. After I get it onto a plain surface so I can lock the rect I don't know what to do:

// all the work to get it on a plain surface is done

// now lock to get at the values
plain_surface->LockRect(&locked_rect,NULL,0);

// loop through each pixel
BYTE* src;

for(uint i=0;i<desc.Height;i++){
 src=(BYTE*)locked_rect.pBits+i*locked_rect.Pitch;
 for(uint j=0;j<desc.Width;j++){
   // float f = this is what I need
   // ...to fill my destination pixels here
   src+=4;
 }
}

Please help. Thanks.

 

PS - I'm using D3D9

Edited by Endemoniada

Share this post


Link to post
Share on other sites
Advertisement

const BYTE* src = reinterpret_cast<const BYTE*>(locked_rect.pBits);
for(uint i=0;i<desc.Height;i++){
    const float* row = reinterpret_cast<const float*>(src + i * locked_rect.Pitch);    
    for(uint j=0;j<desc.Width;j++){
        float f = row[j];
    }
}

Share this post


Link to post
Share on other sites
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!