Cogl.TextureRectangle.new_from_foreign
function new_from_foreign(ctx: Cogl.Context, gl_handle: Number(guint), width: Number(gint), height: Number(gint), format: Cogl.PixelFormat): Cogl.TextureRectangle { // Gjs wrapper for cogl_texture_rectangle_new_from_foreign() }
Wraps an existing GL_TEXTURE_RECTANGLE texture object as a Cogl.TextureRectangle. This can be used for integrating Cogl with software using OpenGL directly.
<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>The results are undefined for passing an invalid gl_handle or if width or height don't have the correct texture geometry.</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 texture is still configurable until it has been allocated so for example you can declare whether the texture is premultiplied with Cogl.Texture.prototype.set_premultiplied.
- ctx
- gl_handle
A GL handle for a GL_TEXTURE_RECTANGLE texture object
- width
Width of the foreign GL texture
- height
Height of the foreign GL texture
- format
The format of the texture
- Returns
A new Cogl.TextureRectangle texture