1.27 <GdkGLTextureBuilder>

Class: <GdkGLTextureBuilder>

It derives from <GObject>.

Constructs <GdkTexture> objects from GL textures.

The operation is quite simple: Create a texture builder, set all the necessary properties - keep in mind that the properties gltexture-builder:context, gltexture-builder:id, gltexture-builder:width, and gltexture-builder:height are mandatory - and then call gltexture-builder:build to create the new texture.

<GdkGLTextureBuilder> can be used for quick one-shot construction of textures as well as kept around and reused to construct multiple textures.

Properties

Property: gltexture-builder:color-state self

The color state of the texture.

Its value is a <GdkColorState>, or #f.

Set it with (set! (gltexture-builder:color-state self) value).

Property: gltexture-builder:context self

The context owning the texture.

Its value is a <GdkGLContext>, or #f.

Set it with (set! (gltexture-builder:context self) value).

Property: gltexture-builder:format self

The format when downloading the texture.

Its value is a <GdkMemoryFormat> (or, to set it, one of its symbols).

Set it with (set! (gltexture-builder:format self) value).

Property: gltexture-builder:has-mipmap self

If the texture has a mipmap.

Its value is a boolean.

Set it with (set! (gltexture-builder:has-mipmap self) value).

Property: gltexture-builder:height self

The height of the texture.

Its value is a 32-bit integer.

Set it with (set! (gltexture-builder:height self) value).

Property: gltexture-builder:id self

The texture ID to use.

Its value is an unsigned 32-bit integer.

Set it with (set! (gltexture-builder:id self) value).

Property: gltexture-builder:sync self

An optional GLSync object.

If this is set, GTK will wait on it before using the texture.

Its value is a foreign pointer (or, to set it, a bytevector).

Set it with (set! (gltexture-builder:sync self) value).

Property: gltexture-builder:update-region self

The update region for gltexture-builder:update-texture.

Its value is a <CairoRegion>, or #f.

Set it with (set! (gltexture-builder:update-region self) value).

Property: gltexture-builder:update-texture self

The texture gltexture-builder:update-region is an update for.

Its value is a <GdkTexture>, or #f.

Set it with (set! (gltexture-builder:update-texture self) value).

Property: gltexture-builder:width self

The width of the texture.

Its value is a 32-bit integer.

Set it with (set! (gltexture-builder:width self) value).

Procedures

Method: gltexture-builder:build self [destroy] [data] ⇒ %return
Method: build self [destroy] [data] ⇒ %return

Builds a new <GdkTexture> with the values set up in the builder.

The destroy function gets called when the returned texture gets released; either when the texture is finalized or by an explicit call to gltexture:release. It should release all GL resources associated with the texture, such as the gltexture-builder:id and the gltexture-builder:sync.

Note that it is a programming error to call this function if any mandatory property has not been set.

It is possible to call this function multiple times to create multiple textures, possibly with changing properties in between.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

destroy

Passed, or left out: a procedure, or #f.

destroy function to be called when the texture is released

See GDestroyNotify for how it is called.

data

Passed, or left out: a foreign pointer, or a bytevector, or #f.

user data to pass to the destroy function

%return

Returned: a <GdkTexture>.

a newly built <GdkTexture>

Method: gltexture-builder:get-color-state self ⇒ %return
Method: get-color-state self ⇒ %return

Gets the color state previously set via gltexture-builder:set-color-state.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a <GdkColorState>.

the color state

Method: gltexture-builder:get-context self ⇒ %return
Method: get-context self ⇒ %return

Gets the context previously set via gltexture-builder:set-context or #f if none was set.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a <GdkGLContext>, or #f.

The context

Method: gltexture-builder:get-format self ⇒ %return
Method: get-format self ⇒ %return

Gets the format previously set via gltexture-builder:set-format.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a <GdkMemoryFormat>.

The format

Method: gltexture-builder:get-has-mipmap? self ⇒ %return
Method: get-has-mipmap? self ⇒ %return

Gets whether the texture has a mipmap.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a boolean.

Whether the texture has a mipmap

Method: gltexture-builder:get-height self ⇒ %return
Method: get-height self ⇒ %return

Gets the height previously set via gltexture-builder:set-height or 0 if the height wasn’t set.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a 32-bit integer.

The height

Method: gltexture-builder:get-id self ⇒ %return
Method: get-id self ⇒ %return

Gets the texture id previously set via gltexture-builder:set-id or 0 if the id wasn’t set.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: an unsigned 32-bit integer.

The id

Method: gltexture-builder:get-sync self ⇒ %return
Method: get-sync self ⇒ %return

Gets the GLsync previously set via gltexture-builder:set-sync.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a foreign pointer, or #f.

the GLSync

