bmap_createblack(1024,768,32) is ok for a z buffer. If the format is wrong, i.e. different from 32, it's converted automatically, so it does not really matter. Only the size matters. The z buffer normally uses 24 bits for the depth and 8 bits for the stencil.