Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gtk gtk
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,501
    • Issues 1,501
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 248
    • Merge requests 248
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gtkgtk
  • Merge requests
  • !4703

GtkGLArea red/blue channel swapping on OpenGL ES (GTK 3)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Benjamin Moody requested to merge benjaminmoody/gtk:gtk3-gles-red-blue into gtk-3-24 May 08, 2022
  • Overview 0
  • Commits 1
  • Pipelines 1
  • Changes 1

When using GtkGLArea on OpenGL ES, GDK wrongly swaps the red and blue channels (application draws a red teapot, blue teapot appears on screen.)

This is because the "software fallback" case in gdk_cairo_draw_from_gl uses the wrong channel order (except on Windows, for some reason.)

To be more precise: Cairo requires an image in one particular format (BGRA, on little-endian systems.) glReadPixels on OpenGL is required to support that format, but on OpenGL ES, it isn't required. Many OpenGL ES implementations do incidentally support BGRA, but by my reading of the specs, there's no way for them to advertise that support.

Consequently, GDK just uses the one format that is supported (RGBA) and forgets that this is the wrong format for cairo.

Note that this bug is also apparently present in GTK 4, although it doesn't affect GtkGLArea since GtkGLArea no longer uses gdk_cairo_draw_from_gl.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: gtk3-gles-red-blue