Method: gltexture-builder:get-update-region self ⇒ %return
Method: get-update-region self ⇒ %return

Gets the region previously set via gltexture-builder:set-update-region or #f if none was set.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a <CairoRegion>, or #f.

The region

Method: gltexture-builder:get-update-texture self ⇒ %return
Method: get-update-texture self ⇒ %return

Gets the texture previously set via gltexture-builder:set-update-texture or #f if none was set.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a <GdkTexture>, or #f.

The texture

Method: gltexture-builder:get-width self ⇒ %return
Method: get-width self ⇒ %return

Gets the width previously set via gltexture-builder:set-width or 0 if the width wasn’t set.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

%return

Returned: a 32-bit integer.

The width

Procedure: gltexture-builder:new ⇒ %return

Creates a new texture builder.

%return

Returned: a <GdkGLTextureBuilder>.

the new GdkTextureBuilder

Method: gltexture-builder:set-color-state self color-state
Method: set-color-state self color-state

Sets the color state for the texture.

By default, the sRGB colorstate is used. If you don’t know what colorstates are, this is probably the right thing.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

color-state

Passed: a <GdkColorState>.

a <GdkColorState>

Method: gltexture-builder:set-context self [context]
Method: set-context self [context]

Sets the context to be used for the texture. This is the context that owns the texture.

The context must be set before calling gltexture-builder:build.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

context

Passed, or left out: a <GdkGLContext>, or #f.

The context the texture belongs to or #f to unset

Method: gltexture-builder:set-format self format
Method: set-format self format

Sets the format of the texture. The default is r8g8b8a8-premultiplied.

The format is the preferred format the texture data should be downloaded to. The format must be supported by the GL version of gltexture-builder:context.

GDK’s texture download code assumes that the format corresponds to the storage parameters of the GL texture in an obvious way. For example, a format of r16g16b16a16-premultiplied is expected to be stored as GL_RGBA16 texture, and g8a8 is expected to be stored as GL_RG8 texture.

Setting the right format is particularly useful when using high bit depth textures to preserve the bit depth, to set the correct value for unpremultiplied textures and to make sure opaque textures are treated as such.

Non-RGBA textures need to have swizzling parameters set up properly to be usable in GSK’s shaders.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

format

Passed: a <GdkMemoryFormat>, or one of its symbols.

The texture’s format

Method: gltexture-builder:set-has-mipmap self has-mipmap
Method: set-has-mipmap self has-mipmap

Sets whether the texture has a mipmap. This allows the renderer and other users of the generated texture to use a higher quality downscaling.

Typically, the glGenerateMipmap function is used to generate a mimap.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

has-mipmap

Passed: a boolean.

Whether the texture has a mipmap

Method: gltexture-builder:set-height self height
Method: set-height self height

Sets the height of the texture.

The height must be set before calling gltexture-builder:build.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

height

Passed: a 32-bit integer.

The texture’s height or 0 to unset

Method: gltexture-builder:set-id self id
Method: set-id self id

Sets the texture id of the texture. The texture id must remain unmodified until the texture was finalized. See gltexture-builder:build for a longer discussion.

The id must be set before calling gltexture-builder:build.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

id

Passed: an unsigned 32-bit integer.

The texture id to be used for creating the texture

Method: gltexture-builder:set-sync self [sync]
Method: set-sync self [sync]

Sets the GLSync object to use for the texture.

GTK will wait on this object before using the created <GdkTexture>.

The destroy function that is passed to gltexture-builder:build is responsible for freeing the sync object when it is no longer needed. The texture builder does not destroy it and it is the callers responsibility to make sure it doesn’t leak.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

sync

Passed, or left out: a foreign pointer, or a bytevector, or #f.

the GLSync object

Method: gltexture-builder:set-update-region self [region]
Method: set-update-region self [region]

Sets the region to be updated by this texture. Together with gltexture-builder:update-texture this describes an update of a previous texture.

When rendering animations of large textures, it is possible that consecutive textures are only updating contents in parts of the texture. It is then possible to describe this update via these two properties, so that GTK can avoid rerendering parts that did not change.

An example would be a screen recording where only the mouse pointer moves.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

region

Passed, or left out: a <CairoRegion>, or #f.

the region to update

Method: gltexture-builder:set-update-texture self [texture]
Method: set-update-texture self [texture]

Sets the texture to be updated by this texture. See gltexture-builder:set-update-region for an explanation.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

texture

Passed, or left out: a <GdkTexture>, or #f.

the texture to update

Method: gltexture-builder:set-width self width
Method: set-width self width

Sets the width of the texture.

The width must be set before calling gltexture-builder:build.

self

Passed: a <GdkGLTextureBuilder>.

a <GdkGLTextureBuilder>

width

Passed: a 32-bit integer.

The texture’s width or 0 to unset