1. 09 Feb, 2015 1 commit
    • Emmanuele Bassi's avatar
      GL: Split GL context creation in two phases · 22e6f37c
      Emmanuele Bassi authored
      One of the major requests by OpenGL users has been the ability to
      specify settings when creating a GL context, like the version to use
      or whether the debug support should be enabled.
      
      We have a couple of requirements in terms of API:
      
       • avoid, if at all possible, the "C arrays of integers with
         attribute, value pairs", which are hard to write and hard
         to bind in non-C languages.
       • allow failing in a recoverable way.
       • do not make the GL context creation API a mess of arguments.
      
      Looking at prior art, it seems that a common pattern is to split the
      construction phase in two:
      
       • a first phase that creates a GL context wrapper object and
         does preliminary checks on the environment.
       • a second phase that creates the backend-specific GL object.
      
      We adopted a similar pattern:
      
       • gdk_window_create_gl_context() creates a GdkGLContext
       • gdk_gl_context_realize() creates the underlying resources
      
      Calling gdk_gl_context_make_current() also realizes the context, so
      simple GL users do not need to care. Advanced users will want to
      call gdk_window_create_gl_context(), set up the optional requirements,
      and then call gdk_gl_context_realize(). If either of these two steps
      fails, it's possible to recover by changing the requirements, or simply
      creating a new GdkGLContext instance.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=741946
      22e6f37c
  2. 01 Feb, 2015 1 commit
  3. 30 Jan, 2015 2 commits
  4. 28 Jan, 2015 2 commits
  5. 24 Jan, 2015 1 commit
  6. 18 Jan, 2015 2 commits
  7. 22 Nov, 2014 2 commits
  8. 20 Nov, 2014 1 commit
  9. 10 Nov, 2014 4 commits
  10. 08 Nov, 2014 2 commits
  11. 07 Nov, 2014 1 commit
  12. 06 Nov, 2014 4 commits
  13. 30 Oct, 2014 1 commit
  14. 28 Oct, 2014 5 commits
  15. 27 Oct, 2014 2 commits
  16. 16 Oct, 2014 1 commit
    • Benjamin Otte's avatar
      gdk: Add GDK_DEBUG=nogl · 672a67d0
      Benjamin Otte authored
      This is mostly useful for fallback testing.
      
      I suppose if people want finer grained GL ability testing, they can use
      Mesa environment variables to tune things.
      672a67d0
  17. 15 Oct, 2014 1 commit
  18. 13 Oct, 2014 7 commits
    • Matthias Clasen's avatar
      Correct Since tags · 7a80c3b0
      Matthias Clasen authored
      7a80c3b0
    • Alexander Larsson's avatar
      gl: Make gdk_gl_context_make_current() return void · fdeb4f8c
      Alexander Larsson authored
      Its not really reasonable to handle failures to make_current, it
      basically only happens if you pass invalid arguments to it, and
      thats not something we trap on similar things on the X drawing side.
      
      If GL is not supported that should be handled by the context creation
      failing, and anything going wrong after that is essentially a critical
      (or an async X error).
      fdeb4f8c
    • Alexander Larsson's avatar
      gl: Make all user GdkGLContexts not attached to any window · 236d08c3
      Alexander Larsson authored
      We make user facing gl contexts not attached to a surface if possible,
      or attached to dummy surfaces. This means nothing can accidentally
      read/write to the toplevel back buffer.
      236d08c3
    • Alexander Larsson's avatar
      Add GDK_ALWAYS_USE_GL debug hack · 87970ea2
      Alexander Larsson authored
      If this is set we always use GL to render each window, even
      if there are no GL widgets in the window.
      87970ea2
    • Alexander Larsson's avatar
      gdk: Add support for OpenGL · 038aac62
      Alexander Larsson authored
      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.
      038aac62
    • Alexander Larsson's avatar
      Add gdk_window_mark_paint_from_clip and call from widget drawing · d0147a6f
      Alexander Larsson authored
      This is a new function that gets called every time we're drawing
      some area in the Gtk paint machinery. It is a no-op right now, but
      it will be required later to keep track of what areas which
      we previously rendered with GL was overwritten with cairo contents.
      d0147a6f
    • Alexander Larsson's avatar
      Change the way the update area is tracked during paint · a8f11835
      Alexander Larsson authored
      First of all we track the current update area during an
      update in window->active_update_area. This will be used later
      in end_paint to know the damaged area.
      
      Secondly we keep track of old update areas for the last 2
      frames. This will later allow us to reuse old framebuffer
      contents in double or tripple buffer setups, only painting
      what has changed since then.
      a8f11835