Texture2D.with_size


Description:

public Texture2D.with_size (Context ctx, int width, int height)

Creates a low-level Texture2D texture with a given width and height that your GPU can texture from directly.

The storage for the texture is not allocated before this function returns. You can call allocate to explicitly allocate the underlying storage or preferably let Cogl automatically allocate storage lazily when it may know more about how the texture is being used and can optimize how it is allocated.

The texture is still configurable until it has been allocated so for example you can influence the internal format of the texture using set_components and set_premultiplied.

<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>

Parameters:

ctx

A Context

width

Width of the texture to allocate

height

Height of the texture to allocate

Returns:

A new Texture2D object with no storage yet allocated.