15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_texture_from_pixmap
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GLX_EXT_texture_from_pixmap
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    James Jones, NVIDIA
125bd8deadSopenharmony_ci    Aaron Plattner, NVIDIA
135bd8deadSopenharmony_ci    Andy Ritger, NVIDIA
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ciContact
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ci    David Reveman, Novell, Inc. (davidr 'at' novell.com)
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciStatus
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    Complete
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciVersion
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci    17 (10 Feb 2009)
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ciNumber
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci    344
305bd8deadSopenharmony_ci
315bd8deadSopenharmony_ciDependencies
325bd8deadSopenharmony_ci
335bd8deadSopenharmony_ci    OpenGL 1.1 is required.
345bd8deadSopenharmony_ci    GLX 1.3 is required.
355bd8deadSopenharmony_ci    GL_EXT_framebuffer_object affects the definition of this extension.
365bd8deadSopenharmony_ci    GL_ARB_texture_rectangle affects the definition of this extension.
375bd8deadSopenharmony_ci    GL_ARB_texture_non_power_of_two affects the definition of this extension.
385bd8deadSopenharmony_ci    GL_SGIS_generate_mipmap affects the definition of this extension.
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciOverview
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    This extension allows a color buffer to be used for both rendering and
435bd8deadSopenharmony_ci    texturing.
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    Only color buffers of pixmaps can be used for texturing by this extension
465bd8deadSopenharmony_ci    but other types of drawables can be supported by future extensions layered
475bd8deadSopenharmony_ci    on top of this extension.
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    The functionality of this extension is similar to WGL_ARB_render_texture. 
505bd8deadSopenharmony_ci    However, the purpose of this extension is not to provide
515bd8deadSopenharmony_ci    "render to texture" like functionality but rather the ability to bind
525bd8deadSopenharmony_ci    an existing X drawable to a texture. Though, there is nothing that
535bd8deadSopenharmony_ci    prohibits it from being used for "render to texture".
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci    -   Windows are problematic as they can change size and therefore are not
565bd8deadSopenharmony_ci        supported by this extension.
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    -   Only a color buffer of a GLX pixmap created using an FBConfig with
595bd8deadSopenharmony_ci        attribute GLX_BIND_TO_TEXTURE_RGB_EXT or GLX_BIND_TO_TEXTURE_RGBA_EXT
605bd8deadSopenharmony_ci        set to TRUE can be bound as a texture.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    -   The texture internal format is determined when the color buffer
635bd8deadSopenharmony_ci        is associated with the texture, guaranteeing that the color 
645bd8deadSopenharmony_ci        buffer format is equivalent to the texture internal format.
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    -   A client can create a complete set of mipmap images if
675bd8deadSopenharmony_ci        EXT_framebuffer_object is supported.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ciIP Status 
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    There are no known IP issues. 
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ciIssues
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    1. What should this extension be called?
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    Even though it is very similar to WGL_ARB_render_texture that name is
795bd8deadSopenharmony_ci    not appropriate as the intention of this extension is not
805bd8deadSopenharmony_ci    "render to texture" like functionality.
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    EXT_texture_from_pixmap seams most appropriate. Layering of future
835bd8deadSopenharmony_ci    extensions on top of this extension for using other type of drawables
845bd8deadSopenharmony_ci    as textures follows the same conventions as vertex/pixel buffer objects
855bd8deadSopenharmony_ci    and vertex/fragment programs.
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci    2. Should we allow applications to render to different mipmap levels and
895bd8deadSopenharmony_ci    cube map faces?
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    In order to discourage the use of this extension as a render to texture
925bd8deadSopenharmony_ci    mechanism, cube maps and rendering directly to mip-map levels > 0 will
935bd8deadSopenharmony_ci    not be supported.  A new FBConfig attribute is introduced that specifies
945bd8deadSopenharmony_ci    whether or not drawables created with that config will support multiple
955bd8deadSopenharmony_ci    mipmap levels when bound to a texture.  The other mipmap levels can be
965bd8deadSopenharmony_ci    filled in by the EXT_framebuffer_object GenerateMipmapEXT function.
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci    Specifying which level of a pixmap was being rendered to on a per-drawable
995bd8deadSopenharmony_ci    basis, as was done in the WGL_ARB_render_texture extension, also
1005bd8deadSopenharmony_ci    introduces concurrency issues.  The state of the drawable when it was
1015bd8deadSopenharmony_ci    being rendered two by two separate threads of execution and both were
1025bd8deadSopenharmony_ci    changing the mipmap level was difficult to define.
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    It is also desireable to keep this extension as simple as possible.
1055bd8deadSopenharmony_ci    Adding functionality that complicates the implementation and that is not
1065bd8deadSopenharmony_ci    directly relevenat to the goal of exposing a mechanism for texturing from
1075bd8deadSopenharmony_ci    arbitrary X pixmaps is not productive.  If the ability to render directly
1085bd8deadSopenharmony_ci    to all levels of a texture is needed, EXT_framebuffer_object is the
1095bd8deadSopenharmony_ci    extension that should be used.
1105bd8deadSopenharmony_ci
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    3. Should 1D textures be supported?
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    X servers layered on top of an OpenGL implementation might not be able
1155bd8deadSopenharmony_ci    to support this.  A new FBConfig attribute is introduced specifying
1165bd8deadSopenharmony_ci    which texture targets a drawable created with the given FBConfig can
1175bd8deadSopenharmony_ci    be bound to.
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    4. What should the default value for GLX_TEXTURE_TARGET_EXT be?  Should
1215bd8deadSopenharmony_ci    users be required to set this value if GLX_TEXTURE_FORMAT_EXT is not
1225bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_NONE_EXT?
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    The implementation is capable of choosing a reasonable default, we simply
1255bd8deadSopenharmony_ci    need to specify the correct way to do so.  We can base the ordering on
1265bd8deadSopenharmony_ci    the properties of the pixmap and the texturing capabilities of the
1275bd8deadSopenharmony_ci    pixmap's FBConfig and the implementation.
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    The order is:
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ci    - If GL_ARB_texture_non_power_of_two is supported GL_TEXTURE_2D will
1325bd8deadSopenharmony_ci      be used for all pixmap sizes.
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci    - If only GL_ARB_texture_rectangle is supported GL_TEXTURE_2D will
1355bd8deadSopenharmony_ci      be used for all power of two pixmap sizes and GL_TEXTURE_RECTANGLE_ARB
1365bd8deadSopenharmony_ci      will be used for all non power of two pixmap sizes.
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    5. Should users be required to re-bind the drawable to a texture after
1405bd8deadSopenharmony_ci    the drawable has been rendered to?
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci    It is difficult to define what the contents of the texture would be if
1435bd8deadSopenharmony_ci    we don't require this.  Also, requiring this would allow implementations
1445bd8deadSopenharmony_ci    to perform an implicit copy at this point if they could not support
1455bd8deadSopenharmony_ci    texturing directly out of renderable memory.
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    The problem with defining the contents of the texture after rendering
1485bd8deadSopenharmony_ci    has occured to the associated drawable is that there is no way to
1495bd8deadSopenharmony_ci    synchronize the use of the buffer as a source and as a destination.
1505bd8deadSopenharmony_ci    Direct OpenGL rendering is not necessarily done in the same command
1515bd8deadSopenharmony_ci    stream as X rendering.  At the time the pixmap is used as the source
1525bd8deadSopenharmony_ci    for a texturing operation, it could be in a state halfway through a
1535bd8deadSopenharmony_ci    copyarea operation in which half of it is say, white, and half is the
1545bd8deadSopenharmony_ci    result of the copyarea operation.  How is this defined?  Worse, some
1555bd8deadSopenharmony_ci    other OpenGL application could be halfway through a frame of rendering
1565bd8deadSopenharmony_ci    when the composite manager sources from it.  The buffer might just
1575bd8deadSopenharmony_ci    contain the results of a "glClear" operation at that point.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    To gurantee tear-free rendering, a composite manager would run as follows:
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci    -receive request for compositing:
1625bd8deadSopenharmony_ci    XGrabServer()
1635bd8deadSopenharmony_ci    glXWaitX() or XSync()
1645bd8deadSopenharmony_ci    glXBindTexImageEXT()
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    <Do rendering/compositing>
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    glXReleaseTexImageEXT()
1695bd8deadSopenharmony_ci    XUngrabServer()
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    Apps that don't synchronize like this would get what's available, 
1725bd8deadSopenharmony_ci    and that may or may not be what they expect.
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    6. What is the result of calling GenerateMipmapEXT on a drawable that
1765bd8deadSopenharmony_ci    was not created with mipmap levels?
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    The results are undefined.
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci    7. Rendering done by the window system may be y-inverted compared
1825bd8deadSopenharmony_ci    to the standard OpenGL texture representation.  More specifically:
1835bd8deadSopenharmony_ci    the X Window system uses a coordinate system where the origin is in
1845bd8deadSopenharmony_ci    the upper left; however, the GL uses a coordinate system where the
1855bd8deadSopenharmony_ci    origin is in the lower left.  Should we define the contents of the
1865bd8deadSopenharmony_ci    texture as the y-inverted contents of the drawable?
1875bd8deadSopenharmony_ci
1885bd8deadSopenharmony_ci    X implementations may represent their drawables differently internally,
1895bd8deadSopenharmony_ci    so y-inversion should be exposed as an FBConfig attribute.
1905bd8deadSopenharmony_ci    Applications will need to query this attribute and adjust their rendering
1915bd8deadSopenharmony_ci    appropriately.
1925bd8deadSopenharmony_ci
1935bd8deadSopenharmony_ci    If a drawables is y-inverted and is bound to a texture, the contents of the
1945bd8deadSopenharmony_ci    texture will be y-inverted with respect to the standard GL memory layout.
1955bd8deadSopenharmony_ci    This means the contents of a pixmap of size (width, height) at pixmap
1965bd8deadSopenharmony_ci    coordinate (x, y) will be at location (x, height-y-1) in the texture.
1975bd8deadSopenharmony_ci    Applications will need to adjust their texture coordinates accordingly to
1985bd8deadSopenharmony_ci    avoid drawing the texture contents upside down.
1995bd8deadSopenharmony_ci
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci    8. Why wasn't this extension based on FBO instead of ARB_render_texture?
2025bd8deadSopenharmony_ci    Isn't the render_texture extension deprecated?
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    At first glance, FBO may seem like the perfect framework to base a spec
2055bd8deadSopenharmony_ci    for texturing from pixmap surfaces on.  It replaced the
2065bd8deadSopenharmony_ci    WGL_ARB_render_texture specification, which provided a mechanism to
2075bd8deadSopenharmony_ci    texture from pbuffer surfaces.  However, this train of thought is another
2085bd8deadSopenharmony_ci    side effect of the unfortunate naming of the WGL_ARB_render_texture
2095bd8deadSopenharmony_ci    specification.  FBO and the orginal render_texture specification were
2105bd8deadSopenharmony_ci    two different solutions to the problem of how to render to and texture
2115bd8deadSopenharmony_ci    from the same surface.  WGL_ARB_render_texture provided a method to bind
2125bd8deadSopenharmony_ci    a texture to a drawable surface, as this extension does.  FBO provides the
2135bd8deadSopenharmony_ci    opposite solution, allowing rendering to arbitrary surfaces including
2145bd8deadSopenharmony_ci    textures.  In the case of FBO, the application doing the rendering knows
2155bd8deadSopenharmony_ci    that it needs to render to an alternate surface.  In our usage case, the
2165bd8deadSopenharmony_ci    application doing the rendering is arbitrary, and has no knowledge that another
2175bd8deadSopenharmony_ci    application wants to use the surface it is rendering to as a texture.  The
2185bd8deadSopenharmony_ci    only application able to name the surface is the one texturing from it.
2195bd8deadSopenharmony_ci    Therefore, it makes sense to provide a mechanism for binding a texture to
2205bd8deadSopenharmony_ci    an arbitrary surface in general, and a pixmap in this particular case.
2215bd8deadSopenharmony_ci
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci    9. Why not allow binding directly to an X pixmap without creating an
2245bd8deadSopenharmony_ci    intermediate GLX pixmap?
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    Architecturally, GLX has moved away from operating directly on X
2275bd8deadSopenharmony_ci    drawables.  This allows GLX specific attributes to be associated with the
2285bd8deadSopenharmony_ci    GLX drawables.  In this case, it is important to associate an FBConfig
2295bd8deadSopenharmony_ci    with the drawable.  The FBConfig contains attributes specifying the
2305bd8deadSopenharmony_ci    internal format the GL will use when utilizing the drawable's framebuffer
2315bd8deadSopenharmony_ci    as a texture.
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci
2345bd8deadSopenharmony_ciNew Procedures and Functions
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    void glXBindTexImageEXT (Display     *display, 
2375bd8deadSopenharmony_ci                             GLXDrawable drawable, 
2385bd8deadSopenharmony_ci                             int         buffer,
2395bd8deadSopenharmony_ci                             const int   *attrib_list)
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    void glXReleaseTexImageEXT (Display     *display, 
2425bd8deadSopenharmony_ci                                GLXDrawable drawable, 
2435bd8deadSopenharmony_ci                                int         buffer)
2445bd8deadSopenharmony_ci
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ciNew Tokens
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    Accepted by the <Attribute> parameter of glXGetFBConfigAttrib and 
2495bd8deadSopenharmony_ci    the <attrib_list> parameter of glXChooseFBConfig:
2505bd8deadSopenharmony_ci
2515bd8deadSopenharmony_ci        GLX_BIND_TO_TEXTURE_RGB_EXT        0x20D0
2525bd8deadSopenharmony_ci        GLX_BIND_TO_TEXTURE_RGBA_EXT       0x20D1
2535bd8deadSopenharmony_ci        GLX_BIND_TO_MIPMAP_TEXTURE_EXT     0x20D2
2545bd8deadSopenharmony_ci        GLX_BIND_TO_TEXTURE_TARGETS_EXT    0x20D3
2555bd8deadSopenharmony_ci        GLX_Y_INVERTED_EXT                 0x20D4
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci    Accepted as an attribute in the <attrib_list> parameter of
2585bd8deadSopenharmony_ci    glXCreatePixmap, and by the <attribute> parameter of glXQueryDrawable:
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci        GLX_TEXTURE_FORMAT_EXT             0x20D5
2615bd8deadSopenharmony_ci        GLX_TEXTURE_TARGET_EXT             0x20D6
2625bd8deadSopenharmony_ci        GLX_MIPMAP_TEXTURE_EXT             0x20D7
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    Accepted as a value in the <attrib_list> parameter of glXCreatePixmap
2655bd8deadSopenharmony_ci    and returned in the <value> parameter of glXQueryDrawable when
2665bd8deadSopenharmony_ci    <attribute> is GLX_TEXTURE_FORMAT_EXT:
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci        GLX_TEXTURE_FORMAT_NONE_EXT        0x20D8
2695bd8deadSopenharmony_ci        GLX_TEXTURE_FORMAT_RGB_EXT         0x20D9
2705bd8deadSopenharmony_ci        GLX_TEXTURE_FORMAT_RGBA_EXT        0x20DA
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    Accepted as bits in the GLX_BIND_TO_TEXTURE_TARGETS_EXT variable:
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci        GLX_TEXTURE_1D_BIT_EXT             0x00000001
2755bd8deadSopenharmony_ci        GLX_TEXTURE_2D_BIT_EXT             0x00000002
2765bd8deadSopenharmony_ci        GLX_TEXTURE_RECTANGLE_BIT_EXT      0x00000004
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ci    Accepted as a value in the <attrib_list> parameter of glXCreatePixmap
2795bd8deadSopenharmony_ci    and returned in the <value> parameter of glXQueryDrawable when
2805bd8deadSopenharmony_ci    <attribute> is GLX_TEXTURE_TARGET_EXT:
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci        GLX_TEXTURE_1D_EXT                 0x20DB
2835bd8deadSopenharmony_ci        GLX_TEXTURE_2D_EXT                 0x20DC
2845bd8deadSopenharmony_ci        GLX_TEXTURE_RECTANGLE_EXT          0x20DD
2855bd8deadSopenharmony_ci
2865bd8deadSopenharmony_ci    Accepted by the <Buffer> parameter of glXBindTexImageEXT and 
2875bd8deadSopenharmony_ci    glXReleaseTexImageEXT: 
2885bd8deadSopenharmony_ci
2895bd8deadSopenharmony_ci        GLX_FRONT_LEFT_EXT                 0x20DE
2905bd8deadSopenharmony_ci        GLX_FRONT_RIGHT_EXT                0x20DF
2915bd8deadSopenharmony_ci        GLX_BACK_LEFT_EXT                  0x20E0
2925bd8deadSopenharmony_ci        GLX_BACK_RIGHT_EXT                 0x20E1
2935bd8deadSopenharmony_ci        GLX_FRONT_EXT                      GLX_FRONT_LEFT_EXT
2945bd8deadSopenharmony_ci        GLX_BACK_EXT                       GLX_BACK_LEFT_EXT
2955bd8deadSopenharmony_ci        GLX_AUX0_EXT                       0x20E2
2965bd8deadSopenharmony_ci        GLX_AUX1_EXT                       0x20E3 
2975bd8deadSopenharmony_ci        GLX_AUX2_EXT                       0x20E4 
2985bd8deadSopenharmony_ci        GLX_AUX3_EXT                       0x20E5 
2995bd8deadSopenharmony_ci        GLX_AUX4_EXT                       0x20E6 
3005bd8deadSopenharmony_ci        GLX_AUX5_EXT                       0x20E7 
3015bd8deadSopenharmony_ci        GLX_AUX6_EXT                       0x20E8
3025bd8deadSopenharmony_ci        GLX_AUX7_EXT                       0x20E9 
3035bd8deadSopenharmony_ci        GLX_AUX8_EXT                       0x20EA 
3045bd8deadSopenharmony_ci        GLX_AUX9_EXT                       0x20EB
3055bd8deadSopenharmony_ci
3065bd8deadSopenharmony_ci
3075bd8deadSopenharmony_ciGLX Protocol
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci    Two new GLX protocol commands are added.
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci        BindTexImageEXT
3125bd8deadSopenharmony_ci            1           CARD8                   opcode (X assigned)
3135bd8deadSopenharmony_ci            1           16                      GLX opcode (glXVendorPrivate)
3145bd8deadSopenharmony_ci            2           6+n                     request length
3155bd8deadSopenharmony_ci            4           1330                    vendor specific opcode
3165bd8deadSopenharmony_ci            4           CARD32                  context tag
3175bd8deadSopenharmony_ci            4           GLX_DRAWABLE            drawable
3185bd8deadSopenharmony_ci            4           INT32                   buffer
3195bd8deadSopenharmony_ci            4           CARD32                  num_attributes
3205bd8deadSopenharmony_ci            4*n         LISTofATTRIBUTE_PAIR    attribute, value pairs.
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci        ReleaseTexImageEXT
3235bd8deadSopenharmony_ci            1           CARD8           opcode (X assigned)
3245bd8deadSopenharmony_ci            1           16              GLX opcode (glXVendorPrivate)
3255bd8deadSopenharmony_ci            2           5               request length
3265bd8deadSopenharmony_ci            4           1331            vendor specific opcode
3275bd8deadSopenharmony_ci            4           CARD32          context tag
3285bd8deadSopenharmony_ci            4           GLX_DRAWABLE    drawable
3295bd8deadSopenharmony_ci            4           INT32           buffer
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ciErrors
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) 
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    None. 
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 
3395bd8deadSopenharmony_ci
3405bd8deadSopenharmony_ci    None. 
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment 
3435bd8deadSopenharmony_ciOperations and the Frame Buffer) 
3445bd8deadSopenharmony_ci
3455bd8deadSopenharmony_ci    None. 
3465bd8deadSopenharmony_ci
3475bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) 
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ci    None. 
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State 
3525bd8deadSopenharmony_ciRequests) 
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci    None. 
3555bd8deadSopenharmony_ci
3565bd8deadSopenharmony_ciAdditions to the GLX Specification
3575bd8deadSopenharmony_ci
3585bd8deadSopenharmony_ci    Add to table 3.1, GLXFBConfig Attributes:
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci    Attribute                       Type    Notes
3615bd8deadSopenharmony_ci    ------------------------------- ------- -------------------------------------------------------------------
3625bd8deadSopenharmony_ci    GLX_BIND_TO_TEXTURE_RGB_EXT     boolean True if color buffers can be bound to RGB texture
3635bd8deadSopenharmony_ci    GLX_BIND_TO_TEXTURE_RGBA_EXT    boolean True if color buffers can be bound to RGBA texture
3645bd8deadSopenharmony_ci    GLX_BIND_TO_MIPMAP_TEXTURE_EXT  boolean True if color buffers can be bound to textures with multiple levels
3655bd8deadSopenharmony_ci    GLX_BIND_TO_TEXTURE_TARGETS_EXT bitmask Bitmask of texture targets color buffers can be bound to
3665bd8deadSopenharmony_ci    GLX_Y_INVERTED_EXT              boolean True if the drawable's framebuffer is y-inverted.  This can be used to determine if y-inverted texture coordinates need to be used when texturing from this drawable when it is bound to a texture target.
3675bd8deadSopenharmony_ci
3685bd8deadSopenharmony_ci    Additions to table 3.4, Default Match Criteria for GLXFBConfig attributes:
3695bd8deadSopenharmony_ci
3705bd8deadSopenharmony_ci    Attribute                       Default              Selection Criteria Priority
3715bd8deadSopenharmony_ci    ------------------------------- -------------------- ------------------ ---------
3725bd8deadSopenharmony_ci    GLX_BIND_TO_TEXTURE_RGB_EXT     GLX_DONT_CARE        Exact
3735bd8deadSopenharmony_ci    GLX_BIND_TO_TEXTURE_RGBA_EXT    GLX_DONT_CARE        Exact
3745bd8deadSopenharmony_ci    GLX_BIND_TO_MIPMAP_TEXTURE_EXT  GLX_DONT_CARE        Exact
3755bd8deadSopenharmony_ci    GLX_BIND_TO_TEXTURE_TARGETS_EXT -                    Mask
3765bd8deadSopenharmony_ci    GLX_Y_INVERTED_EXT              GLX_DONT_CARE        Exact
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci    Modifications to 3.3.3, "Configuration Management"
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    Add after paragraph 17 in the description of FBConfigs:
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci    GLX_Y_INVERTED_EXT is a boolean describing the memory layout used for
3835bd8deadSopenharmony_ci    drawables created with the GLXFBConfig.  The attribute is True if the
3845bd8deadSopenharmony_ci    drawable's framebuffer will be y-inverted.  This can be used to determine
3855bd8deadSopenharmony_ci    if y-inverted texture coordinates need to be used when texturing from this
3865bd8deadSopenharmony_ci    drawable when it is bound to a texture target.
3875bd8deadSopenharmony_ci
3885bd8deadSopenharmony_ci    Modifications to 3.3.5, "Offscreen Rendering"
3895bd8deadSopenharmony_ci
3905bd8deadSopenharmony_ci    Modify paragraph 3 of the description of glXCreatePixmap:
3915bd8deadSopenharmony_ci
3925bd8deadSopenharmony_ci    <attrib_list> specifies a list of attributes for the pixmap.  The list has
3935bd8deadSopenharmony_ci    the same structure as described for glXChooseFBConfig.  Currently the
3945bd8deadSopenharmony_ci    following attributes can be specified in attrib_list:
3955bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_TARGET_EXT, GLX_MIPMAP_TEXTURE_EXT,
3965bd8deadSopenharmony_ci    attrib_list may be NULL or empty (first attribute of None), in which case
3975bd8deadSopenharmony_ci    all attributes assume their default values as described below.
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_EXT describes the texture format this pixmap can be
4005bd8deadSopenharmony_ci    bound to.  Valid values are GLX_TEXTURE_FORMAT_RGB_EXT,
4015bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_RGBA_EXT, and GLX_TEXTURE_FORMAT_NONE_EXT.
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    GLX_TEXTURE_TARGET_EXT can be set to GLX_TEXTURE_1D_EXT,
4045bd8deadSopenharmony_ci    GLX_TEXTURE_2D_EXT, or GLX_TEXTURE_RECTANGLE_EXT; it indicates the type
4055bd8deadSopenharmony_ci    of texture that will be created when GLX_TEXTURE_FORMAT_EXT is not
4065bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_NONE_EXT.  The default value of GLX_TEXTURE_TARGET_EXT
4075bd8deadSopenharmony_ci    depends on the capabilities in <config> and the dimensions of the pixmap.
4085bd8deadSopenharmony_ci    If <config> has GLX_TEXTURE_2D_BIT set and one or more of the following is
4095bd8deadSopenharmony_ci    true:
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci        * GLX_TEXTURE_RECTANGLE_BIT_EXT is not set in <config>
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci        * GL_ARB_texture_non_power_of_two is supported
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci        * the pixmap's width and height are powers of 2
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    the default value for GLX_TEXTURE_TARGET_EXT is GLX_TEXTURE_2D_EXT.
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ci    Otherwise, the first supported target is chosen in this order:
4205bd8deadSopenharmony_ci    GLX_TEXTURE_RECTANGLE_EXT, GLX_TEXTURE_1D_EXT.
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    GLX_MIPMAP_TEXTURE_EXT indicates that storage for mipmaps should be
4235bd8deadSopenharmony_ci    allocated.  Space for mipmaps will be set aside if GLX_TEXTURE_FORMAT_EXT
4245bd8deadSopenharmony_ci    is not GLX_TEXTURE_FORMAT_NONE_EXT and GLX_MIPMAP_TEXTURE_EXT is TRUE.
4255bd8deadSopenharmony_ci    The default value is FALSE.
4265bd8deadSopenharmony_ci
4275bd8deadSopenharmony_ci    Modify paragraph 5 of the description of glXCreatePixmap:
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    ...If <pixmap> is not a valid Pixmap XID, then a BadPixmap error is
4305bd8deadSopenharmony_ci    generated.  A BadConfig error is generated if any of the following
4315bd8deadSopenharmony_ci    conditions are true:
4325bd8deadSopenharmony_ci
4335bd8deadSopenharmony_ci        * GLX_TEXTURE_FORMAT_EXT is GLX_TEXTURE_FORMAT_RGB_EXT and
4345bd8deadSopenharmony_ci          <config> does not have GLX_BIND_TO_TEXTURE_RGB set to TRUE.
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci        * GLX_TEXTURE_FORMAT_EXT is GLX_TEXTURE_FORMAT_RGBA_EXT and
4375bd8deadSopenharmony_ci          <config> does not have GLX_BIND_TO_TEXTURE_RGBA set to TRUE.
4385bd8deadSopenharmony_ci
4395bd8deadSopenharmony_ci        * GLX_MIPMAP_TEXTURE_EXT is set to TRUE and <config> does not
4405bd8deadSopenharmony_ci          have GLX_BIND_TO_MIPMAP_EXT set to TRUE.
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci        * GLX_TEXTURE_TARGET_EXT is set to GLX_TEXTURE_1D_EXT
4435bd8deadSopenharmony_ci          and <config> does not have GLX_TEXTURE_1D_BIT_EXT set.
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci        * GLX_TEXTURE_TARGET_EXT is set to GLX_TEXTURE_2D_EXT
4465bd8deadSopenharmony_ci          and <config> does not have GLX_TEXTURE_2D_BIT_EXT set.
4475bd8deadSopenharmony_ci
4485bd8deadSopenharmony_ci        * GLX_TEXTURE_TARGET_EXT is set to GLX_TEXTURE_RECTANGLE_EXT
4495bd8deadSopenharmony_ci          and <config> does not have GLX_TEXTURE_RECTANGLE_BIT_EXT set.
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci    A BadValue error is generated if GLX_TEXTURE_FORMAT_EXT is not
4525bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_NONE_EXT and the width or height of <pixmap> are
4535bd8deadSopenharmony_ci    incompatible with the specified value of GLX_TEXTURE_TARGET_EXT on this
4545bd8deadSopenharmony_ci    implementation. (e.g., the pixmap size is not a power of 2 and
4555bd8deadSopenharmony_ci    GL_ARB_texture_rectangle is not supported).
4565bd8deadSopenharmony_ci
4575bd8deadSopenharmony_ci    Modify paragraph 1 of the description of glXDestroyPixmap:
4585bd8deadSopenharmony_ci
4595bd8deadSopenharmony_ci    ...The storage for the GLX pixmap will be freed when it is not current
4605bd8deadSopenharmony_ci    to any client and all color buffers that are bound to a texture object
4615bd8deadSopenharmony_ci    have been released.
4625bd8deadSopenharmony_ci
4635bd8deadSopenharmony_ci
4645bd8deadSopenharmony_ci    Modifications to seciton 3.3.6, "Querying Attributes"
4655bd8deadSopenharmony_ci
4665bd8deadSopenharmony_ci    Modify paragraph 1 of the description of glXQueryDrawable:
4675bd8deadSopenharmony_ci
4685bd8deadSopenharmony_ci    ...<attribute> must be set to one of GLX_WIDTH, GLX_HEIGHT,
4695bd8deadSopenharmony_ci    GLX_PRESERVED_CONTENTS, GLX_LARGEST_PBUFFER, GLX_FBCONFIG_ID,
4705bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_TARGET_EXT or GLX_MIPMAP_TEXTURE_EXT
4715bd8deadSopenharmony_ci    or a BadValue error is generated.
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ci    Modify paragraph 3 of the description of glXQueryDrawable:
4745bd8deadSopenharmony_ci
4755bd8deadSopenharmony_ci    ...If <draw> is a GLXWindow or GLXPixmap and <attribute> is set to
4765bd8deadSopenharmony_ci    GLX_PRESERVED_CONTENTS or GLX_LARGEST_PBUFFER, or if <draw> is a
4775bd8deadSopenharmony_ci    GLXWindow or GLXPbuffer and <attribute> is set to GLX_TEXTURE_FORMAT_EXT,
4785bd8deadSopenharmony_ci    GLX_TEXTURE_TARGET_EXT, or GLX_MIPMAP_TEXTURE_EXT, the contents of <value>
4795bd8deadSopenharmony_ci    are undefined.
4805bd8deadSopenharmony_ci
4815bd8deadSopenharmony_ci    Add a new section 3.3.6.1, "Texturing From Drawables"
4825bd8deadSopenharmony_ci
4835bd8deadSopenharmony_ci    The command
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci        void glXBindTexImageEXT (Display *dpy,
4865bd8deadSopenharmony_ci                                 GLXDrawable draw,
4875bd8deadSopenharmony_ci                                 int buffer,
4885bd8deadSopenharmony_ci                                 int *attrib_list);
4895bd8deadSopenharmony_ci
4905bd8deadSopenharmony_ci    defines a one- or two-dimensional texture image.  The texture image is taken
4915bd8deadSopenharmony_ci    from <buffer> and need not be copied.  The texture target, the texture
4925bd8deadSopenharmony_ci    format, and the size of the texture components are derived from attributes
4935bd8deadSopenharmony_ci    of <draw>.
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci    The drawable attribute GLX_TEXTURE_FORMAT_EXT determines the base internal
4965bd8deadSopenharmony_ci    format of the texture.  The component sizes are also determined by drawable
4975bd8deadSopenharmony_ci    attributes as shown in table 3.4a.
4985bd8deadSopenharmony_ci
4995bd8deadSopenharmony_ci    Add new table 3.4a: Size of texture components:
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci    Texture component Size
5025bd8deadSopenharmony_ci    ----------------- --------------
5035bd8deadSopenharmony_ci    R                 GLX_RED_SIZE
5045bd8deadSopenharmony_ci    G                 GLX_GREEN_SIZE
5055bd8deadSopenharmony_ci    B                 GLX_BLUE_SIZE
5065bd8deadSopenharmony_ci    A                 GLX_ALPHA_SIZE
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci    The texture target is derived from the GLX_TEXTURE_TARGET_EXT attribute of
5095bd8deadSopenharmony_ci    <draw>.  If the texture target for the drawable is GLX_TEXTURE_2D_EXT or
5105bd8deadSopenharmony_ci    GLX_TEXTURE_RECTANGLE_EXT, then buffer defines a 2D texture for the current
5115bd8deadSopenharmony_ci    2D or rectangle texture object respectively; if the texture target is
5125bd8deadSopenharmony_ci    GLX_TEXTURE_1D_EXT, then buffer defines a 1D texture for the current 1D
5135bd8deadSopenharmony_ci    texture object.
5145bd8deadSopenharmony_ci
5155bd8deadSopenharmony_ci    If <buffer> is not one of GLX_FRONT_LEFT_EXT, GLX_FRONT_RIGHT_EXT,
5165bd8deadSopenharmony_ci    GLX_BACK_LEFT_EXT, GLX_BACK_RIGHT_EXT, or GLX_AUX0_EXT through
5175bd8deadSopenharmony_ci    GLX_AUXn_EXT, where n is one less than the number of AUX buffers supported
5185bd8deadSopenharmony_ci    by the FBConfig used to create <draw>, or if the requested buffer is
5195bd8deadSopenharmony_ci    missing, a BadValue error is generated.
5205bd8deadSopenharmony_ci
5215bd8deadSopenharmony_ci    <attrib_list> specifies a list of attributes for the texture.  The list has
5225bd8deadSopenharmony_ci    the same structure as described for glXChooseFBConfig.  If <attrib_list> is
5235bd8deadSopenharmony_ci    NULL or empty (first attribute of None), then all attributes assume their
5245bd8deadSopenharmony_ci    default values.  <attrib_list> must be NULL or empty.
5255bd8deadSopenharmony_ci
5265bd8deadSopenharmony_ci    If <dpy> and <draw> are the display and drawable for the calling thread's
5275bd8deadSopenharmony_ci    current context, glXBindTexImageEXT performs an implicit glFlush.
5285bd8deadSopenharmony_ci
5295bd8deadSopenharmony_ci    The contents of the texture after the drawable has been bound are defined
5305bd8deadSopenharmony_ci    as the result of all rendering that has completed before the call to
5315bd8deadSopenharmony_ci    glXBindTexImageEXT.  In other words, the results of any operation which
5325bd8deadSopenharmony_ci    has caused damage on the drawable prior to the glXBindTexImageEXT call
5335bd8deadSopenharmony_ci    will be represented in the texture.
5345bd8deadSopenharmony_ci
5355bd8deadSopenharmony_ci    Rendering to the drawable while it is bound to a texture will leave the
5365bd8deadSopenharmony_ci    contents of the texture in an undefined state.  However, no
5375bd8deadSopenharmony_ci    synchronization between rendering and texturing is done by GLX.  It is
5385bd8deadSopenharmony_ci    the application's responsibility to implement any synchronization
5395bd8deadSopenharmony_ci    required.
5405bd8deadSopenharmony_ci
5415bd8deadSopenharmony_ci    If a texture object is deleted before glXReleaseTexImageEXT is called,
5425bd8deadSopenharmony_ci    the color buffer is released.
5435bd8deadSopenharmony_ci
5445bd8deadSopenharmony_ci    It is not an error to call TexImage2D, TexImage1D, CopyTexImage1D, or
5455bd8deadSopenharmony_ci    CopyTexImage2D to replace an image of a texture object that has a color
5465bd8deadSopenharmony_ci    buffer bound to it.  However, these calls will cause the color buffer to be
5475bd8deadSopenharmony_ci    released and new memory to be allocated for the texture.  Note that the
5485bd8deadSopenharmony_ci    color buffer is released even if the image that is being defined is a mipmap
5495bd8deadSopenharmony_ci    level that was not defined by the color buffer.  GenerateMipmapEXT is an
5505bd8deadSopenharmony_ci    exception.  GenerateMipmapEXT can be used to define mipmap levels for
5515bd8deadSopenharmony_ci    drawables that have been created with GLX_MIPMAP_TEXTURE_EXT set.  Calling
5525bd8deadSopenharmony_ci    GenerateMipmapEXT on a drawable that was created without
5535bd8deadSopenharmony_ci    GLX_MIPMAP_TEXTURE_EXT is undefined.
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ci    The results of calling glXBindTexImageEXT when GENERATE_MIPMAP_SGIS is TRUE
5565bd8deadSopenharmony_ci    are undefined.
5575bd8deadSopenharmony_ci
5585bd8deadSopenharmony_ci    If glXBindTexImageEXT is called and the drawable attribute
5595bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_EXT is GLX_TEXTURE_FORMAT_NONE_EXT, then a BadMatch
5605bd8deadSopenharmony_ci    error is generated.
5615bd8deadSopenharmony_ci
5625bd8deadSopenharmony_ci    Currently, only pixmaps can be bound to textures.  If <draw> is not a
5635bd8deadSopenharmony_ci    valid GLXPixmap, then a GLXBadPixmap error is generated.
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci    glXBindTexImageEXT is ignored if there is no current GLX rendering context.
5665bd8deadSopenharmony_ci
5675bd8deadSopenharmony_ci    To release a color buffer that is being used as a texture, call
5685bd8deadSopenharmony_ci
5695bd8deadSopenharmony_ci       void glXReleaseTexImageEXT (Dislpay *dpy, GLXDrawable draw, int buffer);
5705bd8deadSopenharmony_ci
5715bd8deadSopenharmony_ci    <buffer> must be one of GLX_FRONT_LEFT_EXT, GLX_FRONT_RIGHT_EXT,
5725bd8deadSopenharmony_ci    GLX_BACK_LEFT_EXT, GLX_BACK_RIGHT_EXT, and GLX_AUX0_EXT through
5735bd8deadSopenharmony_ci    GLX_AUXn_EXT, where n is one less than the number of AUX buffers
5745bd8deadSopenharmony_ci    supported by the FBConfig used to create <draw> or a BadValue error
5755bd8deadSopenharmony_ci    is generated.
5765bd8deadSopenharmony_ci
5775bd8deadSopenharmony_ci    The contents of the color buffer are unaffected by glXReleaseTexImageEXT.
5785bd8deadSopenharmony_ci
5795bd8deadSopenharmony_ci    If the specified color buffer is no longer bound to a texture (e.g.,
5805bd8deadSopenharmony_ci    because the texture object was deleted), then glXReleaseTexImageEXT has no effect;
5815bd8deadSopenharmony_ci    no error is generated.
5825bd8deadSopenharmony_ci
5835bd8deadSopenharmony_ci    When a color buffer is released (e.g., by calling glXReleaseTexImageEXT or
5845bd8deadSopenharmony_ci    implicitly by calling a routine such as TexImage2D), all textures that were
5855bd8deadSopenharmony_ci    defined by the color buffer become NULL.
5865bd8deadSopenharmony_ci
5875bd8deadSopenharmony_ci    If glXReleaseTexImageEXT is called and the drawable attribute
5885bd8deadSopenharmony_ci    GLX_TEXTURE_FORMAT_EXT is GLX_TEXTURE_FORMAT_NONE_EXT, then a BadMatch
5895bd8deadSopenharmony_ci    error is generated.
5905bd8deadSopenharmony_ci
5915bd8deadSopenharmony_ci    Currently, only pixmaps can be bound to textures.  If <draw> is not a
5925bd8deadSopenharmony_ci    valid GLXPixmap, then a GLXBadPixmap error is generated.
5935bd8deadSopenharmony_ci
5945bd8deadSopenharmony_ci
5955bd8deadSopenharmony_ciUsage Examples
5965bd8deadSopenharmony_ci
5975bd8deadSopenharmony_ci    Example 1: Bind redirected window to texture:
5985bd8deadSopenharmony_ci
5995bd8deadSopenharmony_ci    XGetWindowAttributes (display, window, &attrib);
6005bd8deadSopenharmony_ci
6015bd8deadSopenharmony_ci    visualid = XVisualIDFromVisual (attrib.visual);
6025bd8deadSopenharmony_ci
6035bd8deadSopenharmony_ci    fbconfigs = glXGetFBConfigs (display, screen, &nfbconfigs);
6045bd8deadSopenharmony_ci    for (i = 0; i < nfbconfigs; i++)
6055bd8deadSopenharmony_ci    {
6065bd8deadSopenharmony_ci        visinfo = glXGetVisualFromFBConfig (display, fbconfigs[i]);
6075bd8deadSopenharmony_ci        if (!visinfo || visinfo->visualid != visualid)
6085bd8deadSopenharmony_ci            continue;
6095bd8deadSopenharmony_ci
6105bd8deadSopenharmony_ci        glXGetFBConfigAttrib (display, fbconfigs[i], GLX_DRAWABLE_TYPE, &value);
6115bd8deadSopenharmony_ci        if (!(value & GLX_PIXMAP_BIT))
6125bd8deadSopenharmony_ci            continue;
6135bd8deadSopenharmony_ci
6145bd8deadSopenharmony_ci        glXGetFBConfigAttrib (display, fbconfigs[i],
6155bd8deadSopenharmony_ci                              GLX_BIND_TO_TEXTURE_TARGETS_EXT,
6165bd8deadSopenharmony_ci                              &value);
6175bd8deadSopenharmony_ci        if (!(value & GLX_TEXTURE_2D_BIT_EXT))
6185bd8deadSopenharmony_ci            continue;
6195bd8deadSopenharmony_ci
6205bd8deadSopenharmony_ci        glXGetFBConfigAttrib (display, fbconfigs[i],
6215bd8deadSopenharmony_ci                              GLX_BIND_TO_TEXTURE_RGBA_EXT,
6225bd8deadSopenharmony_ci                              &value);
6235bd8deadSopenharmony_ci        if (value == FALSE)
6245bd8deadSopenharmony_ci        {
6255bd8deadSopenharmony_ci            glXGetFBConfigAttrib (display, fbconfigs[i],
6265bd8deadSopenharmony_ci                                  GLX_BIND_TO_TEXTURE_RGB_EXT,
6275bd8deadSopenharmony_ci                                  &value);
6285bd8deadSopenharmony_ci            if (value == FALSE)
6295bd8deadSopenharmony_ci                continue;
6305bd8deadSopenharmony_ci        }
6315bd8deadSopenharmony_ci
6325bd8deadSopenharmony_ci        glXGetFBConfigAttrib (display, fbconfigs[i],
6335bd8deadSopenharmony_ci                              GLX_Y_INVERTED_EXT,
6345bd8deadSopenharmony_ci                              &value);
6355bd8deadSopenharmony_ci        if (value == TRUE)
6365bd8deadSopenharmony_ci        {
6375bd8deadSopenharmony_ci            top = 0.0f;
6385bd8deadSopenharmony_ci            bottom = 1.0f;
6395bd8deadSopenharmony_ci        }
6405bd8deadSopenharmony_ci        else
6415bd8deadSopenharmony_ci        {
6425bd8deadSopenharmony_ci            top = 1.0f;
6435bd8deadSopenharmony_ci            bottom = 0.0f;
6445bd8deadSopenharmony_ci        }
6455bd8deadSopenharmony_ci
6465bd8deadSopenharmony_ci        break;
6475bd8deadSopenharmony_ci    }
6485bd8deadSopenharmony_ci
6495bd8deadSopenharmony_ci    if (i == nfbconfigs)
6505bd8deadSopenharmony_ci        /* error 1 */
6515bd8deadSopenharmony_ci
6525bd8deadSopenharmony_ci    pixmap = XCompositeNameWindowPixmap (display, window);
6535bd8deadSopenharmony_ci    pixmapAttribs = { GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
6545bd8deadSopenharmony_ci                      GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT,
6555bd8deadSopenharmony_ci                      None };
6565bd8deadSopenharmony_ci    glxpixmap = glXCreatePixmap (display, fbconfigs[i], pixmap, pixmapAttribs);
6575bd8deadSopenharmony_ci
6585bd8deadSopenharmony_ci    glGenTextures (1, &texture);
6595bd8deadSopenharmony_ci    glBindTexture (GL_TEXTURE_2D, texture);
6605bd8deadSopenharmony_ci
6615bd8deadSopenharmony_ci    glXBindTexImageEXT (display, glxpixmap, GLX_FRONT_LEFT_EXT, NULL);
6625bd8deadSopenharmony_ci
6635bd8deadSopenharmony_ci    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
6645bd8deadSopenharmony_ci    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
6655bd8deadSopenharmony_ci
6665bd8deadSopenharmony_ci    /* draw using pixmap as texture */
6675bd8deadSopenharmony_ci    glBegin (GL_QUADS);
6685bd8deadSopenharmony_ci
6695bd8deadSopenharmony_ci    glTexCoord2d (0.0f, bottom);
6705bd8deadSopenharmony_ci    glVertex2d (0.0f, 0.0f);
6715bd8deadSopenharmony_ci
6725bd8deadSopenharmony_ci    glTexCoord2d (0.0f, top);
6735bd8deadSopenharmony_ci    glVertex2d (0.0f, 1.0f);
6745bd8deadSopenharmony_ci
6755bd8deadSopenharmony_ci    glTexCoord2d (1.0f, top);
6765bd8deadSopenharmony_ci    glVertex2d (1.0f, 1.0f);
6775bd8deadSopenharmony_ci
6785bd8deadSopenharmony_ci    glTexCoord2d (1.0f, bottom);
6795bd8deadSopenharmony_ci    glVertex2d (1.0f, 0.0f);
6805bd8deadSopenharmony_ci
6815bd8deadSopenharmony_ci    glEnd ();
6825bd8deadSopenharmony_ci
6835bd8deadSopenharmony_ci    glXReleaseTexImageEXT (display, glxpixmap, GLX_FRONT_LEFT_EXT);
6845bd8deadSopenharmony_ci
6855bd8deadSopenharmony_ci
6865bd8deadSopenharmony_ciVersion History
6875bd8deadSopenharmony_ci    
6885bd8deadSopenharmony_ci    1. 26 Nov 2005 - DavidR
6895bd8deadSopenharmony_ci        Initial version
6905bd8deadSopenharmony_ci    2. 01 Dec 2005 - JamesJ
6915bd8deadSopenharmony_ci        -Adapted spec language from draft version of GLX_ARB_render_texture.
6925bd8deadSopenharmony_ci        -Added glXDrawableAttribute to set attributes.
6935bd8deadSopenharmony_ci        -Modified glXBindTexImageEXT to take an attrib_list parameter.
6945bd8deadSopenharmony_ci        -Added support for cubemap and 1D texture targets.
6955bd8deadSopenharmony_ci        -Added attribute to set the texture target when creating the
6965bd8deadSopenharmony_ci         drawable.
6975bd8deadSopenharmony_ci        -Updated the issues section.
6985bd8deadSopenharmony_ci        -Added mipmap support.  Support is not required.
6995bd8deadSopenharmony_ci        -Specified results of texturing from a drawable when it has been
7005bd8deadSopenharmony_ci         rendered to while bound to a texture as undefined until
7015bd8deadSopenharmony_ci         glXReleaseTexImageEXT has been called.  Allows implementations
7025bd8deadSopenharmony_ci         that need to perform an implicit copy after rendering occurs
7035bd8deadSopenharmony_ci         to be compatible with this specification.
7045bd8deadSopenharmony_ci    3. 04 Dec 2005 - DavidR
7055bd8deadSopenharmony_ci        -Changed name to GLX_EXT_texture_from_pixmap.
7065bd8deadSopenharmony_ci        -Changed spec regarding what happens when a pixmap that is bound
7075bd8deadSopenharmony_ci         to a texture is rendered to. Having textures be undefined once
7085bd8deadSopenharmony_ci         they are rendered to makes it useless for a compositing manager,
7095bd8deadSopenharmony_ci         which is a major use case for this extension.
7105bd8deadSopenharmony_ci        -Added support for not specifying texture target when creating a
7115bd8deadSopenharmony_ci         pixmap. Allows implementations to select whatever target it
7125bd8deadSopenharmony_ci         finds most suitable.
7135bd8deadSopenharmony_ci    4. 05 Dec 2005 - JamesJ
7145bd8deadSopenharmony_ci        -Changed the default value of GLX_TEXTURE_TARGET_EXT from
7155bd8deadSopenharmony_ci         GLX_NO_TEXTURE_EXT to something usable.  Eliminated
7165bd8deadSopenharmony_ci         GLX_NO_TEXTURE_EXT.
7175bd8deadSopenharmony_ci        -Eliminated GLX_TEXTURE_NONE_EXT.
7185bd8deadSopenharmony_ci        -Removed language referring to sharing of color buffers when
7195bd8deadSopenharmony_ci         pixmaps are bound to textures.
7205bd8deadSopenharmony_ci        -Updated issues.
7215bd8deadSopenharmony_ci
7225bd8deadSopenharmony_ci    5. 13 Dec 2005 - JamesJ
7235bd8deadSopenharmony_ci        -Removed cube map support and rendering to multiple mipmap
7245bd8deadSopenharmony_ci         levels support.
7255bd8deadSopenharmony_ci
7265bd8deadSopenharmony_ci    6. 20 Jan 2006 - JamesJ
7275bd8deadSopenharmony_ci        -Specified textures are y-inverted.
7285bd8deadSopenharmony_ci
7295bd8deadSopenharmony_ci    7. 23 Jan 2006 - AaronP
7305bd8deadSopenharmony_ci        -Fix typos, make some things clearer.  Replace ocurrences of "released
7315bd8deadSopenharmony_ci         back to the drawable" with "released".
7325bd8deadSopenharmony_ci
7335bd8deadSopenharmony_ci    8. 01 Feb 2006 - AndyR
7345bd8deadSopenharmony_ci        -Fix minor typos.
7355bd8deadSopenharmony_ci
7365bd8deadSopenharmony_ci    9. 03 Feb 2006 - JamesJ
7375bd8deadSopenharmony_ci        -Added some new issues and their resolutions.
7385bd8deadSopenharmony_ci        -Finalized some issues that had been in discussion.
7395bd8deadSopenharmony_ci        -Made drawable y-inversion a queryable attribute of the drawable.
7405bd8deadSopenharmony_ci        -Moved detailed explanation of y-inverted addressing to the issues
7415bd8deadSopenharmony_ci         section
7425bd8deadSopenharmony_ci        -Updated example to demonstrate proper use of the y-inverted
7435bd8deadSopenharmony_ci         attribute.
7445bd8deadSopenharmony_ci
7455bd8deadSopenharmony_ci    10. 06 Feb 2006 - DavidR
7465bd8deadSopenharmony_ci        -Made GLX_Y_INVERTED_EXT an FBConfig attribute instead of a drawable
7475bd8deadSopenharmony_ci         attribute.
7485bd8deadSopenharmony_ci        -Removed GLX_TEXTURE_CUBE_MAP_EXT.
7495bd8deadSopenharmony_ci        -Fix minor typo.
7505bd8deadSopenharmony_ci
7515bd8deadSopenharmony_ci    11. 07 Feb 2006 - JamesJ
7525bd8deadSopenharmony_ci        -Added description of GLX_Y_INVERTED_EXT GLXFBConfig attribute, based
7535bd8deadSopenharmony_ci         on description of the drawable attribute of the same name from
7545bd8deadSopenharmony_ci         and earlier version of the specification.
7555bd8deadSopenharmony_ci        -Removed language requiring applications to re-bind a pixmap to a
7565bd8deadSopenharmony_ci         texture to gurantee contents of the texture are updated after a
7575bd8deadSopenharmony_ci         pixmap has been rendered to.
7585bd8deadSopenharmony_ci        -Added Aaron Plattner and Andy Ritger to contributors section.
7595bd8deadSopenharmony_ci
7605bd8deadSopenharmony_ci    12. 14 Feb 2006 - JamesJ
7615bd8deadSopenharmony_ci        -Disallowed rendering to a drawable while it is bound as a texture
7625bd8deadSopenharmony_ci         and defined the exact contents of a texture after a drawable has
7635bd8deadSopenharmony_ci         been bound to it.
7645bd8deadSopenharmony_ci
7655bd8deadSopenharmony_ci    13. 09 Mar 2006 - JamesJ
7665bd8deadSopenharmony_ci        -Add a context tag member to the vendor private requests.  This field
7675bd8deadSopenharmony_ci         is part of the vendor private header, and is needed to specify which
7685bd8deadSopenharmony_ci         context the BindTexImageEXT and ReleaseTexImageEXT requests correspond
7695bd8deadSopenharmony_ci         to.
7705bd8deadSopenharmony_ci        -Changed texture target bitfield values to not skip numbers removed in
7715bd8deadSopenharmony_ci         earlier updates.
7725bd8deadSopenharmony_ci
7735bd8deadSopenharmony_ci    14. 13 Mar 2006 - JamesJ
7745bd8deadSopenharmony_ci        -Only require GLX_SGIX_fbconfig + GLX 1.2.
7755bd8deadSopenharmony_ci        -Clarify language regarding the result of rendering to drawables bound
7765bd8deadSopenharmony_ci         to textures.
7775bd8deadSopenharmony_ci        -Added GLX_FRONT_EXT and GLX_BACK_EXT tokens.
7785bd8deadSopenharmony_ci
7795bd8deadSopenharmony_ci    15. 18 Apr 2006 - JamesJ
7805bd8deadSopenharmony_ci        -Allocated enum values and opcodes.
7815bd8deadSopenharmony_ci        -Require GLX 1.3.  GLX_SGIX_fbconfig doesn't allow creating pixmaps
7825bd8deadSopenharmony_ci         with attributes.
7835bd8deadSopenharmony_ci        -Added more arguments for not supporting rendering to multiple levels
7845bd8deadSopenharmony_ci         of a texture with this extension.
7855bd8deadSopenharmony_ci        -Fixed the inconsistencies in the return type of glXBindTexImageEXT
7865bd8deadSopenharmony_ci         and glXReleaseTexImageEXT.  It is now listed as void throughout.
7875bd8deadSopenharmony_ci
7885bd8deadSopenharmony_ci    16. 12 Sep 2006 - JamesJ
7895bd8deadSopenharmony_ci        -Fix ordering of GLX protocol
7905bd8deadSopenharmony_ci
7915bd8deadSopenharmony_ci    17. 10 Feb 2009 - Jon Leech
7925bd8deadSopenharmony_ci	-Fix typo reported by Jonathan Knispel.
793