Code: Select all
#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
...
sceGuDepthBuffer(zbp,BUF_WIDTH);
sceGuDepthRange(0xFFFF,0x0);
...
sceGuTexMode(GU_PSM_4444,0,0,0);
sceGuCopyImage(GU_PSM_4444,0,0,512,512,512,(void*)(((unsigned int)zbp)+0x4000000),0,0,512,depth);
sceGuTexImage(0,512,512,512,depth);
I have no problems reading the data for the color-framebuffer (format GU_PSM_8888), however, the zbuffer seems to use some weird format:
Rendering the texture "depth" will result in weird colors (well thats ok), some blocks which seem to be 32x32 pixel each (but totally wrong positions - which made me think its swizzled, it doesnt seem to be though) and other weird rotations of the drawn noise which don't match the object in the color-framebuffer.
What do I have to change / do to get the zbuffer as a texture?
(If there is a function which does that - even better!)
PS: Outputting the array to a file gave me unexpected results: It looks like the pixels I wrote to, get a value which loops through ABCDEFG... and 123456...