Sign in to follow this  
Followers 0
Endemoniada

D3DFMT_R32F Format Values ?

2 posts in this topic

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
0

Share this post


Link to post
Share on other sites

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];
    }
}
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0