Cogl.TextureRectangle.new_with_size

function new_with_size(ctx: Cogl.Context, width: Number(gint), height: Number(gint)): Cogl.TextureRectangle {
    // Gjs wrapper for cogl_texture_rectangle_new_with_size()
}
  

Creates a new Cogl.TextureRectangle texture with a given width, and height. 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 1.10

ctx

A Cogl.Context pointer

width

The texture width to allocate

height

The texture height to allocate

Returns

A pointer to a new Cogl.TextureRectangle object with no storage allocated yet.