Cogl.TextureRectangle.new_from_bitmap
function new_from_bitmap(bitmap: Cogl.Bitmap): Cogl.TextureRectangle { // Gjs wrapper for cogl_texture_rectangle_new_from_bitmap() }
Allocates a new Cogl.TextureRectangle texture which will be initialized with the pixel data from bitmap. This texture is a low-level texture that the GPU can sample from directly unlike high-level textures such as Cogl.Texture2DSliced and Cogl.AtlasTexture.
<note>Unlike for Cogl.Texture2D textures, coordinates for Cogl.TextureRectangle textures should not be normalized. So instead of using the coordinate (1, 1) to sample the bottom right corner of a rectangle texture you would use (@width, @height) where @width and @height are the width and height of the texture.</note>
<note>If you want to sample from a rectangle texture from GLSL you should use the sampler2DRect sampler type.</note>
<note>Applications wanting to use Cogl.TextureRectangle should first check for the Cogl.FeatureID.ogl_feature_id_texture_rectangle feature using Cogl.has_feature.</note>
The storage for the texture is not allocated before this function returns. You can call Cogl.Texture.prototype.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 going to be used and can optimize how it is allocated.
Since 2.0
- bitmap
- Returns
A pointer to a new Cogl.TextureRectangle texture.