static <B extends Buffer> CLImage3d<B> createImage(CLContext context, B directBuffer,
int width, int height, int depth, int rowPitch, int slicePitch, CLImageFormat format, int flags) {
CLImageBinding cl = context.getPlatform().getImageBinding();
IntBuffer err = Buffers.newDirectIntBuffer(1);
B host_ptr = null;
if(isHostPointerFlag(flags)) {
host_ptr = directBuffer;
}
long id = cl.clCreateImage3D(context.ID, flags, format.getFormatImpl(), width, height, depth, rowPitch, slicePitch, host_ptr, err);
checkForError(err.get(), "can not create 2d image");
return new CLImage3d<B>(context, directBuffer, format, width, height, depth, id, flags);
}