Cogl.Texture2D¶
- Implementations:
None
Methods¶
- Inherited:
class |
|
class |
|
class |
|
class |
|
class |
|
Virtual Methods¶
None
Properties¶
None
Signals¶
None
Fields¶
None
Class Details¶
- class Cogl.Texture2D¶
- Bases:
- classmethod gl_new_from_foreign(ctx, gl_handle, width, height, format)¶
- Parameters:
ctx (
Cogl.Context) – ACogl.Contextgl_handle (
int) – A GL handle for a GL_TEXTURE_2D texture objectwidth (
int) – Width of the foreign GL textureheight (
int) – Height of the foreign GL textureformat (
Cogl.PixelFormat) – The format of the texture
- Returns:
A newly allocated
Cogl.Texture2D- Return type:
Wraps an existing GL_TEXTURE_2D texture object as a
Cogl.Texture2D. This can be used for integrating Cogl with software using OpenGL directly.The texture is still configurable until it has been allocated so for example you can declare whether the texture is premultiplied with
Cogl.Texture.set_premultiplied().The results are undefined for passing an invalid gl_handle or if width or height don’t have the correct texture geometry.
New in version 2.0.
- classmethod new_from_bitmap(bitmap)¶
- Parameters:
bitmap (
Cogl.Bitmap) – ACogl.Bitmap- Returns:
A newly allocated
Cogl.Texture2D- Return type:
Creates a low-level
Cogl.Texture2Dtexture based on data residing in aCogl.Bitmap.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 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
Cogl.Texture.set_components() andCogl.Texture.set_premultiplied().Many GPUs only support power of two sizes for
Cogl.Texture2Dtextures. You can check support for non power of two textures by checking for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_NPOTfeature viaCogl.has_feature().New in version 2.0.
- classmethod new_from_data(ctx, width, height, format, rowstride, data)¶
- Parameters:
ctx (
Cogl.Context) – ACogl.Contextwidth (
int) – width of texture in pixelsheight (
int) – height of texture in pixelsformat (
Cogl.PixelFormat) – theCogl.PixelFormatthe buffer is stored in in RAMrowstride (
int) – the memory offset in bytes between the starts of scanlines 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 allocated
Cogl.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 returnNoneand set error.- Return type:
Creates a low-level
Cogl.Texture2Dtexture based on data residing in memory.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
Cogl.Bitmapfor your data and useCogl.Texture2D.new_from_bitmap() or useCogl.Texture2D.new_with_size() and then upload data usingCogl.Texture.set_data() Many GPUs only support power of two sizes forCogl.Texture2Dtextures. You can check support for non power of two textures by checking for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_NPOTfeature viaCogl.has_feature().New in version 2.0.
- classmethod new_from_file(ctx, filename)¶
- Parameters:
ctx (
Cogl.Context) – ACogl.Contextfilename (
str) – the file to load
- Raises:
- Returns:
A newly created
Cogl.Texture2DorNoneon failure and error will be updated.- Return type:
Creates a low-level
Cogl.Texture2Dtexture from an image file.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 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
Cogl.Texture.set_components() andCogl.Texture.set_premultiplied().Many GPUs only support power of two sizes for
Cogl.Texture2Dtextures. You can check support for non power of two textures by checking for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_NPOTfeature viaCogl.has_feature().New in version 1.16.
- classmethod new_with_size(ctx, width, height)¶
- Parameters:
ctx (
Cogl.Context) – ACogl.Contextwidth (
int) – Width of the texture to allocateheight (
int) – Height of the texture to allocate
- Returns:
A new
Cogl.Texture2Dobject with no storage yet allocated.- Return type:
Creates a low-level
Cogl.Texture2Dtexture 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
Cogl.Texture.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
Cogl.Texture.set_components() andCogl.Texture.set_premultiplied().Many GPUs only support power of two sizes for
Cogl.Texture2Dtextures. You can check support for non power of two textures by checking for theCogl.FeatureID.OGL_FEATURE_ID_TEXTURE_NPOTfeature viaCogl.has_feature().New in version 2.0.