Texture3D.from_data


Description:

public Texture3D.from_data (Context context, int width, int height, int depth, PixelFormat format, int rowstride, int image_stride, uint8 data) throws Error

Creates a low-level 3D texture and initializes it with data.

The data is assumed to be packed array of depth images. There can be padding between the images using image_stride .

<note>This api will always immediately allocate GPU memory for the texture and upload the given data so that the data pointer does not need to remain valid once this function returns. This means it is not possible to configure the texture before it is allocated. If you do need to configure the texture before allocation (to specify constraints on the internal format for example) then you can instead create a Bitmap for your data and use Texture3D.from_bitmap.</note>

Parameters:

context

a Context

width

width of the texture in pixels.

height

height of the texture in pixels.

depth

depth of the texture in pixels.

format

the PixelFormat the buffer is stored in in RAM

rowstride

the memory offset in bytes between the starts of scanlines in data or 0 to infer it from the width and format

image_stride

the number of bytes from one image to the next. This can be used to add padding between the images in a similar way that the rowstride can be used to add padding between rows. Alternatively 0 can be passed to infer the image_stride from the height.

data

pointer the memory region where the source buffer resides

Returns:

the newly created Texture3D or null if there was an error and an exception will be returned through throws.