Pike v8.1 release 6

Method GLUE.BaseTexture()->set_image_data()


Method set_image_data

void set_image_data(Image.Image|mapping(string:mixed) data, bool|void no_resize)

Description

Set the contents (and size) of the texture from the supplied data. The data is identical to what would normally be sent as the last argument to glTex[Sub]Image2D() or an Image.Image object.

If no_resize is specified, it is assumed that the data will fit in the texture, otherwise the parts that extend beyond it will be discarded.

Parameter data

Besides being an Image.Image object, data can be either of two types of mappins. First it can be a mapping with Image data.

"rgb" : Image.Image

Texture image data.

"alpha" : Image.Image

Optional alpha channel.

"luminance" : Image.Image

Optional luminance channel.

Second it can be a mapping pointing out a shared memory segment.

"mem" : System.Memory

The shared memory segment.

"mem_w" : int

The width and height of the memory segment.

"mem_h" : int
"mem_format" : int

The format of the memory segment, e.g. GL.GL_RGB.

"mem_type" : int

The low level format of the memory segment, e.g. GL.GL_UNSIGNED_BYTE.