Thank you! Can I use depth value than direct to read current scene pixel's color value. Just like glReadPixel() in openGL,if just is IDirect3DDevice9::GetFrontBufferData() Thank you again!
First off... reading back that sort of information can *really* hurt your performance. Don't do it unless you really have to
Do you want the pixel from the frame buffer or a texture
Either way it involves "locking" the resource (see IDirect3DSurface9::LockRect() and/or IDirect3DTexture9::LockRect()) and then processing the raw pixel data. It can be quite an involved process if you're using an exotic pixel format. You get the raw binary data - not a convenient ARGB vector..
I'm not sure I fully understand you... I've only written a couple of OpenGL programs (years ago!) so I don't really know anything about glReadPixel()!
If you want to read, at a given pixel, from the depth buffer then it's more tricky - for performance reasons it's best not to mess with it. By design, you have to be using a lockable depth buffer (e.g. D3DFMT_D16_LOCKABLE) to gain access - attempting to read the other (more common) formats will fail.
about get color value
pureporsche
Can I use depth value than direct to read current scene pixel's color value.
Just like glReadPixel() in openGL,if just is IDirect3DDevice9::GetFrontBufferData()
Thank you again!
S Crichton
First off... reading back that sort of information can *really* hurt your performance. Don't do it unless you really have to
Do you want the pixel from the frame buffer or a texture
Either way it involves "locking" the resource (see IDirect3DSurface9::LockRect() and/or IDirect3DTexture9::LockRect()) and then processing the raw pixel data. It can be quite an involved process if you're using an exotic pixel format. You get the raw binary data - not a convenient ARGB vector..
If you want the frame buffer pixel colour, then use IDirect3DDevice9::GetFrontBufferData() along with the aforementioned locking technique.
hth
Jack
Peter Bromberg
I'm not sure I fully understand you... I've only written a couple of OpenGL programs (years ago!) so I don't really know anything about glReadPixel()!
If you want to read, at a given pixel, from the depth buffer then it's more tricky - for performance reasons it's best not to mess with it. By design, you have to be using a lockable depth buffer (e.g. D3DFMT_D16_LOCKABLE) to gain access - attempting to read the other (more common) formats will fail.
hth
Jack