### Function

# Gdk cairo_draw_from_gl

deprecated: 4.6 since: 4.0

#### Declaration [src]

    void
    gdk_cairo_draw_from_gl (
      cairo_t* cr,
      GdkSurface* surface,
      int source,
      int source_type,
      int buffer_scale,
      int x,
      int y,
      int width,
      int height
    )

#### Description [src]

The main way to not draw GL content in GTK.

It takes a render buffer ID (`source_type` == GL_RENDERBUFFER) or a texture id (`source_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_t`.

This will work for all `cairo_t`, 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.

Available since: 4.0

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 `gdk_gl_texture_new()`; if you want to use that texture in Cairo, use `gdk_texture_download()` to download the data into a Cairo image surface.

#### Parameters

`cr`

  Type: `cairo_t`

  A cairo context.

  The data is owned by the caller of the function.

`surface`

  Type: `GdkSurface`

  The surface we’re rendering for (not necessarily into)

  The data is owned by the caller of the function.

`source`

  Type: `int`

  The GL ID of the source buffer.

`source_type`

  Type: `int`

  The type of the `source`.

`buffer_scale`

  Type: `int`

  The scale-factor that the `source` buffer is allocated for.

`x`

  Type: `int`

  The source x position in `source` to start copying from in GL coordinates.

`y`

  Type: `int`

  The source y position in `source` to start copying from in GL coordinates.

`width`

  Type: `int`

  The width of the region to draw.

`height`

  Type: `int`

  The height of the region to draw.