Texture2D.gl_new_from_foreign


Description:

public Texture2D.gl_new_from_foreign (Context ctx, uint gl_handle, int width, int height, PixelFormat format)

Wraps an existing GL_TEXTURE_2D texture object as a 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 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>

Parameters:

ctx

A Context

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 Texture2D