Cogl.Texture2DSliced

g Cogl.Object Cogl.Object Cogl.Texture2DSliced Cogl.Texture2DSliced Cogl.Object->Cogl.Texture2DSliced Cogl.Texture Cogl.Texture Cogl.Texture->Cogl.Texture2DSliced GObject.GInterface GObject.GInterface GObject.GInterface->Cogl.Texture

Implementations:

None

Methods

Inherited:

Cogl.Object (2), Cogl.Texture (14)

class

new_from_bitmap (bmp, max_waste)

class

new_from_data (ctx, width, height, max_waste, format, rowstride, data)

class

new_from_file (ctx, filename, max_waste)

class

new_with_size (ctx, width, height, max_waste)

Virtual Methods

None

Properties

None

Signals

None

Fields

None

Class Details

class Cogl.Texture2DSliced
Bases:

Cogl.Object, Cogl.Texture

classmethod new_from_bitmap(bmp, max_waste)
Parameters:
  • bmp (Cogl.Bitmap) – A Cogl.Bitmap

  • max_waste (int) – The threshold of how wide a strip of wasted texels are allowed along the right and bottom textures before they must be sliced to reduce the amount of waste. A negative can be passed to disable slicing.

Returns:

A newly created Cogl.Texture2DSliced or None on failure and error will be updated.

Return type:

Cogl.Texture2DSliced

Creates a new Cogl.Texture2DSliced texture based on data residing in a bitmap.

A Cogl.Texture2DSliced may internally be comprised of 1 or more Cogl.Texture2D textures depending on GPU limitations. For example if the GPU only supports power-of-two sized textures then a sliced texture will turn a non-power-of-two size into a combination of smaller power-of-two sized textures. If the requested texture size is larger than is supported by the hardware then the texture will be sliced into smaller textures that can be accessed by the hardware.

max_waste is used as a threshold for recursively slicing the right-most or bottom-most slices into smaller sizes until the wasted padding at the bottom and right of the textures is less than specified. A negative max_waste will disable slicing.

The storage for the texture is not allocated before this function returns. You can call Cogl.Texture.allocate() to explicitly allocate the underlying storage or let Cogl automatically allocate storage lazily.

It’s possible for the allocation of a sliced texture to fail later due to impossible slicing constraints if a negative max_waste value is given. If the given virtual texture size is larger than is supported by the hardware but slicing is disabled the texture size would be too large to handle.

New in version 1.16.

classmethod new_from_data(ctx, width, height, max_waste, format, rowstride, data)
Parameters:
  • ctx (Cogl.Context) – A Cogl.Context

  • width (int) – width of texture in pixels

  • height (int) – height of texture in pixels

  • max_waste (int) – The threshold of how wide a strip of wasted texels are allowed along the right and bottom textures before they must be sliced to reduce the amount of waste. A negative can be passed to disable slicing.

  • format (Cogl.PixelFormat) – the Cogl.PixelFormat the buffer is stored in in RAM

  • rowstride (int) – the memory offset in bytes between the start of each row in data. A value of 0 will make Cogl automatically calculate rowstride from width and format.

  • data (int) – pointer the memory region where the source buffer resides

Raises:

GLib.Error

Returns:

A newly created Cogl.Texture2DSliced or None on failure and error will be updated.

Return type:

Cogl.Texture2DSliced

Creates a new Cogl.Texture2DSliced texture based on data residing in memory.

A Cogl.Texture2DSliced may internally be comprised of 1 or more Cogl.Texture2D textures depending on GPU limitations. For example if the GPU only supports power-of-two sized textures then a sliced texture will turn a non-power-of-two size into a combination of smaller power-of-two sized textures. If the requested texture size is larger than is supported by the hardware then the texture will be sliced into smaller textures that can be accessed by the hardware.

max_waste is used as a threshold for recursively slicing the right-most or bottom-most slices into smaller sizes until the wasted padding at the bottom and right of the textures is less than specified. A negative max_waste will disable slicing.

This api will always immediately allocate GPU memory for all the required texture slices 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 Cogl.Bitmap for your data and use Cogl.Texture2DSliced.new_from_bitmap() or use Cogl.Texture2DSliced.new_with_size() and then upload data using Cogl.Texture.set_data() It’s possible for the allocation of a sliced texture to fail due to impossible slicing constraints if a negative max_waste value is given. If the given virtual texture size is larger than is supported by the hardware but slicing is disabled the texture size would be too large to handle.

New in version 1.16.

classmethod new_from_file(ctx, filename, max_waste)
Parameters:
  • ctx (Cogl.Context) – A Cogl.Context

  • filename (str) – the file to load

  • max_waste (int) – The threshold of how wide a strip of wasted texels are allowed along the right and bottom textures before they must be sliced to reduce the amount of waste. A negative can be passed to disable slicing.

Raises:

GLib.Error

Returns:

A newly created Cogl.Texture2DSliced or None on failure and error will be updated.

Return type:

Cogl.Texture2DSliced

Creates a Cogl.Texture2DSliced from an image file.

A Cogl.Texture2DSliced may internally be comprised of 1 or more Cogl.Texture2D textures depending on GPU limitations. For example if the GPU only supports power-of-two sized textures then a sliced texture will turn a non-power-of-two size into a combination of smaller power-of-two sized textures. If the requested texture size is larger than is supported by the hardware then the texture will be sliced into smaller textures that can be accessed by the hardware.

max_waste is used as a threshold for recursively slicing the right-most or bottom-most slices into smaller sizes until the wasted padding at the bottom and right of the textures is less than specified. A negative max_waste will disable slicing.

The storage for the texture is not allocated before this function returns. You can call Cogl.Texture.allocate() to explicitly allocate the underlying storage or let Cogl automatically allocate storage lazily.

It’s possible for the allocation of a sliced texture to fail later due to impossible slicing constraints if a negative max_waste value is given. If the given virtual texture size is larger than is supported by the hardware but slicing is disabled the texture size would be too large to handle.

New in version 1.16.

classmethod new_with_size(ctx, width, height, max_waste)
Parameters:
  • ctx (Cogl.Context) – A Cogl.Context

  • width (int) – The virtual width of your sliced texture.

  • height (int) – The virtual height of your sliced texture.

  • max_waste (int) – The threshold of how wide a strip of wasted texels are allowed along the right and bottom textures before they must be sliced to reduce the amount of waste. A negative can be passed to disable slicing.

Returns:

A new Cogl.Texture2DSliced object with no storage allocated yet.

Return type:

Cogl.Texture2DSliced

Creates a Cogl.Texture2DSliced that may internally be comprised of 1 or more Cogl.Texture2D textures depending on GPU limitations. For example if the GPU only supports power-of-two sized textures then a sliced texture will turn a non-power-of-two size into a combination of smaller power-of-two sized textures. If the requested texture size is larger than is supported by the hardware then the texture will be sliced into smaller textures that can be accessed by the hardware.

max_waste is used as a threshold for recursively slicing the right-most or bottom-most slices into smaller sizes until the wasted padding at the bottom and right of the textures is less than specified. A negative max_waste will disable slicing.

The storage for the texture is not allocated before this function returns. You can call Cogl.Texture.allocate() to explicitly allocate the underlying storage or let Cogl automatically allocate storage lazily.

It’s possible for the allocation of a sliced texture to fail later due to impossible slicing constraints if a negative max_waste value is given. If the given virtual texture size size is larger than is supported by the hardware but slicing is disabled the texture size would be too large to handle.

New in version 1.10.