Creates a low-level Texture2D texture based on data residing in memory.
<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
Texture2D.from_bitmap or use
Texture2D.with_size and then upload data using
set_data</note>
<note>Many GPUs only support power of two sizes for Texture2D textures. You can check support for non power of two textures by checking for the cogl_feature_id_texture_npot feature via has_feature.</note>
ctx |
A Context |
width |
width of texture in pixels |
height |
height of 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 |
pointer the memory region where the source buffer resides |
A newly allocated Texture2D, or if the size is not supported (because it is too large or a non-power-of-two size that the hardware doesn't support) it will return null and set throws. |