Jump to content

  • Log In with Google      Sign In   
  • Create Account

R32f / lockrect -> reading on cpu


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 vicx   Members   -  Reputation: 128

Like
0Likes
Like

Posted 25 July 2012 - 01:58 AM

Hello again!

Till now processing r32f at vertex shader wasn't a big deal, but I decided to exlude bmp/jpg heightmaps from my project and replace them with dds version in r32f format, which allows my crappy gpu to do vtf.
I spent some time trying to get proper values from this format and I'm still failing, even though I found lots of conversion methods.
The msdn says that the most important is the red channel, but I don't really get it in terms of reading from lockedrect.
I use standard method of reading data from texture - so each time I take four bytes and I don't really know how to decode it to proper black-white value.
I used to take only red byte and it seemed aaaalmost ok, but there were some glitches on the output height-image. Could someone give me a clue how to take the brightness from these four bytes properly?

Sponsor:

#2 mhagain   Crossbones+   -  Reputation: 7979

Like
1Likes
Like

Posted 25 July 2012 - 05:08 AM

If you're also using DXT compression then the data you get back from LockRect will be the compressed version of the texture. You'll need to decompress it back to RGBA if so, and that's where you start getting into patent minefields.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#3 Hodgman   Moderators   -  Reputation: 30388

Like
2Likes
Like

Posted 25 July 2012 - 05:26 AM

and that's where you start getting into patent minefields

I'd personally just ignore the patent issues. HTC isn't going to sue you for decompressing a texture (unless your name is Apple), and even then, they'd lose:

In September 2011, Intel employee Ian Romanick mentioned that the S3TC patent had been marked as invalid in patent litigation between Apple and HTC, the latter of which acquired S3 and all of their patents.






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.



PARTNERS