gtk/gdk
Alexander Larsson 038aac6275 gdk: Add support for OpenGL
This adds the new type GdkGLContext that wraps an OpenGL context for a
particular native window. It also adds support for the gdk paint
machinery to use OpenGL to draw everything. As soon as anyone creates
a GL context for a native window we create a "paint context" for that
GdkWindow and switch to using GL for painting it.

This commit contains only an implementation for X11 (using GLX).

The way painting works is that all client gl contexts draw into
offscreen buffers rather than directly to the back buffer, and the
way something gets onto the window is by using gdk_cairo_draw_from_gl()
to draw part of that buffer onto the draw cairo context.

As a fallback (if we're doing redirected drawing or some effect like a
cairo_push_group()) we read back the gl buffer into memory and composite
using cairo. This means that GL rendering works in all cases, including
rendering to a PDF. However, this is not particularly fast.

In the *typical* case, where we're drawing directly to the window in
the regular paint loop we hit the fast path. The fast path uses opengl
to draw the buffer to the window back buffer, either by blitting or
texturing. Then we track the region that was drawn, and when the draw
ends we paint the normal cairo surface to the window (using
texture-from-pixmap in the X11 case, or texture from cairo image
otherwise) in the regions where there is no gl painted.

There are some complexities wrt layering of gl and cairo areas though:
* We track via gdk_window_mark_paint_from_clip() whenever gtk is
  painting over a region we previously rendered with opengl
  (flushed_region). This area (needs_blend_region) is blended
  rather than copied at the end of the frame.
* If we're drawing a gl texture with alpha we first copy the current
  cairo_surface inside the target region to the back buffer before
  we blend over it.

