Cogl.Texture2D.gl_new_from_foreign
function gl_new_from_foreign(ctx: Cogl.Context, gl_handle: Number(guint), width: Number(gint), height: Number(gint), format: Cogl.PixelFormat): Cogl.Texture2D { // Gjs wrapper for cogl_texture_2d_gl_new_from_foreign() }
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.prototype.set_premultiplied.
<note>The results are undefined for passing an invalid gl_handle or if width or height don't have the correct texture geometry.</note>
Since 2.0
- ctx
- gl_handle
A GL handle for a GL_TEXTURE_2D texture object
- width
Width of the foreign GL texture
- height
Height of the foreign GL texture
- format
The format of the texture
- Returns
A newly allocated Cogl.Texture2D