R32f / lockrect -> reading on cpu

Started by
1 comment, last by Hodgman 11 years, 9 months ago
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?
Advertisement
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.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.


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.[/quote]

This topic is closed to new replies.

Advertisement