Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

D3DFMT_R32F Format Values ?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Endemoniada   Members   

429
Like
0Likes
Like

Posted 06 September 2013 - 08:16 PM

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, 06 September 2013 - 08:17 PM.


#2 MJP   Moderators   

19590
Like
1Likes
Like

Posted 06 September 2013 - 11:46 PM

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


#3 Endemoniada   Members   

429
Like
0Likes
Like

Posted 11 September 2013 - 10:30 AM

Perfect, thanks man.






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.