Cogl.Texture2DSliced¶
- Implementations:
None
Methods¶
- Inherited:
class |
|
class |
|
class |
|
class |
|
Virtual Methods¶
None
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Cogl.Texture2DSliced¶
- Bases:
- classmethod new_from_bitmap(bmp, max_waste)¶
- Parameters:
bmp (
Cogl.Bitmap
) – ACogl.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
orNone
on failure and error will be updated.- Return type:
Creates a new
Cogl.Texture2DSliced
texture based on data residing in a bitmap.A
Cogl.Texture2DSliced
may internally be comprised of 1 or moreCogl.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
) – ACogl.Context
width (
int
) – width of texture in pixelsheight (
int
) – height of texture in pixelsmax_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
) – theCogl.PixelFormat
the buffer is stored in in RAMrowstride (
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:
- Returns:
A newly created
Cogl.Texture2DSliced
orNone
on failure and error will be updated.- Return type:
Creates a new
Cogl.Texture2DSliced
texture based on data residing in memory.A
Cogl.Texture2DSliced
may internally be comprised of 1 or moreCogl.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 useCogl.Texture2DSliced.new_from_bitmap
() or useCogl.Texture2DSliced.new_with_size
() and then upload data usingCogl.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
) – ACogl.Context
filename (
str
) – the file to loadmax_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:
- Returns:
A newly created
Cogl.Texture2DSliced
orNone
on failure and error will be updated.- Return type:
Creates a
Cogl.Texture2DSliced
from an image file.A
Cogl.Texture2DSliced
may internally be comprised of 1 or moreCogl.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
) – ACogl.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:
Creates a
Cogl.Texture2DSliced
that may internally be comprised of 1 or moreCogl.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.