Package: gdk

Function gdk:cairo-draw-from-gl

Lambda List

gdk:cairo-draw-from-gl (cr surface source type scale x y width height)

Arguments

cr -- a cairo:context-t instance
surface -- a gdk:surface object that is being rendered for, not necessarily into
source -- an integer for the GL ID of the source buffer
type -- an integer for the type of the source
scale -- an integer for the scale factor that the source buffer is allocated for
x -- an integer for the source x position in source to start copying from in GL coordinates
y -- an integer for the source y position in source to start copying from in GL coordinates
width -- an integer for the width of the region to draw
height -- an integer for the height of the region to draw

Details

This is the main way to draw GL content in GTK. It takes a render buffer ID (type == GL_RENDERBUFFER) or a texture ID (type == GL_TEXTURE) and draws it onto cr with an OVER operation, respecting the current clip. The top left corner of the rectangle specified by x, y, width and height will be drawn at the current (0,0) position of the Cairo context.

This will work for all Cairo contexts, as long as surface is realized, but the fallback implementation that reads back the pixels from the buffer may be used in the general case. In the case of direct drawing to a surface with no special effects applied to cr it will however use a more efficient approach.

For GL_RENDERBUFFER the code will always fall back to software for buffers with alpha components, so make sure you use GL_TEXTURE if using alpha.

Calling this may change the current GL context.

Warning

This function is deprecated since 4.6. The function is overly complex and produces broken output in various combinations of arguments. If you want to draw with GL textures in GTK, use the gdk:gl-texture-new function. If you want to use that texture in Cairo, use the gdk:texture-download function to download the data into a Cairo image surface.
 

See also

#2025-1-25