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.
The color state of the texture.
Its value is a <GdkColorState>, or #f.
Set it with (set! (gltexture-builder:color-state self) value).
The context owning the texture.
Its value is a <GdkGLContext>, or #f.
Set it with (set! (gltexture-builder:context self) value).
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).
If the texture has a mipmap.
Its value is a boolean.
Set it with (set! (gltexture-builder:has-mipmap self) value).
The height of the texture.
Its value is a 32-bit integer.
Set it with (set! (gltexture-builder:height self) value).
The texture ID to use.
Its value is an unsigned 32-bit integer.
Set it with (set! (gltexture-builder:id self) value).
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).
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).
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).
The width of the texture.
Its value is a 32-bit integer.
Set it with (set! (gltexture-builder:width self) value).
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.
Passed: a <GdkGLTextureBuilder>.
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.
Passed, or left out: a foreign pointer, or a bytevector, or #f.
user data to pass to the destroy function
Returned: a <GdkTexture>.
a newly built <GdkTexture>
Gets the color state previously set via gltexture-builder:set-color-state.
Passed: a <GdkGLTextureBuilder>.
Returned: a <GdkColorState>.
the color state
Gets the context previously set via gltexture-builder:set-context or #f if none was
set.
Passed: a <GdkGLTextureBuilder>.
Returned: a <GdkGLContext>, or #f.
The context
Gets the format previously set via gltexture-builder:set-format.
Passed: a <GdkGLTextureBuilder>.
Returned: a <GdkMemoryFormat>.
The format
Gets whether the texture has a mipmap.
Passed: a <GdkGLTextureBuilder>.
Returned: a boolean.
Whether the texture has a mipmap
Gets the height previously set via gltexture-builder:set-height or 0 if the height wasn’t
set.
Passed: a <GdkGLTextureBuilder>.
Returned: a 32-bit integer.
The height
Gets the texture id previously set via gltexture-builder:set-id or 0 if the id wasn’t set.
Passed: a <GdkGLTextureBuilder>.
Returned: an unsigned 32-bit integer.
The id
Gets the GLsync previously set via gltexture-builder:set-sync.
Passed: a <GdkGLTextureBuilder>.
Returned: a foreign pointer, or #f.
the GLSync
Gets the region previously set via gltexture-builder:set-update-region or #f if
none was set.
Passed: a <GdkGLTextureBuilder>.
Returned: a <CairoRegion>, or #f.
The region
Gets the texture previously set via gltexture-builder:set-update-texture or #f
if none was set.
Passed: a <GdkGLTextureBuilder>.
Returned: a <GdkTexture>, or #f.
The texture
Gets the width previously set via gltexture-builder:set-width or 0 if the width wasn’t set.
Passed: a <GdkGLTextureBuilder>.
Returned: a 32-bit integer.
The width
Creates a new texture builder.
Returned: a <GdkGLTextureBuilder>.
the new GdkTextureBuilder
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.
Passed: a <GdkGLTextureBuilder>.
Passed: a <GdkColorState>.
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.
Passed: a <GdkGLTextureBuilder>.
Passed, or left out: a <GdkGLContext>, or
#f.
The context the texture belongs to or #f to unset
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.
Passed: a <GdkGLTextureBuilder>.
Passed: a <GdkMemoryFormat>, or one of its
symbols.
The texture’s format
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.
Passed: a <GdkGLTextureBuilder>.
Passed: a boolean.
Whether the texture has a mipmap
Sets the height of the texture.
The height must be set before calling gltexture-builder:build.
Passed: a <GdkGLTextureBuilder>.
Passed: a 32-bit integer.
The texture’s height or 0 to unset
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.
Passed: a <GdkGLTextureBuilder>.
Passed: an unsigned 32-bit integer.
The texture id to be used for creating the texture
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.
Passed: a <GdkGLTextureBuilder>.
Passed, or left out: a foreign pointer, or a bytevector, or #f.
the GLSync object
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.
Passed: a <GdkGLTextureBuilder>.
Passed, or left out: a <CairoRegion>, or
#f.
the region to update
Sets the texture to be updated by this texture. See
gltexture-builder:set-update-region for an
explanation.
Passed: a <GdkGLTextureBuilder>.
Passed, or left out: a <GdkTexture>, or #f.
the texture to update
Sets the width of the texture.
The width must be set before calling gltexture-builder:build.
Passed: a <GdkGLTextureBuilder>.
Passed: a 32-bit integer.
The texture’s width or 0 to unset