Constructor
CoglTexture2DSlicednew_from_file
Declaration [src]
CoglTexture2DSliced*
cogl_texture_2d_sliced_new_from_file (
CoglContext* ctx,
const char* filename,
int max_waste,
GError** error
)
Description [src]
Creates a CoglTexture2DSliced
from an image file.
A CoglTexture2DSliced
may internally be comprised of 1 or more
CoglTexture2D
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.
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.
This method is not directly available to language bindings.
Parameters
ctx
-
Type:
CoglContext
A
CoglContext
.The data is owned by the caller of the function. filename
-
Type:
const char*
The file to load.
The data is owned by the caller of the function. The value is a NUL terminated UTF-8 string. max_waste
-
Type:
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.
error
-
Type:
GError **
The return location for a recoverable error.
The argument can be NULL
.If the return location is not NULL
, then you must initialize it to aNULL
GError*
.The argument will be left initialized to NULL
by the constructor if there are no errors.In case of error, the argument will be set to a newly allocated GError
; the caller will take ownership of the data, and be responsible for freeing it.
Return value
Type: CoglTexture2DSliced
A newly created CoglTexture2DSliced
or NULL
on failure and error
will be updated.
The caller of the function takes ownership of the data, and is responsible for freeing it. |