15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci ARB_create_context 45bd8deadSopenharmony_ci ARB_create_context_profile 55bd8deadSopenharmony_ci 65bd8deadSopenharmony_ciName Strings 75bd8deadSopenharmony_ci 85bd8deadSopenharmony_ci GLX_ARB_create_context 95bd8deadSopenharmony_ci GLX_ARB_create_context_profile 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ciContact 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ci Jon Leech (jon 'at' alumni.caltech.edu) 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ciNotice 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ci Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 185bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ciSpecification Update Policy 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 235bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 245bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 255bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 265bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 275bd8deadSopenharmony_ci described in more detail at 285bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ciIP Status 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ci No known IP claims. 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciStatus 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci Complete. Approved by the ARB on July 28, 2009. 375bd8deadSopenharmony_ci Approved by the Khronos Board of Promoters on August 28, 2009. 385bd8deadSopenharmony_ci Version 8 update approved by the ARB on September 24, 2009. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciVersion 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Version 10, 2012/03/28 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciNumber 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci ARB Extension #56 (GLX_ARB_create_context) 475bd8deadSopenharmony_ci ARB Extension #75 (GLX_ARB_create_context_profile) 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciDependencies 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci GLX 1.4 is required. 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci Some of the capabilities of these extensions are only available with 545bd8deadSopenharmony_ci contexts supporting OpenGL 3.0 or later. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci The presence of an OpenGL 3.2 or later implementation determines 575bd8deadSopenharmony_ci whether or not GLX_ARB_create_context_profile is required. 585bd8deadSopenharmony_ci 595bd8deadSopenharmony_ciOverview 605bd8deadSopenharmony_ci 615bd8deadSopenharmony_ci With the advent of new versions of OpenGL which deprecate features 625bd8deadSopenharmony_ci and/or break backward compatibility with older versions, there is a 635bd8deadSopenharmony_ci need and desire to indicate at context creation which interface will 645bd8deadSopenharmony_ci be used. These extensions add a new context creation routine with 655bd8deadSopenharmony_ci attributes specifying the GL version and context properties 665bd8deadSopenharmony_ci requested for the context, and additionally add an attribute 675bd8deadSopenharmony_ci specifying the GL profile requested for a context of OpenGL 3.2 or 685bd8deadSopenharmony_ci later. It also allows making an OpenGL 3.0 or later context current 695bd8deadSopenharmony_ci without providing a default framebuffer. 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ciNew Procedures and Functions 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ci GLXContext glXCreateContextAttribsARB( 745bd8deadSopenharmony_ci Display *dpy, GLXFBConfig config, 755bd8deadSopenharmony_ci GLXContext share_context, Bool direct, 765bd8deadSopenharmony_ci const int *attrib_list); 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ciNew Tokens 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci Accepted as an attribute name in <*attrib_list>: 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 835bd8deadSopenharmony_ci GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 845bd8deadSopenharmony_ci GLX_CONTEXT_FLAGS_ARB 0x2094 855bd8deadSopenharmony_ci GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci Accepted as bits in the attribute value for GLX_CONTEXT_FLAGS_ARB in 885bd8deadSopenharmony_ci <*attrib_list>: 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ci GLX_CONTEXT_DEBUG_BIT_ARB 0x0001 915bd8deadSopenharmony_ci GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 925bd8deadSopenharmony_ci 935bd8deadSopenharmony_ci Accepted as bits in the attribute value for 945bd8deadSopenharmony_ci GLX_CONTEXT_PROFILE_MASK_ARB in <*attrib_list>: 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 975bd8deadSopenharmony_ci GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ciAdditions to the OpenGL / WGL Specifications 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci None. This specification is written for GLX. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciAdditions to the GLX 1.4 Specification 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Replace the initial six paragraphs of section 3.3.7 "Rendering 1065bd8deadSopenharmony_ci Contexts", describing glXCreateNewContext, with: 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci "To create an OpenGL rendering context, call 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci GLXContext glXCreateContextAttribsARB( 1115bd8deadSopenharmony_ci Display *dpy, 1125bd8deadSopenharmony_ci GLXFBConfig config, 1135bd8deadSopenharmony_ci GLXContext share_context, 1145bd8deadSopenharmony_ci Bool direct, 1155bd8deadSopenharmony_ci const int *attrib_list); 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci If glXCreateContextAttribsARB succeeds, it initializes the context 1185bd8deadSopenharmony_ci to the initial state defined by the OpenGL specification, and 1195bd8deadSopenharmony_ci returns a handle to it. This handle can be used to render to any GLX 1205bd8deadSopenharmony_ci surface (window, pixmap, or pbuffer) compatible with <config>, 1215bd8deadSopenharmony_ci subject to constraints imposed by the OpenGL API version of the 1225bd8deadSopenharmony_ci context. 1235bd8deadSopenharmony_ci 1245bd8deadSopenharmony_ci If <share_context> is not NULL, then all shareable data (excluding 1255bd8deadSopenharmony_ci OpenGL texture objects named 0) will be shared by <share_context>, 1265bd8deadSopenharmony_ci all other contexts <share_context> already shares with, and the 1275bd8deadSopenharmony_ci newly created context. An arbitrary number of GLXContexts can share 1285bd8deadSopenharmony_ci data in this fashion. The server context state for all sharing 1295bd8deadSopenharmony_ci contexts must exist in a single address space. 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci Direct rendering is requested if <direct> is True, and indirect 1325bd8deadSopenharmony_ci rendering if <direct> is False. If <direct> is True, the 1335bd8deadSopenharmony_ci implementation may nonetheless create an indirect rendering context 1345bd8deadSopenharmony_ci if any of the following conditions hold: 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci * The implementation does not support direct rendering. 1375bd8deadSopenharmony_ci * <display> is not a local X server. 1385bd8deadSopenharmony_ci * Implementation-dependent limits on the number of direct 1395bd8deadSopenharmony_ci rendering contexts that can be supported simultaneously are 1405bd8deadSopenharmony_ci exceeded. 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci Use glXIsDirect (see below) to determine whether or not a request 1435bd8deadSopenharmony_ci for a direct rendering context succeeded. 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci <attrib_list> specifies a list of attributes for the context. The 1465bd8deadSopenharmony_ci list consists of a sequence of <name,value> pairs terminated by the 1475bd8deadSopenharmony_ci value None (0). If an attribute is not specified in <attrib_list>, 1485bd8deadSopenharmony_ci then the default value specified below is used instead. 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci <attrib_list> may be NULL or empty (first attribute is None), in 1515bd8deadSopenharmony_ci which case all attributes assume their default values as described 1525bd8deadSopenharmony_ci below. 1535bd8deadSopenharmony_ci 1545bd8deadSopenharmony_ci The attribute names GLX_CONTEXT_MAJOR_VERSION_ARB and 1555bd8deadSopenharmony_ci GLX_CONTEXT_MINOR_VERSION_ARB request an OpenGL context supporting 1565bd8deadSopenharmony_ci the specified version of the API. If successful, the context 1575bd8deadSopenharmony_ci returned must be backwards compatible with the context requested. 1585bd8deadSopenharmony_ci Backwards compatibility is determined as follows: 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci If a version less than or equal to 3.0 is requested, the context 1615bd8deadSopenharmony_ci returned may implement any of the following versions: 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci * Any version no less than that requested and no greater than 3.0. 1645bd8deadSopenharmony_ci * Version 3.1, if the GL_ARB_compatibility extension is also 1655bd8deadSopenharmony_ci implemented. 1665bd8deadSopenharmony_ci * The compatibility profile of version 3.2 or greater. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci If version 3.1 is requested, the context returned may implement 1695bd8deadSopenharmony_ci any of the following versions: 1705bd8deadSopenharmony_ci 1715bd8deadSopenharmony_ci * Version 3.1. The GL_ARB_compatibility extension may or may not 1725bd8deadSopenharmony_ci be implemented, as determined by the implementation. 1735bd8deadSopenharmony_ci * The core profile of version 3.2 or greater. 1745bd8deadSopenharmony_ci 1755bd8deadSopenharmony_ci If version 3.2 or greater is requested, the context returned may 1765bd8deadSopenharmony_ci implement any of the following versions: 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci * The requested profile of the requested version. 1795bd8deadSopenharmony_ci * The requested profile of any later version, so long as no 1805bd8deadSopenharmony_ci features have been removed from that later version and profile. 1815bd8deadSopenharmony_ci 1825bd8deadSopenharmony_ci Querying the GL_VERSION string with glGetString (or the 1835bd8deadSopenharmony_ci GL_MAJOR_VERSION and GL_MINOR_VERSION values with glGetIntegerv, in 1845bd8deadSopenharmony_ci a 3.0 or later context) will return the actual version supported by 1855bd8deadSopenharmony_ci a context. 1865bd8deadSopenharmony_ci 1875bd8deadSopenharmony_ci The default values for GLX_CONTEXT_MAJOR_VERSION_ARB and 1885bd8deadSopenharmony_ci GLX_CONTEXT_MINOR_VERSION_ARB are 1 and 0 respectively. In this 1895bd8deadSopenharmony_ci case, implementations will typically return the most recent version 1905bd8deadSopenharmony_ci of OpenGL they support which is backwards compatible with OpenGL 1.0 1915bd8deadSopenharmony_ci (e.g. 3.0, 3.1 + GL_ARB_compatibility, or 3.2 compatibility profile) 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci The attribute name GLX_CONTEXT_PROFILE_MASK_ARB requests an OpenGL 1945bd8deadSopenharmony_ci context supporting a specific <profile> of the API. If the 1955bd8deadSopenharmony_ci GLX_CONTEXT_CORE_PROFILE_BIT_ARB bit is set in the attribute value, 1965bd8deadSopenharmony_ci then a context implementing the <core> profile of OpenGL is 1975bd8deadSopenharmony_ci returned. If the GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB bit is 1985bd8deadSopenharmony_ci set, then a context implementing the <compatibility> profile is 1995bd8deadSopenharmony_ci returned. If the requested OpenGL version is less than 3.2, 2005bd8deadSopenharmony_ci GLX_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality of the 2015bd8deadSopenharmony_ci context is determined solely by the requested version. 2025bd8deadSopenharmony_ci 2035bd8deadSopenharmony_ci Querying the value of GL_CONTEXT_PROFILE_MASK with glGetIntegerv 2045bd8deadSopenharmony_ci will return the profile mask used to create the context. This query 2055bd8deadSopenharmony_ci is only supported in an OpenGL 3.2 or later context. 2065bd8deadSopenharmony_ci 2075bd8deadSopenharmony_ci The default value for GLX_CONTEXT_PROFILE_MASK_ARB is 2085bd8deadSopenharmony_ci GLX_CONTEXT_CORE_PROFILE_BIT_ARB. All OpenGL 3.2 implementations are 2095bd8deadSopenharmony_ci required to implement the core profile, but implementation of the 2105bd8deadSopenharmony_ci compatibility profile is optional. 2115bd8deadSopenharmony_ci 2125bd8deadSopenharmony_ci If the core profile is requested, then the context returned cannot 2135bd8deadSopenharmony_ci implement functionality defined only by the compatibility profile. 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci The attribute name GLX_CONTEXT_FLAGS_ARB specifies a set of flag 2165bd8deadSopenharmony_ci bits affecting the rendering context. 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci If the GLX_CONTEXT_DEBUG_BIT_ARB flag bit is set in 2195bd8deadSopenharmony_ci GLX_CONTEXT_FLAGS_ARB, then a <debug context> will be created. Debug 2205bd8deadSopenharmony_ci contexts are intended for use during application development, and 2215bd8deadSopenharmony_ci provide additional runtime checking, validation, and logging 2225bd8deadSopenharmony_ci functionality while possibly incurring performance penalties. The 2235bd8deadSopenharmony_ci additional functionality provided by debug contexts may vary 2245bd8deadSopenharmony_ci according to the implementation(fn). In some cases a debug context 2255bd8deadSopenharmony_ci may be identical to a non-debug context. 2265bd8deadSopenharmony_ci [fn: The ARB Ecosystem TSG is still defining the expected and 2275bd8deadSopenharmony_ci required features of debug contexts.] 2285bd8deadSopenharmony_ci 2295bd8deadSopenharmony_ci If the GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB is set in 2305bd8deadSopenharmony_ci GLX_CONTEXT_FLAGS_ARB, then a <forward-compatible> context will be 2315bd8deadSopenharmony_ci created. Forward-compatible contexts are defined only for OpenGL 2325bd8deadSopenharmony_ci versions 3.0 and later. They must not support functionality marked 2335bd8deadSopenharmony_ci as <deprecated> by that version of the API, while a 2345bd8deadSopenharmony_ci non-forward-compatible context must support all functionality in 2355bd8deadSopenharmony_ci that version, deprecated or not. 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci The default value of GLX_CONTEXT_FLAGS_ARB is 0. 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci The attribute name GLX_RENDER_TYPE specifies the type of rendering 2405bd8deadSopenharmony_ci to be supported by the context. RGBA rendering is supported if the 2415bd8deadSopenharmony_ci attribute value is GLX_RGBA_TYPE, and color index rendering is 2425bd8deadSopenharmony_ci supported if the attribute value is GLX_COLOR_INDEX_TYPE. The 2435bd8deadSopenharmony_ci default value of GLX_RENDER_TYPE is GLX_RGBA_TYPE. OpenGL contexts 2445bd8deadSopenharmony_ci supporting version 3.0 or later of the API do not support color 2455bd8deadSopenharmony_ci index rendering, even if a color index <config> is available. 2465bd8deadSopenharmony_ci 2475bd8deadSopenharmony_ci On failure glXCreateContextAttribsARB returns NULL and generates an 2485bd8deadSopenharmony_ci X error with extended error information. Conditions that cause 2495bd8deadSopenharmony_ci failure include: 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci * If the server context state for <share_context> exists in an 2525bd8deadSopenharmony_ci address space that cannot be shared with the newly created 2535bd8deadSopenharmony_ci context, if <share_context> was created on a different screen 2545bd8deadSopenharmony_ci than the one referenced by <config>, or if the contexts are 2555bd8deadSopenharmony_ci otherwise incompatible (for example, one context being 2565bd8deadSopenharmony_ci associated with a hardware device driver and the other with a 2575bd8deadSopenharmony_ci software renderer), BadMatch is generated. 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci * If the server does not have enough resources to allocate the new 2605bd8deadSopenharmony_ci context, BadAlloc is generated. 2615bd8deadSopenharmony_ci 2625bd8deadSopenharmony_ci * If <share_context> is neither zero nor a valid GLX rendering 2635bd8deadSopenharmony_ci context, GLXBadContext is generated. 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ci * If <config> is not a valid GLXFBConfig, GLXBadFBConfig is 2665bd8deadSopenharmony_ci generated. 2675bd8deadSopenharmony_ci 2685bd8deadSopenharmony_ci * If attribute GLX_RENDER_TYPE does not describe a valid rendering 2695bd8deadSopenharmony_ci type, BadValue is generated. 2705bd8deadSopenharmony_ci 2715bd8deadSopenharmony_ci * If attributes GLX_CONTEXT_MAJOR_VERSION_ARB and 2725bd8deadSopenharmony_ci GLX_CONTEXT_MINOR_VERSION_ARB, when considered together with 2735bd8deadSopenharmony_ci attributes GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB and 2745bd8deadSopenharmony_ci GLX_RENDER_TYPE, specify an OpenGL version and feature set that 2755bd8deadSopenharmony_ci are not defined, BadMatch is generated. 2765bd8deadSopenharmony_ci 2775bd8deadSopenharmony_ci The defined versions of OpenGL at the time of writing are OpenGL 2785bd8deadSopenharmony_ci 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.1, 3.0, 3.1, and 3.2. 2795bd8deadSopenharmony_ci Feature deprecation was introduced with OpenGL 3.0, so 2805bd8deadSopenharmony_ci forward-compatible contexts may only be requested for OpenGL 3.0 2815bd8deadSopenharmony_ci and above. Thus, examples of invalid combinations of attributes 2825bd8deadSopenharmony_ci include: 2835bd8deadSopenharmony_ci 2845bd8deadSopenharmony_ci - Major version < 1 or > 3 2855bd8deadSopenharmony_ci - Major version == 1 and minor version < 0 or > 5 2865bd8deadSopenharmony_ci - Major version == 2 and minor version < 0 or > 1 2875bd8deadSopenharmony_ci - Major version == 3 and minor version > 2 2885bd8deadSopenharmony_ci - Forward-compatible flag set and major version < 3 2895bd8deadSopenharmony_ci - Color index rendering and major version >= 3 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci Because the purpose of forward-compatible contexts is to allow 2925bd8deadSopenharmony_ci application development on a specific OpenGL version with the 2935bd8deadSopenharmony_ci knowledge that the app will run on a future version, context 2945bd8deadSopenharmony_ci creation will fail if GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB is 2955bd8deadSopenharmony_ci set and the context version returned cannot implement exactly 2965bd8deadSopenharmony_ci the requested version. 2975bd8deadSopenharmony_ci 2985bd8deadSopenharmony_ci * If attribute GLX_CONTEXT_PROFILE_MASK_ARB has no bits set; has 2995bd8deadSopenharmony_ci any bits set other than GLX_CONTEXT_CORE_PROFILE_BIT_ARB and 3005bd8deadSopenharmony_ci GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; has more than one of 3015bd8deadSopenharmony_ci these bits set; or if the implementation does not support the 3025bd8deadSopenharmony_ci requested profile, then GLXBadProfileARB is generated. 3035bd8deadSopenharmony_ci 3045bd8deadSopenharmony_ci * If <config> does not support compatible OpenGL contexts 3055bd8deadSopenharmony_ci providing the requested API major and minor version, 3065bd8deadSopenharmony_ci forward-compatible flag, and debug context flag, GLXBadFBConfig 3075bd8deadSopenharmony_ci is generated. 3085bd8deadSopenharmony_ci 3095bd8deadSopenharmony_ci * If an attribute or attribute value in <attrib_list> 3105bd8deadSopenharmony_ci is not recognized (including unrecognized bits in bitmask 3115bd8deadSopenharmony_ci attributes), BadValue is generated. 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci 3.3.7.1 Legacy Context Creation 3145bd8deadSopenharmony_ci ------------------------------- 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci To create an OpenGL rendering context of version 2.1 or below, call 3175bd8deadSopenharmony_ci 3185bd8deadSopenharmony_ci GLXContext glXCreateNewContext( 3195bd8deadSopenharmony_ci Display *dpy, 3205bd8deadSopenharmony_ci GLXFBConfig config, 3215bd8deadSopenharmony_ci int render_type, 3225bd8deadSopenharmony_ci GLXContext share_list, 3235bd8deadSopenharmony_ci Bool direct); 3245bd8deadSopenharmony_ci 3255bd8deadSopenharmony_ci Calling glXCreateNewContext is equivalent to the command sequence 3265bd8deadSopenharmony_ci 3275bd8deadSopenharmony_ci int attrib_list[] = { 3285bd8deadSopenharmony_ci GLX_RENDER_TYPE, render_type, 3295bd8deadSopenharmony_ci None 3305bd8deadSopenharmony_ci }; 3315bd8deadSopenharmony_ci 3325bd8deadSopenharmony_ci glXCreateContextAttribs(dpy, config, share_list, direct, attrib_list); 3335bd8deadSopenharmony_ci 3345bd8deadSopenharmony_ci The legacy context creation routines can only return OpenGL 3.1 3355bd8deadSopenharmony_ci contexts if the GL_ARB_compatibility extension is supported, and can 3365bd8deadSopenharmony_ci only return OpenGL 3.2 or greater contexts implementing the 3375bd8deadSopenharmony_ci compatibility profile. This ensures compatibility for existing 3385bd8deadSopenharmony_ci applications. However, 3.0-aware applications are encouraged to use 3395bd8deadSopenharmony_ci wglCreateContextAttribsARB instead of the legacy routines. 3405bd8deadSopenharmony_ci 3415bd8deadSopenharmony_ci To determine if an OpenGL rendering context is direct, call..." 3425bd8deadSopenharmony_ci 3435bd8deadSopenharmony_ci 3445bd8deadSopenharmony_ci In the description of glXMakeContextCurrent, replace the text 3455bd8deadSopenharmony_ci 3465bd8deadSopenharmony_ci "If either <draw> or <read> are not a valid GLX drawable, a 3475bd8deadSopenharmony_ci GLXBadDrawable error is generated." 3485bd8deadSopenharmony_ci 3495bd8deadSopenharmony_ci with 3505bd8deadSopenharmony_ci 3515bd8deadSopenharmony_ci "If either <draw> or <read> are not a valid GLX drawable, a 3525bd8deadSopenharmony_ci GLXBadDrawable error is generated, unless <draw> and <read> are both 3535bd8deadSopenharmony_ci None and the OpenGL version supported by <ctx> is 3.0 or greater. In 3545bd8deadSopenharmony_ci this case the context is made current without a default framebuffer, 3555bd8deadSopenharmony_ci as defined in chapter 4 of the OpenGL 3.0 Specification." 3565bd8deadSopenharmony_ci 3575bd8deadSopenharmony_ci Replace the text 3585bd8deadSopenharmony_ci 3595bd8deadSopenharmony_ci "To release the current context without assigning a new one, set 3605bd8deadSopenharmony_ci <ctx> to NULL and set <draw> and <read> to None. If <ctx> is NULL 3615bd8deadSopenharmony_ci and <draw> and <read> are not None, or if <draw> or <read> are set 3625bd8deadSopenharmony_ci to None and <ctx> is not NULL, then a BadMatch error will be 3635bd8deadSopenharmony_ci generated." 3645bd8deadSopenharmony_ci 3655bd8deadSopenharmony_ci with 3665bd8deadSopenharmony_ci 3675bd8deadSopenharmony_ci "To release the current context without assigning a new one, set 3685bd8deadSopenharmony_ci <ctx> to NULL and set <draw> and <read> to None. A BadMatch 3695bd8deadSopenharmony_ci error will be generated under any of the following conditions: 3705bd8deadSopenharmony_ci 3715bd8deadSopenharmony_ci * <ctx> is NULL, and either or both of <draw> and <read> are not 3725bd8deadSopenharmony_ci None. 3735bd8deadSopenharmony_ci * <ctx> is not NULL, and exactly one of <draw> or <read> is None. 3745bd8deadSopenharmony_ci * <ctx> is not NULL, both <draw> or <read> are None, and the 3755bd8deadSopenharmony_ci OpenGL version supported by <ctx> is less than 3.0." 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ci After the sentence 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci "The first time <ctx> is made current, the viewport and scissor 3805bd8deadSopenharmony_ci dimensions are set to the size of the draw drawable (as though 3815bd8deadSopenharmony_ci glViewport(0,0,w,h) and glScissor(0,0,w,h) were called, where <w> 3825bd8deadSopenharmony_ci and <h> are the width and height of the drawable, respectively)." 3835bd8deadSopenharmony_ci 3845bd8deadSopenharmony_ci insert 3855bd8deadSopenharmony_ci 3865bd8deadSopenharmony_ci "If the first time <ctx> is made current, it is without a default 3875bd8deadSopenharmony_ci framebuffer (e.g. both <draw> and <read> are None), then the 3885bd8deadSopenharmony_ci viewport and scissor regions are set as though glViewport(0,0,0,0) 3895bd8deadSopenharmony_ci and glScissor(0,0,0,0) were called." 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ciGLX Errors 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ci GLXBadProfileARB 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci The requested context profile is invalid or not supported. 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci BEC is the base error code for the extension, as returned by 3985bd8deadSopenharmony_ci XQueryExtension. 3995bd8deadSopenharmony_ci 4005bd8deadSopenharmony_ci Encoding: 4015bd8deadSopenharmony_ci 4025bd8deadSopenharmony_ci 1 0 Error 4035bd8deadSopenharmony_ci 1 BEC + 13 Error code (GLXBadProfileARB) 4045bd8deadSopenharmony_ci 2 CARD16 sequence number 4055bd8deadSopenharmony_ci 4 CARD32 bad profile bitmask 4065bd8deadSopenharmony_ci 2 CARD16 minor opcode 4075bd8deadSopenharmony_ci 1 CARD8 major opcode 4085bd8deadSopenharmony_ci 21 unused 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ciGLX Protocol 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci Three new GLX protocol commands are added. 4135bd8deadSopenharmony_ci 4145bd8deadSopenharmony_ci Send Extended Client Information To The Server (glXSetClientInfoARB 4155bd8deadSopenharmony_ci and glXSetClientInfo2ARB) 4165bd8deadSopenharmony_ci ---------------------------------------------- 4175bd8deadSopenharmony_ci 4185bd8deadSopenharmony_ci This request is sent to the server during initialization, describing 4195bd8deadSopenharmony_ci the GLX version, GLX extensions, GL version(s), and GL extensions 4205bd8deadSopenharmony_ci supported by the client. The client needs to send only names of GL 4215bd8deadSopenharmony_ci extensions that require server support, but must send all GLX 4225bd8deadSopenharmony_ci extension names. 4235bd8deadSopenharmony_ci 4245bd8deadSopenharmony_ci When the server receives a GetString request, it uses this 4255bd8deadSopenharmony_ci information to compute the version and extensions that can be 4265bd8deadSopenharmony_ci supported on the connection. The GLX client library should append 4275bd8deadSopenharmony_ci any client-side only extensions to the extension string returned by 4285bd8deadSopenharmony_ci the GetString request. When the server receives a 4295bd8deadSopenharmony_ci glXCreateContextAttribsARB request, it uses this information to 4305bd8deadSopenharmony_ci determine whether the requested context version, attributes, and 4315bd8deadSopenharmony_ci flags can be supported on the connection. 4325bd8deadSopenharmony_ci 4335bd8deadSopenharmony_ci glXSetClientInfo2ARB supersedes glXSetClientInfoARB, which in turn 4345bd8deadSopenharmony_ci supersedes the glXClientInfo request. The client should only send 4355bd8deadSopenharmony_ci glXSetClientInfo2ARB if both GLX_ARB_create_context and 4365bd8deadSopenharmony_ci GLX_ARB_create_context_profile are present in the server's extension 4375bd8deadSopenharmony_ci string. If only GLX_ARB_create_context is present, the client 4385bd8deadSopenharmony_ci should send glXSetClientInfoARB, and if neither are present 4395bd8deadSopenharmony_ci glXClientInfo should be sent. If none of these requests are ever 4405bd8deadSopenharmony_ci sent to the server, the server assumes the client supports OpenGL 4415bd8deadSopenharmony_ci major version 1 and minor version 0, GLX major version 1, and minor 4425bd8deadSopenharmony_ci version 0, and doesn't support any OpenGL or GLX extensions. 4435bd8deadSopenharmony_ci 4445bd8deadSopenharmony_ci glXSetClientInfo2ARB Encoding: 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 4475bd8deadSopenharmony_ci 1 35 GLX opcode (glXSetClientInfoARB) 4485bd8deadSopenharmony_ci 2 6+(n0*3)+((n1+p1)/4)+((n2+p2)/4) request length 4495bd8deadSopenharmony_ci 4 CARD32 client GLX major version 4505bd8deadSopenharmony_ci 4 CARD32 client GLX minor version 4515bd8deadSopenharmony_ci 4 n0 number of context versions 4525bd8deadSopenharmony_ci 4 n1 number of bytes in extension_string 4535bd8deadSopenharmony_ci 4 n2 number of bytes in glx_extension_string 4545bd8deadSopenharmony_ci n0*3*4 LISTofCARD32 context versions 4555bd8deadSopenharmony_ci n1 STRING8 client GL extension string 4565bd8deadSopenharmony_ci p1 unused, p1 = pad(n1) 4575bd8deadSopenharmony_ci n2 STRING8 client GLX extension string 4585bd8deadSopenharmony_ci p2 unused, p2 = pad(n2) 4595bd8deadSopenharmony_ci 4605bd8deadSopenharmony_ci glXSetClientInfoARB Encoding: 4615bd8deadSopenharmony_ci 4625bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 4635bd8deadSopenharmony_ci 1 33 GLX opcode (glXSetClientInfoARB) 4645bd8deadSopenharmony_ci 2 6+(n0*2)+((n1+p1)/4)+((n2+p2)/4) request length 4655bd8deadSopenharmony_ci 4 CARD32 client GLX major version 4665bd8deadSopenharmony_ci 4 CARD32 client GLX minor version 4675bd8deadSopenharmony_ci 4 n0 number of context versions 4685bd8deadSopenharmony_ci 4 n1 number of bytes in extension_string 4695bd8deadSopenharmony_ci 4 n2 number of bytes in glx_extension_string 4705bd8deadSopenharmony_ci n0*2*4 LISTofCARD32 context versions 4715bd8deadSopenharmony_ci n1 STRING8 client GL extension string 4725bd8deadSopenharmony_ci p1 unused, p1 = pad(n1) 4735bd8deadSopenharmony_ci n2 STRING8 client GLX extension string 4745bd8deadSopenharmony_ci p2 unused, p2 = pad(n2) 4755bd8deadSopenharmony_ci 4765bd8deadSopenharmony_ci "Context versions" is a list of (major version, minor version, 4775bd8deadSopenharmony_ci [profile mask]) tuple; each tuple describes a GL version supported 4785bd8deadSopenharmony_ci by the client. The profile mask member is only sent when using 4795bd8deadSopenharmony_ci glXSetClientInfo2ARB and is ignored for versions less than 3.2. 4805bd8deadSopenharmony_ci Only the highest supported version below 3.0 should be sent, since 4815bd8deadSopenharmony_ci OpenGL 2.1 is backwards compatible with all earlier versions. For 4825bd8deadSopenharmony_ci example, a context versions array containing 4835bd8deadSopenharmony_ci 4845bd8deadSopenharmony_ci { 2, 1, 0x0, 3, 0, 0x0, 3, 1, 0x0, 3, 2, 0x3 } 4855bd8deadSopenharmony_ci 4865bd8deadSopenharmony_ci Means that the client supports all GL versions between 1.0 and 2.1, 4875bd8deadSopenharmony_ci as well as versions 3.0, 3.1, and 3.2. Version 3.2 core and 4885bd8deadSopenharmony_ci compatibility profiles are supported. A BadValue error will be 4895bd8deadSopenharmony_ci generated if the client sends a 3.2 or greater version tuple with a 4905bd8deadSopenharmony_ci profile mask of 0, or with a profile mask that does not include the 4915bd8deadSopenharmony_ci core profile. 4925bd8deadSopenharmony_ci 4935bd8deadSopenharmony_ci If glXSetClientInfo2ARB or glXSetClientInfoARB are not sent by the 4945bd8deadSopenharmony_ci client prior to context creation the server will behave as if no 4955bd8deadSopenharmony_ci contexts above version 2.1 are supported, and assume the client 4965bd8deadSopenharmony_ci supports all GLX extensions. If the client sends 4975bd8deadSopenharmony_ci glXSetClientInfoARB and the server supports 4985bd8deadSopenharmony_ci GLX_ARB_create_context_profile, the server will behave as if no 4995bd8deadSopenharmony_ci contexts above version 3.1 are supported. 5005bd8deadSopenharmony_ci 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ci Context Creation with Attributes (glXCreateContextAttribsARB) 5035bd8deadSopenharmony_ci -------------------------------- 5045bd8deadSopenharmony_ci 5055bd8deadSopenharmony_ci This request is sent to create a context with specified attributes 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci 1 CARD8 opcode (X assigned) 5085bd8deadSopenharmony_ci 1 34 GLX opcode (glXCreateContextAttribsARB) 5095bd8deadSopenharmony_ci 2 7+n request length 5105bd8deadSopenharmony_ci 4 GLX_CONTEXT context 5115bd8deadSopenharmony_ci 4 FBCONFIGID fbconfig 5125bd8deadSopenharmony_ci 4 CARD32 screen 5135bd8deadSopenharmony_ci 4 GLX_CONTEXT share_context 5145bd8deadSopenharmony_ci 1 BOOL isdirect 5155bd8deadSopenharmony_ci 1 CARD8 reserved1 5165bd8deadSopenharmony_ci 2 CARD16 reserved2 5175bd8deadSopenharmony_ci 4 CARD32 num_attribs 5185bd8deadSopenharmony_ci 4*n LISTofATTRIBUTE_PAIR attribute, value pairs 5195bd8deadSopenharmony_ci 5205bd8deadSopenharmony_ciErrors 5215bd8deadSopenharmony_ci 5225bd8deadSopenharmony_ci GLX errors for glXCreateContextAttribsARB and glXSetClientInfo2ARB 5235bd8deadSopenharmony_ci as described in the body of the specification. 5245bd8deadSopenharmony_ci 5255bd8deadSopenharmony_ci glXMakeContextCurrent error behavior is relaxed to allow making an 5265bd8deadSopenharmony_ci OpenGL 3.0 or later context current without a default read or draw 5275bd8deadSopenharmony_ci framebuffer. 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ciDependencies on GLX_ARB_create_context 5305bd8deadSopenharmony_ci 5315bd8deadSopenharmony_ci If GLX_ARB_create_context_profile is supported, then 5325bd8deadSopenharmony_ci GLX_ARB_create_context must also be supported. 5335bd8deadSopenharmony_ci 5345bd8deadSopenharmony_ciDependencies on OpenGL 3.2 and later OpenGL versions 5355bd8deadSopenharmony_ci 5365bd8deadSopenharmony_ci If GLX_ARB_create_context is supported, and if the OpenGL 5375bd8deadSopenharmony_ci implementation supports OpenGL 3.2 or later, then 5385bd8deadSopenharmony_ci GLX_ARB_create_context_profile must also be supported. If the OpenGL 5395bd8deadSopenharmony_ci implementation does not support OpenGL 3.2 or later, then 5405bd8deadSopenharmony_ci GLX_ARB_create_context_profile may or may not be supported. 5415bd8deadSopenharmony_ci 5425bd8deadSopenharmony_ci If GLX_ARB_create_context_profile is not supported, then the 5435bd8deadSopenharmony_ci GLX_CONTEXT_PROFILE_MASK_ARB attribute, the 5445bd8deadSopenharmony_ci GLX_CONTEXT_CORE_PROFILE_BIT_ARB and 5455bd8deadSopenharmony_ci GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB bits in that attribute, 5465bd8deadSopenharmony_ci and the ERROR_INVALID_PROFILE_ARB error are not defined, and 5475bd8deadSopenharmony_ci specifying the attribute in <attribList> attribute will generate 5485bd8deadSopenharmony_ci BadValue. 5495bd8deadSopenharmony_ci 5505bd8deadSopenharmony_ciNew State 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci None 5535bd8deadSopenharmony_ci 5545bd8deadSopenharmony_ciNew Implementation Dependent State 5555bd8deadSopenharmony_ci 5565bd8deadSopenharmony_ci None 5575bd8deadSopenharmony_ci 5585bd8deadSopenharmony_ciConformance Tests 5595bd8deadSopenharmony_ci 5605bd8deadSopenharmony_ci TBD 5615bd8deadSopenharmony_ci 5625bd8deadSopenharmony_ciSample Code 5635bd8deadSopenharmony_ci 5645bd8deadSopenharmony_ci TBD 5655bd8deadSopenharmony_ci 5665bd8deadSopenharmony_ciIssues 5675bd8deadSopenharmony_ci 5685bd8deadSopenharmony_ci All non-window-system dependent issues described in the 5695bd8deadSopenharmony_ci WGL_ARB_create_context extension specification apply equally to 5705bd8deadSopenharmony_ci GLX_ARB_create_context. 5715bd8deadSopenharmony_ci 5725bd8deadSopenharmony_ci 1) Why was the context creation parameter <render_type> folded into the 5735bd8deadSopenharmony_ci attribute list, while the parameters <direct> and <share_context> 5745bd8deadSopenharmony_ci remains explicit? 5755bd8deadSopenharmony_ci 5765bd8deadSopenharmony_ci For <direct>, because different paths to the server may be taken for 5775bd8deadSopenharmony_ci creating direct contexts, and parsing the attribute list in the 5785bd8deadSopenharmony_ci client should not be required. For <share_context>, because putting 5795bd8deadSopenharmony_ci a GLXContext, which is implemented as a struct pointer, into a list 5805bd8deadSopenharmony_ci of 'int's does not work on LP64 architectures. 5815bd8deadSopenharmony_ci 5825bd8deadSopenharmony_ci 2) What is the behavior when creating an indirect rendering context 5835bd8deadSopenharmony_ci with attributes, flags, or a GLXFBConfig that require extensions not 5845bd8deadSopenharmony_ci supported by the client GLX implementation? 5855bd8deadSopenharmony_ci 5865bd8deadSopenharmony_ci Context creation will succeed, but using such features may be 5875bd8deadSopenharmony_ci impossible, since there may be no entry points defined in the client 5885bd8deadSopenharmony_ci library to control them. 5895bd8deadSopenharmony_ci 5905bd8deadSopenharmony_ci 3) Does client support for profiles need to be sent to the server 5915bd8deadSopenharmony_ci along with client support for versions? 5925bd8deadSopenharmony_ci 5935bd8deadSopenharmony_ci Yes. glXSetClientInfo2ARB extends glXSetClientInfoARB to support 5945bd8deadSopenharmony_ci sending supported profile masks for each supported version. 5955bd8deadSopenharmony_ci 5965bd8deadSopenharmony_ciRevision History 5975bd8deadSopenharmony_ci 5985bd8deadSopenharmony_ci Version 1, 2008/08/20 - Fork from WGL_ARB_create_context 5995bd8deadSopenharmony_ci 6005bd8deadSopenharmony_ci Version 2, 2008/08/21 - Add viewport/scissor setting behavior when 6015bd8deadSopenharmony_ci no default framebuffer is made current. 6025bd8deadSopenharmony_ci 6035bd8deadSopenharmony_ci Version 3, 2008/10/08 - Restore <direct> as an explicit parameter 6045bd8deadSopenharmony_ci instead of an attribute. Allow creating indirect contexts requiring 6055bd8deadSopenharmony_ci extensions not supported by the client. Add GLX protocol. Use 6065bd8deadSopenharmony_ci existing GLX_RENDER_TYPE token. Rename some parameters following 6075bd8deadSopenharmony_ci existing conventions. Update Errors section. 6085bd8deadSopenharmony_ci 6095bd8deadSopenharmony_ci Version 4, 2008/10/13 - Move "undefined behavior when successfully 6105bd8deadSopenharmony_ci creating a context requiring extensions not supported by the client" 6115bd8deadSopenharmony_ci language from the spec into the issues list. Remove unused 6125bd8deadSopenharmony_ci GLX_DIRECT_RENDERER_ARB token. Expand description of 6135bd8deadSopenharmony_ci glXSetClientInfoARB protocol negotiation. 6145bd8deadSopenharmony_ci 6155bd8deadSopenharmony_ci Version 5, 2008/10/22 - Mark as complete and assign extension number 6165bd8deadSopenharmony_ci for the registry. 6175bd8deadSopenharmony_ci 6185bd8deadSopenharmony_ci Version 6, 2008/10/24 - Renumber to ARB extension #55 - misplaced 6195bd8deadSopenharmony_ci into vendor extension numbering scheme at first. 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci Version 7, 2009/07/27 - Add profiled context creation functionality 6225bd8deadSopenharmony_ci (GLX_CONTEXT_PROFILE_MASK_ARB and the associated bit tokens). 6235bd8deadSopenharmony_ci Clarify that if the core profile is requested, the returned context 6245bd8deadSopenharmony_ci cannot restore functionality from the compatibility profile (issue 6255bd8deadSopenharmony_ci 17 in WGL_ARB_create_context). Specify the interdependencies between 6265bd8deadSopenharmony_ci the two GLX extensions defined here and OpenGL 3.2, including the 6275bd8deadSopenharmony_ci requirement that GLX_ARB_create_context_profile be supported if an 6285bd8deadSopenharmony_ci OpenGL 3.2 or later implementation is supported. Add issue 3 on 6295bd8deadSopenharmony_ci sending profile support to the server. 6305bd8deadSopenharmony_ci 6315bd8deadSopenharmony_ci Version 8, 2009/08/30 - Add glXSetClientInfo2ARB to support sending 6325bd8deadSopenharmony_ci profile masks with the versions as well. Specify which error is 6335bd8deadSopenharmony_ci generated in the case profile tokens are used with a server that 6345bd8deadSopenharmony_ci doesn't support them. Replace ERROR_INVALID_PROFILE_ARB with 6355bd8deadSopenharmony_ci GLXBadProfileARB and define its encoding. 6365bd8deadSopenharmony_ci 6375bd8deadSopenharmony_ci Version 9, 2009/11/19 - Clarify that BEC in the BadProfile protocol 6385bd8deadSopenharmony_ci represents the base error code for the GLX extension. 6395bd8deadSopenharmony_ci 6405bd8deadSopenharmony_ci Version 10, 2012/03/28 - Clarify error conditions when 6415bd8deadSopenharmony_ci glXMakeContextCurrent is called with a valid context and exactly one 6425bd8deadSopenharmony_ci None drawable. 643