TextureRectangle.from_foreign


Description:

public TextureRectangle.from_foreign (Context ctx, uint gl_handle, int width, int height, PixelFormat format)

Wraps an existing GL_TEXTURE_RECTANGLE texture object as a TextureRectangle.

This can be used for integrating Cogl with software using OpenGL directly.

<note>Unlike for Texture2D textures, coordinates for 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 TextureRectangle should first check for the cogl_feature_id_texture_rectangle feature using 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 set_premultiplied.

Parameters:

ctx

A Context

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 TextureRectangle texture