15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    SGIS_blended_overlay
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GLX_SGIS_blended_overlay
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciVersion
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    $Date: 1997/10/29 20:56:43 $ $Revision: 1.5 $
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNumber
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    142
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciDependencies
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    EXT_visual_info is required
205bd8deadSopenharmony_ci    GLX_SGI_color_range affects the definition of this extension
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciOverview
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    This extension augments the set of transparency types for GLX
255bd8deadSopenharmony_ci    visuals (defined by the EXT_visual_info GLX extension).  A new
265bd8deadSopenharmony_ci    transparency type designated BLENDED_RGBA_SGIS is defined for
275bd8deadSopenharmony_ci    overlay windows supporting an alpha color component.  Instead of
285bd8deadSopenharmony_ci    using a particular transparent pixel or color value to indicate
295bd8deadSopenharmony_ci    transparency, a window created with a BLENDED_RGBA_SGIS
305bd8deadSopenharmony_ci    transparency type visual blends with the lower frame buffer layers
315bd8deadSopenharmony_ci    based on the overlay window's per-pixel alpha component.
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    The overlay blend function is:
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci      if ( Cu is color index pixel type ) then
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci        if ( Ao > 0.0 ) then
385bd8deadSopenharmony_ci          Cd = Co    /* Non-zero overlay alpha simply uses overlay color */
395bd8deadSopenharmony_ci        else
405bd8deadSopenharmony_ci          Cd = Cu    /* Note: later CI cmap turns Cd index into true color */
415bd8deadSopenharmony_ci        endif
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci      else    /* Cu is an RGBA, RGB, L, or LA pixel type */
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci        /* blend overlay color with normal color based on overlay alpha */
465bd8deadSopenharmony_ci        Cd = Co * (Ao,Ao,Ao,Ao) + Cu * ( (1,1,1,1) - (Ao,Ao,Ao,Ao) )
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci      endif
495bd8deadSopenharmony_ci
505bd8deadSopenharmony_ci    where Cd is the resulting displayed color.  Co is the RGBA
515bd8deadSopenharmony_ci    quadruplet for the overlay RGBA components of the overlay window
525bd8deadSopenharmony_ci    pixel.  Ao is the alpha component for the overlay alpha component
535bd8deadSopenharmony_ci    of the overlay window pixel.  Cu is the RGBA quadruplet for the
545bd8deadSopenharmony_ci    RGBA components of the displayed pixel if no overlay where present
555bd8deadSopenharmony_ci    in the overlay window's layer (or any higher level).  Think of Cu
565bd8deadSopenharmony_ci    as the displayable color "under" the BLENDED_RGBA_SGIS overlay
575bd8deadSopenharmony_ci    pixel.
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    In the case of extended range frame buffer formats, the overlay
605bd8deadSopenharmony_ci    blend function is applied post-clamping to the [0,1] range.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    Here are some of the uses for blended RGBA overlays:
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci      Render antialiased lines, points, and polygons in the overlays
655bd8deadSopenharmony_ci      with GL_LINE_SMOOTH, GL_POINT_SMOOTH, and GL_POLYGON_SMOOTH.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci      Alpha blended antiliasing could be used on the overlay boundaries
685bd8deadSopenharmony_ci      of overlay control panels and boat hulls.
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ci      Clean blending of overlaid mattes for live video.  Live video
715bd8deadSopenharmony_ci      stream could be overlaid by computer generated overlaid
725bd8deadSopenharmony_ci      graphics.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci      Swank user interface support for sweeping out irregular screen
755bd8deadSopenharmony_ci      regions by painiting the region in the overlay with a fractional
765bd8deadSopenharmony_ci      alpha to blend the sweeped region with some constant color in the
775bd8deadSopenharmony_ci      overlay.
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci      Swank brush shapes for 3D painting that let you see the blended
805bd8deadSopenharmony_ci      pixels underneather the overlay brush shape.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci      Really smooth (ie, subpixel positioned), full-color, antialiased
835bd8deadSopenharmony_ci      cursors (application drawn into a blended RGBA overlay).
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ciIP Status
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    Silicon Graphics has filed for patent protection for some of the
885bd8deadSopenharmony_ci    techniques described in this extension document.
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ciIssues
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci    *  Are any other blending functions interesting?  NO.
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    *  Rather unlikely but you could have multiple layers of blended
955bd8deadSopenharmony_ci       overlays and/or normal overlays.  If two layers of blended overlays
965bd8deadSopenharmony_ci       were present, the upper layer should be blended with the resulting
975bd8deadSopenharmony_ci       blend of the lower overlay with the normal plane.  YES.
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci       (Warning, be careful about multiple blending using
1005bd8deadSopenharmony_ci       non-premultiplied alpha.  See Porter & Duff SIGGRAPH paper.)
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    *  X does not all rendering in the alpha bitplanes.  X rendering
1035bd8deadSopenharmony_ci       should be assumed to always draw an alpha of 1.0.  This means that
1045bd8deadSopenharmony_ci       a BLENDED_RGBA_SGIS overlay will act as an overlay with no
1055bd8deadSopenharmony_ci       transparent pixel when it comes to X rendering.  Blended overlays
1065bd8deadSopenharmony_ci       overlays will only be usable for transparency via OpenGL
1075bd8deadSopenharmony_ci       rendering.  The SEVER_OVERLAY_VISUALS (SOV) X convention will
1085bd8deadSopenharmony_ci       therefore advertise the visual as having transparency type None (no
1095bd8deadSopenharmony_ci       new transparency type will be added to SOV).  YES.
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci    *  If the alpha component of the frame buffer is displayable (ie, sent
1125bd8deadSopenharmony_ci       out with the video signal), what alpha value should be generated
1135bd8deadSopenharmony_ci       when blended overlays are present?  Is the resulting blended alpha
1145bd8deadSopenharmony_ci       what you would want?  Perhaps merely sending the normal plane alpha
1155bd8deadSopenharmony_ci       is better.  Unresolved.
1165bd8deadSopenharmony_ci
1175bd8deadSopenharmony_ci    *  Should frame buffer layers that supporte extended precision (via
1185bd8deadSopenharmony_ci       the GLX_SGI_color_range extension) be blended before clamping
1195bd8deadSopenharmony_ci       the color components to [0,1]?  NO.
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci       Both the overlay and normal layer must both be clamped to [0,1]
1225bd8deadSopenharmony_ci       before the overlay blend function is performed.
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    *  Does the overlay's full alpha component precision need to be
1255bd8deadSopenharmony_ci       used for the overlay blend function?  NO.
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci       For example, if the overlay had 8 bits of alpha, the overlay
1285bd8deadSopenharmony_ci       blend function might "get away with" only blending with the 4
1295bd8deadSopenharmony_ci       most significant bits of the alpha component.  This might allow
1305bd8deadSopenharmony_ci       cheaper multipliers for the bandwidth-intensive overlay blend
1315bd8deadSopenharmony_ci       function.  There is no direct way to query what alpha precision
1325bd8deadSopenharmony_ci       the overlay blend uses.  Obviously, implementations are
1335bd8deadSopenharmony_ci       encouraged to use as much overlay precision as is available.
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci    *  How does a blended overlay interact when it covers a color index
1365bd8deadSopenharmony_ci       window?  If the overlay alpha is zero, use the color index
1375bd8deadSopenharmony_ci       pixel.  A non-zero alpha simply uses the overlay color as is.
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    *  How does a blended overlay interact when it covers an X
1405bd8deadSopenharmony_ci       DirectColor visual?  DirectColor has RGB components that are
1415bd8deadSopenharmony_ci       then passed through (generally as part of video scan-out) a
1425bd8deadSopenharmony_ci       per-component colormap (ie, look-up tables).  (The DirectColor
1435bd8deadSopenharmony_ci       colormap is often implemented by overloading the gamma tables).
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci       Arguably, the blending should use the post-DirectColor colormap
1465bd8deadSopenharmony_ci       color values (same for color index, PseudoColor, etc), but in
1475bd8deadSopenharmony_ci       practice, this is a colormap lookup that typically happens
1485bd8deadSopenharmony_ci       within the video display subsystem so it is not reasonable to
1495bd8deadSopenharmony_ci       expect the overlay blending be put off so long.
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci       RESOLUTION: DirectColor visual color components should overlay
1525bd8deadSopenharmony_ci       blended pre-DirectColor colormap conversion.  In practice, this
1535bd8deadSopenharmony_ci       means that DirectColor will be treated no differently from
1545bd8deadSopenharmony_ci       TrueColor visuals.
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    *  What is the relationship between blended overlays and channel
1575bd8deadSopenharmony_ci       compositing?  None, they are independent and orthogonal
1585bd8deadSopenharmony_ci       features.  Channel compositing happens well after blended
1595bd8deadSopenharmony_ci       overlays.
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ciNew Procedures and Functions
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    None
1645bd8deadSopenharmony_ci
1655bd8deadSopenharmony_ciNew Tokens
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    Returned by glXGetConfig, and accepted by the <attrib_list>
1685bd8deadSopenharmony_ci    parameter of glXChooseVisual (following the GLX_TRANSPARENT_TYPE_EXT
1695bd8deadSopenharmony_ci    token):
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci        GLX_BLENDED_RGBA_SGIS           0x8025
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ci    (EXT_visual_info previously defined GLX_NONE_EXT,
1745bd8deadSopenharmony_ci    GLX_TRANSPARENT_RGB_EXT, and GLX_TRANSPARENT_INDEX_EXT.)
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.0 Specification (OpenGL Operation)
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    None
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.0 Specification (Rasterization)
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    None
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.0 Specification (Per-Fragment Operations and
1855bd8deadSopenharmony_cithe Framebuffer)
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.0 Specification (Special Functions)
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    None
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.0 Specification (State and State Requests)
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    None
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ciAdditions to the GLX Specification
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    Changed beginning of the paragraph from the EXT_visual_info
1995bd8deadSopenharmony_ci    specification:
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci      The visual attribute GLX_TRANSPARENT_TYPE_EXT indicates whether
2025bd8deadSopenharmony_ci      or not the visual supports transparency, and if it does support
2035bd8deadSopenharmony_ci      transparency, what type of transparency is available. If the
2045bd8deadSopenharmony_ci      attribute is set to GLX_NONE_EXT then windows created with the
2055bd8deadSopenharmony_ci      visual will not have any transparent pixels. If the attribute is
2065bd8deadSopenharmony_ci      GLX_TRANSPARENT_RGB_EXT, GLX_TRANSPARENT_INDEX_EXT, or
2075bd8deadSopenharmony_ci      GLX_BLENDED_RGBA_SGIS then the visual supports transparency. ...
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    Add the following paragraph after the discussion of paragraph from
2105bd8deadSopenharmony_ci    the EXT_visual_info specification addition beginning "The visual
2115bd8deadSopenharmony_ci    attribute GLX_TRANSPARENT_TYPE_EXT indicates..."
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci      GLX_BLENDED_RGBA_SGIS is applicable to TrueColor and DirectColor
2145bd8deadSopenharmony_ci      visuals.  There is no particular transparent pixel value for this
2155bd8deadSopenharmony_ci      visual.  Instead, the alpha component of pixels belonging to the
2165bd8deadSopenharmony_ci      overlay window are used to blend the overlay color with the
2175bd8deadSopenharmony_ci      displayable color of the frame buffer layers below the
2185bd8deadSopenharmony_ci      GLX_BLENDED_RGBA_SGIS overlay pixels.
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci      The GLX_BLENDED_RGBA_SGIS overlay blend function is:
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci        if ( Cu is color index pixel type ) then
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci          if ( Ao > 0.0 ) then
2255bd8deadSopenharmony_ci            Cd = Co    /* Non-zero overlay alpha simply uses overlay color */
2265bd8deadSopenharmony_ci          else
2275bd8deadSopenharmony_ci            Cd = Cu    /* Note: later CI colormap turns Cd index into true color */
2285bd8deadSopenharmony_ci          endif
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci        else    /* Cu is an RGBA, RGB, L, or LA pixel type */
2315bd8deadSopenharmony_ci
2325bd8deadSopenharmony_ci          /* blend overlay color with normal color based on overlay alpha */
2335bd8deadSopenharmony_ci          Cd = Co * (Ao,Ao,Ao,Ao) + Cu * ( (1,1,1,1) - (Ao,Ao,Ao,Ao) )
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ci        endif
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci      where Cd is the resulting displayed color.  Co is the RGBA
2385bd8deadSopenharmony_ci      quadruplet for the overlay RGBA components of the overlay window
2395bd8deadSopenharmony_ci      pixel.  Ao is the alpha component for the overlay alpha component
2405bd8deadSopenharmony_ci      of the overlay window pixel.  Cu is the RGBA quadruplet for the
2415bd8deadSopenharmony_ci      RGBA components of the displayed pixel if no overlay where present
2425bd8deadSopenharmony_ci      in the overlay window's layer (or any higher level).  Think of Cu
2435bd8deadSopenharmony_ci      as the displayable color "under" the BLENDED_RGBA_SGIS overlay
2445bd8deadSopenharmony_ci      pixel.
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci      In the case of extended range frame buffer formats (from the
2475bd8deadSopenharmony_ci      GLX_SGI_color_range spec), the overlay blend function is applied
2485bd8deadSopenharmony_ci      post-clamping to the [0,1] range during display scan out.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    Changed paragraph from the EXT_visual_info specification:
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci      If GLX_TRANSPARENT_TYPE_EXT is GLX_NONE_EXT,
2535bd8deadSopenharmony_ci      GLX_TRANSPARENT_RGB_EXT, or GLX_BLENDED_RGBA_SGIS, then the value
2545bd8deadSopenharmony_ci      returned for GLX_TRANSPARENT_INDEX_VALUE_EXT is undefined.  If
2555bd8deadSopenharmony_ci      GLX_TRANSPARENT_TYPE_EXT is GLX_NONE_EXT,
2565bd8deadSopenharmony_ci      GLX_TRANSPARENT_INDEX_EXT, or GLX_BLENDED_RGBA_SGIS, then the
2575bd8deadSopenharmony_ci      values returned for GLX_TRANSPARENT_RED_VALUE_EXT,
2585bd8deadSopenharmony_ci      GLX_TRANSPARENT_GREEN_VALUE_EXT, and
2595bd8deadSopenharmony_ci      GLX_TRANSPARENT_BLUE_VALUE_EXT are undefined.
2605bd8deadSopenharmony_ci
2615bd8deadSopenharmony_ci    Change line in Table 1 to the following:
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci        Attribute                 Type      Notes
2645bd8deadSopenharmony_ci        ---------                 ----      -----
2655bd8deadSopenharmony_ci        GLX_TRANSPARENT_TYPE_EXT enum       None, TRANSPARENT_RGB_EXT, TRANSPARENT_INDEX_EXT,
2665bd8deadSopenharmony_ci                                            or BLENDED_RGBA_SGIS
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci        Table 1: Configuration attributes
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ciGLX Protocol
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    One property type/property value pair is augmented with a new
2735bd8deadSopenharmony_ci    proprty value.  The augmented property type/property value pair is
2745bd8deadSopenharmony_ci    now encoded as
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci    4           ENUM                    property type
2775bd8deadSopenharmony_ci                0x23                    GLX_TRANSPARENT_TYPE_EXT
2785bd8deadSopenharmony_ci    4           ENUM                    property value
2795bd8deadSopenharmony_ci                0x8000                  GLX_NONE_EXT
2805bd8deadSopenharmony_ci                0x8008                  GLX_TRANSPARENT_RGB_EXT
2815bd8deadSopenharmony_ci                0x8009                  GLX_TRANSPARENT_INDEX_EXT
2825bd8deadSopenharmony_ci                0x8025                  GLX_BLENDED_RGBA_SGIS
2835bd8deadSopenharmony_ci
2845bd8deadSopenharmony_ciErrors
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    None
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ciNew State
2895bd8deadSopenharmony_ci
2905bd8deadSopenharmony_ci    None
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ciNew Implementation Dependent State
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci    None.
2955bd8deadSopenharmony_ci
296