These two operations allow us full stacking of transparent gl and cairo
regions.
2014-10-13 10:43:31 -04:00
..
broadway gdk: Deprecate static gravities 2014-10-06 02:38:40 +02:00
deprecated Mark the GdkColor struct as deprecated 2014-08-20 17:19:30 +02:00
quartz gdk: Deprecate static gravities 2014-10-06 02:38:40 +02:00
wayland wayland: write wl_data_offer data asynchronously 2014-10-10 20:58:55 +02:00
win32 Fix monitors enumeration bug 2014-10-06 22:48:08 +00:00
x11 gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
COPYING Change FSF Address 2012-02-27 17:06:11 +00:00
fallback-c89.c gdk/fallback-c89.c: Add fallback for round() 2013-03-13 13:22:46 +08:00
gdk.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdk.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkapplaunchcontext.c docs: replace all <examples> with markdown headings 2014-02-04 16:58:54 -05:00
gdkapplaunchcontext.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkapplaunchcontextprivate.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkcairo.c Add internal gdk_cairo_region_from_clip helper 2014-10-13 10:43:31 -04:00
gdkcairo.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkconfig.h.win32 Clean up the pre-configured gdkconfig.h.win32 2013-05-28 13:04:37 +08:00
gdkconfig.h.win32_broadway Add Visual Studio Build Support for Broadway 2013-08-02 11:20:19 +08:00
gdkcursor.c gdk: assorted introspection and documentation fixes 2014-05-19 11:47:59 -07:00
gdkcursor.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkcursorprivate.h gdk: Add gdk_cursor_get_surface() 2013-08-07 13:34:10 +02:00
gdkdeprecated.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
gdkdevice.c GdkDevice: Avoid unnecessary critical 2014-10-05 19:43:06 -04:00
gdkdevice.h Use GDK's current window tracking when synthesizing events in GTK+ 2014-03-12 23:03:53 -04:00
gdkdevicemanager.c gdk: Document the behavior of device grabs on slave devices 2014-07-21 22:16:05 +02:00
gdkdevicemanager.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkdevicemanagerprivate.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkdeviceprivate.h gdk: Convert mouse position to doubles, add new getters 2013-07-03 14:39:25 +02:00
gdkdisplay.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkdisplay.h gdk: Deprecate compositing support 2014-10-12 04:54:35 +02:00
gdkdisplaymanager.c gdk: assorted introspection and documentation fixes 2014-05-19 11:47:59 -07:00
gdkdisplaymanager.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkdisplaymanagerprivate.h gdk: Unvfuncify gdk_display_manager_open_display() 2013-04-19 16:23:43 -04:00
gdkdisplayprivate.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkdnd.c gdk: Remove check for source window 2014-09-01 19:17:53 +02:00
gdkdnd.h gdk: Add GDK_DRAG_PROTO_WAYLAND 2014-09-01 19:17:53 +02:00
gdkdndprivate.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkenumtypes.c.template Include config.h in gdkenumtypes.c.template 2013-03-15 09:19:35 -04:00
gdkenumtypes.h.template Use GDK_AVAILABLE_IN_ALL for generated enum types 2013-05-05 15:38:46 -04:00
gdkevents.c Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkevents.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkframeclock.c gdk: add many missing (nullable) return value annotations 2014-05-11 11:48:32 -04:00
gdkframeclock.h docs: fix typo in type name 2014-01-20 18:27:28 -05:00
gdkframeclockidle.c Changed obsolete FSF portal addresses to web address 2014-01-12 19:56:49 +07:00
gdkframeclockidle.h GdkFrameClockIdle: Add a missing declaration 2014-09-05 20:44:22 -04:00
gdkframeclockprivate.h docs: add docs for GtkFrameClock 2014-01-20 18:27:28 -05:00
gdkframetimings.c docs: use proper apostrophe 2014-02-07 13:06:10 -05:00
gdkframetimings.h GdkFrameTimings: add documentation 2013-02-14 17:19:52 -05:00
gdkgl.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkglcontext.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkglcontext.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkglcontextprivate.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkglobals.c Change FSF Address 2012-02-27 17:06:11 +00:00
gdkinternals.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkintl.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkkeynames.c Keep XF86 keysym names working 2013-04-19 20:11:39 -04:00
gdkkeys.c gdk: add many missing (nullable) return value annotations 2014-05-11 11:48:32 -04:00
gdkkeys.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkkeysprivate.h gdk: Refactor gdk_keyval_convert_case() 2013-04-16 15:30:14 +02:00
gdkkeysyms-compat.h Update gdkkeysyms.h header 2013-04-19 20:11:38 -04:00
gdkkeysyms-update.pl gdkkeysyms-update: Remove workarounds for old bugs 2013-07-17 16:40:05 -04:00
gdkkeysyms.h Update gdkkeysyms.h header 2013-04-19 20:11:38 -04:00
gdkkeyuni.c docs: use Returns: consistently 2014-02-19 18:56:05 -05:00
gdkmain.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkmarshalers.list Bug 631599 - Allow to use arbitrary surfaces for offscreen windows 2010-10-14 13:25:23 +02:00
gdkoffscreenwindow.c gdk: Deprecate static gravities 2014-10-06 02:38:40 +02:00
gdkpango.c docs: Another round of markup removal 2014-03-29 00:24:15 -04:00
gdkpango.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkpixbuf-drawable.c Forgotten file 2014-05-22 09:31:15 -04:00
gdkpixbuf.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkprivate.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkproperty.c Trivial formatting fix 2014-08-30 00:53:21 -04:00
gdkproperty.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkrectangle.c docs: use proper apostrophe 2014-02-07 13:06:10 -05:00
gdkrectangle.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkrgba.c gdk_rgba_parse : do not segfault on null string 2014-09-28 21:18:10 +02:00
gdkrgba.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkscreen.c Improve workarea documentation 2014-09-24 20:34:16 -04:00
gdkscreen.h Revert "Introduce API to get the preferred visual" 2014-02-10 22:15:28 -05:00
gdkscreenprivate.h Handle resolution changes in the GDK backend code 2014-07-13 15:35:23 -04:00
gdkselection.c gdk: assorted introspection and documentation fixes 2014-05-19 11:47:59 -07:00
gdkselection.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdktestutils.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdkthreads.h Add GDK_AVAILABLE_IN_ALL annotations in gdk 2013-05-05 15:38:46 -04:00
gdktypes.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkversionmacros.h.in Add 3.16 deprecation macros too 2014-09-30 00:03:25 -04:00
gdkvisual.c Small doc improvement 2014-09-07 17:14:37 -04:00
gdkvisual.h Drop GDK_MULTIHEAD_SAFE 2014-06-11 21:55:15 -04:00
gdkvisualprivate.h Change FSF Address 2012-02-27 17:06:11 +00:00
gdkwindow.c gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkwindow.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkwindowimpl.c gdkwindow: Provide a default implementation of process_updates_recurse 2014-06-22 10:20:50 -04:00
gdkwindowimpl.h gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
gdkx.h Change FSF Address 2012-02-27 17:06:11 +00:00
gen-keyname-table.pl gdk: Make gen-keyname-table.pl work again 2011-10-26 10:36:43 +01:00
keyname-table.h docs: use proper quotations instead of '*' 2014-02-07 14:22:39 -05:00
keynames-translate.txt Add AudioMicMute 2013-07-17 17:52:19 -04:00
keynames.txt Fix key "Page_Down" identified as "Next" 2013-10-24 18:48:33 -04:00
Makefile.am gdk: Add support for OpenGL 2014-10-13 10:43:31 -04:00
makefile.msc win32: gdk3 resurrection 2011-01-02 13:33:04 +01:00