15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci WGL_ARB_create_context 45bd8deadSopenharmony_ci WGL_ARB_create_context_profile 55bd8deadSopenharmony_ci 65bd8deadSopenharmony_ciName Strings 75bd8deadSopenharmony_ci 85bd8deadSopenharmony_ci WGL_ARB_create_context 95bd8deadSopenharmony_ci WGL_ARB_create_context_profile 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ciContact 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ci Jon Leech (jon 'at' alumni.caltech.edu) 145bd8deadSopenharmony_ci Michael Gold, NVIDIA (gold 'at' nvidia.com) 155bd8deadSopenharmony_ci 165bd8deadSopenharmony_ciNotice 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ci Copyright (c) 2009-2013 The Khronos Group Inc. Copyright terms at 195bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciSpecification Update Policy 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 245bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 255bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 265bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 275bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 285bd8deadSopenharmony_ci described in more detail at 295bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 305bd8deadSopenharmony_ci 315bd8deadSopenharmony_ciIP Status 325bd8deadSopenharmony_ci 335bd8deadSopenharmony_ci No known IP claims. 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciStatus 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Complete. Approved by the ARB on July 28, 2009. 385bd8deadSopenharmony_ci Approved by the Khronos Board of Promoters on August 28, 2009. 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciVersion 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci July 28, 2009 (version 20) 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciNumber 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci ARB Extension #55 (WGL_ARB_create_context) 475bd8deadSopenharmony_ci ARB Extension #74 (WGL_ARB_create_context_profile) 485bd8deadSopenharmony_ci 495bd8deadSopenharmony_ciDependencies 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci WGL_ARB_extensions_string is required. 525bd8deadSopenharmony_ci 535bd8deadSopenharmony_ci The presence of an OpenGL 3.2 or later implementation determines 545bd8deadSopenharmony_ci whether or not WGL_ARB_create_context_profile is required. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ciOverview 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ci With the advent of new versions of OpenGL which deprecate features 595bd8deadSopenharmony_ci and/or break backward compatibility with older versions, there is a 605bd8deadSopenharmony_ci need and desire to indicate at context creation which interface will 615bd8deadSopenharmony_ci be used. These extensions add a new context creation routine with 625bd8deadSopenharmony_ci attributes specifying the GL version and context properties 635bd8deadSopenharmony_ci requested for the context, and additionally add an attribute 645bd8deadSopenharmony_ci specifying the GL profile requested for a context of OpenGL 3.2 or 655bd8deadSopenharmony_ci later. 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ciNew Procedures and Functions 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci HGLRC wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, 705bd8deadSopenharmony_ci const int *attribList) 715bd8deadSopenharmony_ci 725bd8deadSopenharmony_ciNew Tokens 735bd8deadSopenharmony_ci 745bd8deadSopenharmony_ci Accepted as an attribute name in <*attribList>: 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 775bd8deadSopenharmony_ci WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 785bd8deadSopenharmony_ci WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 795bd8deadSopenharmony_ci WGL_CONTEXT_FLAGS_ARB 0x2094 805bd8deadSopenharmony_ci WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ci Accepted as bits in the attribute value for WGL_CONTEXT_FLAGS in 835bd8deadSopenharmony_ci <*attribList>: 845bd8deadSopenharmony_ci 855bd8deadSopenharmony_ci WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 865bd8deadSopenharmony_ci WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci Accepted as bits in the attribute value for 895bd8deadSopenharmony_ci WGL_CONTEXT_PROFILE_MASK_ARB in <*attribList>: 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 925bd8deadSopenharmony_ci WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci New errors returned by GetLastError: 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci ERROR_INVALID_VERSION_ARB 0x2095 975bd8deadSopenharmony_ci ERROR_INVALID_PROFILE_ARB 0x2096 985bd8deadSopenharmony_ci 995bd8deadSopenharmony_ciAdditions to the OpenGL / GLX / GLX Protocol Specificaitons 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci None. This specification is written for WGL. 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciAdditions to the WGL specification 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Context Creation 1065bd8deadSopenharmony_ci ---------------- 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci To create an OpenGL rendering context, call 1095bd8deadSopenharmony_ci 1105bd8deadSopenharmony_ci HGLRC wglCreateContextAttribsARB(HDC hDC, HGLRC hshareContext, 1115bd8deadSopenharmony_ci const int *attribList); 1125bd8deadSopenharmony_ci 1135bd8deadSopenharmony_ci If wglCreateContextAttribsARB succeeds, it initializes the context 1145bd8deadSopenharmony_ci to the initial state defined by the OpenGL specification, and 1155bd8deadSopenharmony_ci returns a handle to it. The handle can be used (via wglMakeCurrent 1165bd8deadSopenharmony_ci or wglMakeContextCurrentARB) with any HDC sharing the same pixel 1175bd8deadSopenharmony_ci format as <hDC>, and created on the same device, subject to 1185bd8deadSopenharmony_ci constraints imposed by the API version. 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci If <hshareContext> is not 0, then all shareable data (excluding 1215bd8deadSopenharmony_ci OpenGL texture objects named 0) will be shared by <hshareContext>, 1225bd8deadSopenharmony_ci all other contexts <hshareContext> already shares with, and the 1235bd8deadSopenharmony_ci newly created context. An arbitrary number of contexts can share 1245bd8deadSopenharmony_ci data in this fashion. 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci <attribList> specifies a list of attributes for the context. The 1275bd8deadSopenharmony_ci list consists of a sequence of <name,value> pairs terminated by the 1285bd8deadSopenharmony_ci value 0. If an attribute is not specified in <attribList>, then the 1295bd8deadSopenharmony_ci default value specified below is used instead. If an attribute is 1305bd8deadSopenharmony_ci specified more than once, then the last value specified is used. 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci <attribList> may be NULL or empty (first attribute is 0), in which 1335bd8deadSopenharmony_ci case all attributes assume their default values as described below. 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ci The attribute names WGL_CONTEXT_MAJOR_VERSION_ARB and 1365bd8deadSopenharmony_ci WGL_CONTEXT_MINOR_VERSION_ARB request an OpenGL context supporting 1375bd8deadSopenharmony_ci the specified version of the API. If successful, the context 1385bd8deadSopenharmony_ci returned must be backwards compatible with the context requested. 1395bd8deadSopenharmony_ci Backwards compatibility is determined as follows: 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci If a version less than or equal to 3.0 is requested, the context 1425bd8deadSopenharmony_ci returned may implement any of the following versions: 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci * Any version no less than that requested and no greater than 3.0. 1455bd8deadSopenharmony_ci * Version 3.1, if the GL_ARB_compatibility extension is also 1465bd8deadSopenharmony_ci implemented. 1475bd8deadSopenharmony_ci * The compatibility profile of version 3.2 or greater. 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci If version 3.1 is requested, the context returned may implement 1505bd8deadSopenharmony_ci any of the following versions: 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci * Version 3.1. The GL_ARB_compatibility extension may or may not 1535bd8deadSopenharmony_ci be implemented, as determined by the implementation. 1545bd8deadSopenharmony_ci * The core profile of version 3.2 or greater. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci If version 3.2 or greater is requested, the context returned may 1575bd8deadSopenharmony_ci implement any of the following versions: 1585bd8deadSopenharmony_ci 1595bd8deadSopenharmony_ci * The requested profile of the requested version. 1605bd8deadSopenharmony_ci * The requested profile of any later version, so long as no 1615bd8deadSopenharmony_ci features have been removed from that later version and profile. 1625bd8deadSopenharmony_ci 1635bd8deadSopenharmony_ci Querying the GL_VERSION string with glGetString (or the 1645bd8deadSopenharmony_ci GL_MAJOR_VERSION and GL_MINOR_VERSION values with glGetIntegerv, in 1655bd8deadSopenharmony_ci a 3.0 or later context) will return the actual version supported by 1665bd8deadSopenharmony_ci a context. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ci The default values for WGL_CONTEXT_MAJOR_VERSION_ARB and 1695bd8deadSopenharmony_ci WGL_CONTEXT_MINOR_VERSION_ARB are 1 and 0 respectively. In this 1705bd8deadSopenharmony_ci case, implementations will typically return the most recent version 1715bd8deadSopenharmony_ci of OpenGL they support which is backwards compatible with OpenGL 1.0 1725bd8deadSopenharmony_ci (e.g. 3.0, 3.1 + GL_ARB_compatibility, or 3.2 compatibility profile) 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci The attribute name WGL_CONTEXT_PROFILE_MASK_ARB requests an OpenGL 1755bd8deadSopenharmony_ci context supporting a specific <profile> of the API. If the 1765bd8deadSopenharmony_ci WGL_CONTEXT_CORE_PROFILE_BIT_ARB bit is set in the attribute value, 1775bd8deadSopenharmony_ci then a context implementing the <core> profile of OpenGL is 1785bd8deadSopenharmony_ci returned. If the WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB bit is 1795bd8deadSopenharmony_ci set, then a context implementing the <compatibility> profile is 1805bd8deadSopenharmony_ci returned. If the requested OpenGL version is less than 3.2, 1815bd8deadSopenharmony_ci WGL_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality of the 1825bd8deadSopenharmony_ci context is determined solely by the requested version. 1835bd8deadSopenharmony_ci 1845bd8deadSopenharmony_ci Querying the value of GL_CONTEXT_PROFILE_MASK with glGetIntegerv 1855bd8deadSopenharmony_ci will return the profile mask used to create the context. This query 1865bd8deadSopenharmony_ci is only supported in an OpenGL 3.2 or later context. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci The default value for WGL_CONTEXT_PROFILE_MASK_ARB is 1895bd8deadSopenharmony_ci WGL_CONTEXT_CORE_PROFILE_BIT_ARB. All OpenGL 3.2 implementations are 1905bd8deadSopenharmony_ci required to implement the core profile, but implementation of the 1915bd8deadSopenharmony_ci compatibility profile is optional. 1925bd8deadSopenharmony_ci 1935bd8deadSopenharmony_ci If the core profile is requested, then the context returned cannot 1945bd8deadSopenharmony_ci implement functionality defined only by the compatibility profile. 1955bd8deadSopenharmony_ci 1965bd8deadSopenharmony_ci The attribute name WGL_CONTEXT_LAYER_PLANE specifies the layer plane 1975bd8deadSopenharmony_ci that the rendering context is bound to. The attribute value has the 1985bd8deadSopenharmony_ci same meaning and allowed values as the <iLayerPlane> parameter of 1995bd8deadSopenharmony_ci wglCreateLayerContext. The default value for WGL_CONTEXT_LAYER_PLANE 2005bd8deadSopenharmony_ci is 0 (the main plane). 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ci The attribute name WGL_CONTEXT_FLAGS_ARB specifies a set of flag 2035bd8deadSopenharmony_ci bits affecting the rendering context. 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci If the WGL_CONTEXT_DEBUG_BIT_ARB flag bit is set in 2065bd8deadSopenharmony_ci WGL_CONTEXT_FLAGS_ARB, then a <debug context> will be created. Debug 2075bd8deadSopenharmony_ci contexts are intended for use during application development, and 2085bd8deadSopenharmony_ci provide additional runtime checking, validation, and logging 2095bd8deadSopenharmony_ci functionality while possibly incurring performance penalties. The 2105bd8deadSopenharmony_ci additional functionality provided by debug contexts may vary 2115bd8deadSopenharmony_ci according to the implementation(fn). In some cases a debug context 2125bd8deadSopenharmony_ci may be identical to a non-debug context. 2135bd8deadSopenharmony_ci [fn: The ARB Ecosystem TSG is still defining the expected and 2145bd8deadSopenharmony_ci required features of debug contexts.] 2155bd8deadSopenharmony_ci 2165bd8deadSopenharmony_ci If the WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB is set in 2175bd8deadSopenharmony_ci WGL_CONTEXT_FLAGS_ARB, then a <forward-compatible> context will be 2185bd8deadSopenharmony_ci created. Forward-compatible contexts are defined only for OpenGL 2195bd8deadSopenharmony_ci versions 3.0 and later. They must not support functionality marked 2205bd8deadSopenharmony_ci as <deprecated> by that version of the API, while a 2215bd8deadSopenharmony_ci non-forward-compatible context must support all functionality in 2225bd8deadSopenharmony_ci that version, deprecated or not. 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci The default value of WGL_CONTEXT_FLAGS_ARB is 0. 2255bd8deadSopenharmony_ci 2265bd8deadSopenharmony_ci On failure wglCreateContextAttribsARB returns NULL. Extended error 2275bd8deadSopenharmony_ci information can be obtained with GetLastError. Conditions that cause 2285bd8deadSopenharmony_ci failure include: 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci * If attributes WGL_CONTEXT_MAJOR_VERSION_ARB and 2315bd8deadSopenharmony_ci WGL_CONTEXT_MINOR_VERSION_ARB, when considered together with 2325bd8deadSopenharmony_ci WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, specify an OpenGL version 2335bd8deadSopenharmony_ci and feature set that are not defined, then ERROR_INVALID_VERSION_ARB 2345bd8deadSopenharmony_ci is generated. 2355bd8deadSopenharmony_ci 2365bd8deadSopenharmony_ci The defined versions of OpenGL at the time of writing are OpenGL 2375bd8deadSopenharmony_ci 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 2.0, 2.1, 3.0, 3.1, and 3.2. Feature 2385bd8deadSopenharmony_ci deprecation was introduced with OpenGL 3.0, so forward-compatible 2395bd8deadSopenharmony_ci contexts may only be requested for OpenGL 3.0 and above. Thus, 2405bd8deadSopenharmony_ci examples of invalid combinations of attributes include: 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci - Major version < 1 or > 3 2435bd8deadSopenharmony_ci - Major version == 1 and minor version < 0 or > 5 2445bd8deadSopenharmony_ci - Major version == 2 and minor version < 0 or > 1 2455bd8deadSopenharmony_ci - Major version == 3 and minor version > 2 2465bd8deadSopenharmony_ci - Forward-compatible flag set and major version < 3 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci Because the purpose of forward-compatible contexts is to allow 2495bd8deadSopenharmony_ci application development on a specific OpenGL version with the 2505bd8deadSopenharmony_ci knowledge that the app will run on a future version, context 2515bd8deadSopenharmony_ci creation will fail if WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB is set 2525bd8deadSopenharmony_ci and the context version returned cannot implement exactly the 2535bd8deadSopenharmony_ci requested version. 2545bd8deadSopenharmony_ci 2555bd8deadSopenharmony_ci * If attribute WGL_CONTEXT_PROFILE_MASK_ARB has no bits set; has any 2565bd8deadSopenharmony_ci bits set other than WGL_CONTEXT_CORE_PROFILE_BIT_ARB and 2575bd8deadSopenharmony_ci WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; has more than one of 2585bd8deadSopenharmony_ci these bits set; or if the implementation does not supported the 2595bd8deadSopenharmony_ci requested profile, then ERROR_INVALID_PROFILE_ARB is generated. 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ci * If <hShareContext> is neither zero nor a valid context handle, then 2625bd8deadSopenharmony_ci ERROR_INVALID_OPERATION is generated. 2635bd8deadSopenharmony_ci 2645bd8deadSopenharmony_ci * If <hDC> is not a valid device context handle, then 2655bd8deadSopenharmony_ci ERROR_DC_NOT_FOUND is generated. 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci * If the pixel format associated with <hDC> does not support OpenGL 2685bd8deadSopenharmony_ci contexts providing the requested API major and minor version, 2695bd8deadSopenharmony_ci forward-compatible flag, and/or debug context flag, then 2705bd8deadSopenharmony_ci ERROR_INVALID_PIXEL_FORMAT is generated. 2715bd8deadSopenharmony_ci 2725bd8deadSopenharmony_ci * If the OpenGL server context state for <hShareContext> exists in an 2735bd8deadSopenharmony_ci address space that cannot be shared with the newly created context, 2745bd8deadSopenharmony_ci if <shareContext> was created on a different device context than the 2755bd8deadSopenharmony_ci one referenced by <hDC>, or if the contexts are otherwise 2765bd8deadSopenharmony_ci incompatible (for example, one context being associated with a 2775bd8deadSopenharmony_ci hardware device driver and the other with a software renderer), then 2785bd8deadSopenharmony_ci ERROR_INVALID_OPERATION is generated. 2795bd8deadSopenharmony_ci 2805bd8deadSopenharmony_ci * If the server does not have enough resources to allocate the new 2815bd8deadSopenharmony_ci context, then ERROR_NO_SYSTEM_RESOURCES is generated. 2825bd8deadSopenharmony_ci 2835bd8deadSopenharmony_ci * If an unrecognized attribute is present in <attribList>, 2845bd8deadSopenharmony_ci then ERROR_INVALID_PARAMETER is generated. 2855bd8deadSopenharmony_ci 2865bd8deadSopenharmony_ci Legacy Context Creation 2875bd8deadSopenharmony_ci ----------------------- 2885bd8deadSopenharmony_ci 2895bd8deadSopenharmony_ci When this extension is supported, calling 2905bd8deadSopenharmony_ci 2915bd8deadSopenharmony_ci wglCreateContext(hdc) 2925bd8deadSopenharmony_ci 2935bd8deadSopenharmony_ci is equivalent to calling 2945bd8deadSopenharmony_ci 2955bd8deadSopenharmony_ci wglCreateContextAttribs(hdc,0,NULL). 2965bd8deadSopenharmony_ci 2975bd8deadSopenharmony_ci Calling 2985bd8deadSopenharmony_ci 2995bd8deadSopenharmony_ci wglCreateLayerContext(hdc,layer) 3005bd8deadSopenharmony_ci 3015bd8deadSopenharmony_ci is equivalent to calling 3025bd8deadSopenharmony_ci 3035bd8deadSopenharmony_ci wglCreateContextAttribs(hdc, 0, 3045bd8deadSopenharmony_ci { WGL_CONTEXT_LAYER_PLANE, layer, 0 }) . 3055bd8deadSopenharmony_ci 3065bd8deadSopenharmony_ci The legacy context creation routines can only return OpenGL 3.1 3075bd8deadSopenharmony_ci contexts if the GL_ARB_compatibility extension is supported, and can 3085bd8deadSopenharmony_ci only return OpenGL 3.2 or greater contexts implementing the 3095bd8deadSopenharmony_ci compatibility profile. This ensures compatibility for existing 3105bd8deadSopenharmony_ci applications. However, 3.0-aware applications are encouraged to use 3115bd8deadSopenharmony_ci wglCreateContextAttribsARB instead of the legacy routines. 3125bd8deadSopenharmony_ci 3135bd8deadSopenharmony_ci Binding a Context to a Surface 3145bd8deadSopenharmony_ci ------------------------------ 3155bd8deadSopenharmony_ci 3165bd8deadSopenharmony_ci (add to the description of wglMakeCurrent and 3175bd8deadSopenharmony_ci wglMakeContextCurrentARB) 3185bd8deadSopenharmony_ci 3195bd8deadSopenharmony_ci "If the OpenGL context version of <hglrc> is 3.0 or above, and if 3205bd8deadSopenharmony_ci either the <hdc> parameter of wglMakeCurrent is NULL, or both of the 3215bd8deadSopenharmony_ci <hDrawDC> and <hReadDC> parameters of wglMakeContextCurrentARB are 3225bd8deadSopenharmony_ci NULL, then the context is made current, but with no default 3235bd8deadSopenharmony_ci framebuffer defined. The effects of having no default framebuffer on 3245bd8deadSopenharmony_ci the GL are defined in Chapter 4 of the OpenGL 3.0 Specification. 3255bd8deadSopenharmony_ci 3265bd8deadSopenharmony_ci The first time <ctx> is made current, the viewport and scissor 3275bd8deadSopenharmony_ci dimensions are set to the size of the draw drawable (as though 3285bd8deadSopenharmony_ci glViewport(0,0,w,h) and glScissor(0,0,w,h) were called, where <w> 3295bd8deadSopenharmony_ci and <h> are the width and height of the drawable, respectively). If 3305bd8deadSopenharmony_ci the first time <ctx> is made current, it is without a default 3315bd8deadSopenharmony_ci framebuffer, then the viewport and scissor regions are set as though 3325bd8deadSopenharmony_ci glViewport(0,0,0,0) and glScissor(0,0,0,0) were called." 3335bd8deadSopenharmony_ci However, the viewport and scissor dimensions are not modified when 3345bd8deadSopenharmony_ci <ctx> is subsequently made current; it is the client's 3355bd8deadSopenharmony_ci responsibility to reset the viewport and scissor in this case." 3365bd8deadSopenharmony_ci 3375bd8deadSopenharmony_ci Sharing Objects Between Contexts 3385bd8deadSopenharmony_ci -------------------------------- 3395bd8deadSopenharmony_ci 3405bd8deadSopenharmony_ci (add to the description of wglShareLists) 3415bd8deadSopenharmony_ci 3425bd8deadSopenharmony_ci Future versions of OpenGL may only support being added to a share 3435bd8deadSopenharmony_ci group at context creation time. Specifying such a version of a 3445bd8deadSopenharmony_ci context as either the <hglrc1> or <hglrc2> arguments to 3455bd8deadSopenharmony_ci wglShareLists will fail. wglShareLists will return FALSE, and 3465bd8deadSopenharmony_ci GetLastError will return ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB. 3475bd8deadSopenharmony_ci 3485bd8deadSopenharmony_ciDependencies on WGL_ARB_extensions_string 3495bd8deadSopenharmony_ci 3505bd8deadSopenharmony_ci Because there is no way to extend wgl, these calls are defined in 3515bd8deadSopenharmony_ci the ICD and can be called by obtaining the address with 3525bd8deadSopenharmony_ci wglGetProcAddress. Because this extension is a WGL extension, it is 3535bd8deadSopenharmony_ci not included in the GL_EXTENSIONS string. Its existence can be 3545bd8deadSopenharmony_ci determined with the WGL_ARB_extensions_string extension. 3555bd8deadSopenharmony_ci 3565bd8deadSopenharmony_ciDependencies on WGL_ARB_create_context 3575bd8deadSopenharmony_ci 3585bd8deadSopenharmony_ci If WGL_ARB_create_context_profile is supported, then 3595bd8deadSopenharmony_ci WGL_ARB_create_context must also be supported. 3605bd8deadSopenharmony_ci 3615bd8deadSopenharmony_ciDependencies on OpenGL 3.2 and later OpenGL versions 3625bd8deadSopenharmony_ci 3635bd8deadSopenharmony_ci If WGL_ARB_create_context is supported, and if the OpenGL 3645bd8deadSopenharmony_ci implementation supports OpenGL 3.2 or later, then 3655bd8deadSopenharmony_ci WGL_ARB_create_context_profile must also be supported. If the OpenGL 3665bd8deadSopenharmony_ci implementation does not support OpenGL 3.2 or later, then 3675bd8deadSopenharmony_ci WGL_ARB_create_context_profile may or may not be supported. 3685bd8deadSopenharmony_ci 3695bd8deadSopenharmony_ci If WGL_ARB_create_context_profile is not supported, then the 3705bd8deadSopenharmony_ci WGL_CONTEXT_PROFILE_MASK_ARB attribute, the 3715bd8deadSopenharmony_ci WGL_CONTEXT_CORE_PROFILE_BIT_ARB and 3725bd8deadSopenharmony_ci WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB bits in that attribute, 3735bd8deadSopenharmony_ci and the ERROR_INVALID_PROFILE_ARB error are not defined, and 3745bd8deadSopenharmony_ci specifying the attribute in <attribList> attribute will generate an 3755bd8deadSopenharmony_ci error. 3765bd8deadSopenharmony_ci 3775bd8deadSopenharmony_ciNew State 3785bd8deadSopenharmony_ci 3795bd8deadSopenharmony_ci None 3805bd8deadSopenharmony_ci 3815bd8deadSopenharmony_ciNew Implementation Dependent State 3825bd8deadSopenharmony_ci 3835bd8deadSopenharmony_ci None 3845bd8deadSopenharmony_ci 3855bd8deadSopenharmony_ciConformance Tests 3865bd8deadSopenharmony_ci 3875bd8deadSopenharmony_ci TBD 3885bd8deadSopenharmony_ci 3895bd8deadSopenharmony_ciSample Code 3905bd8deadSopenharmony_ci 3915bd8deadSopenharmony_ci TBD 3925bd8deadSopenharmony_ci 3935bd8deadSopenharmony_ciIssues 3945bd8deadSopenharmony_ci 3955bd8deadSopenharmony_ci 1) Can different GL context versions share data? 3965bd8deadSopenharmony_ci 3975bd8deadSopenharmony_ci PROPOSED: Yes, with restrictions as defined by the supported feature 3985bd8deadSopenharmony_ci sets. For example, program and shader objects cannot be shared with 3995bd8deadSopenharmony_ci OpenGL 1.x contexts, which do not support them. 4005bd8deadSopenharmony_ci 4015bd8deadSopenharmony_ci NOTE: When the new object model is introduced, sharing must be 4025bd8deadSopenharmony_ci established at creation time, since the object handle namespace is 4035bd8deadSopenharmony_ci also shared. wglShareLists would therefore fail if either context 4045bd8deadSopenharmony_ci parameter to it were to be a context supporting the new object 4055bd8deadSopenharmony_ci model. 4065bd8deadSopenharmony_ci 4075bd8deadSopenharmony_ci 2) Should we introduce a token WGL_NONE to terminate attribute lists, 4085bd8deadSopenharmony_ci instead of using the value 0, by analogy to GLX and EGL? 4095bd8deadSopenharmony_ci 4105bd8deadSopenharmony_ci RESOLVED: No. 4115bd8deadSopenharmony_ci 4125bd8deadSopenharmony_ci 3) Should all GL context versions be able to bind to all the same pixel 4135bd8deadSopenharmony_ci formats? 4145bd8deadSopenharmony_ci 4155bd8deadSopenharmony_ci RESOLVED: unlike EGL, we don't expose the version restriction in the 4165bd8deadSopenharmony_ci pixel format. Instead, wglMakeCurrent may fail when binding contexts 4175bd8deadSopenharmony_ci to surfaces if the surface type is unrecognized by that context 4185bd8deadSopenharmony_ci version. No specific examples exist at present, but in a 4195bd8deadSopenharmony_ci hypothetical future version of the API supporting only the new 4205bd8deadSopenharmony_ci object model, such an API probably could not bind to pbuffer 4215bd8deadSopenharmony_ci surfaces. 4225bd8deadSopenharmony_ci 4235bd8deadSopenharmony_ci 4) Should there be a way to make a context current without binding 4245bd8deadSopenharmony_ci it to a window system drawable at the same time? 4255bd8deadSopenharmony_ci 4265bd8deadSopenharmony_ci RESOLVED: Yes, but only in OpenGL 3.0 and later. This results in a 4275bd8deadSopenharmony_ci context with an invalid default framebuffer, the meaning of which is 4285bd8deadSopenharmony_ci defined in the OpenGL 3.0 specification. 4295bd8deadSopenharmony_ci 4305bd8deadSopenharmony_ci NOTE: Apparently on Windows, opengl32.dll makes use of the drawable 4315bd8deadSopenharmony_ci argument to identify the namespace of the driver, so we may not be 4325bd8deadSopenharmony_ci able to work around it. 4335bd8deadSopenharmony_ci 4345bd8deadSopenharmony_ci 5) Should we add a token to the attrib list for pixel format selection 4355bd8deadSopenharmony_ci to indicate the GL context version, instead of introducing a new 4365bd8deadSopenharmony_ci entry point for context creation? 4375bd8deadSopenharmony_ci 4385bd8deadSopenharmony_ci RESOLVED: No. We want pixel formats to be portable between 4395bd8deadSopenharmony_ci feature-incompatible context versions, so that drawables and GL 4405bd8deadSopenharmony_ci objects that make sense to share, may be shared between such 4415bd8deadSopenharmony_ci contexts. This is important for code migration and backward 4425bd8deadSopenharmony_ci compatibility. 4435bd8deadSopenharmony_ci 4445bd8deadSopenharmony_ci 6) Do we need a "can be shared" parameter at context creation time? 4455bd8deadSopenharmony_ci 4465bd8deadSopenharmony_ci RESOLVED: No. All contexts have potential to share objects (whether 4475bd8deadSopenharmony_ci they actually can share depends on context version and feature sets, 4485bd8deadSopenharmony_ci and the address space they're created in). Savings from saying a 4495bd8deadSopenharmony_ci context cannot share objects are unclear but probably minimal. Such 4505bd8deadSopenharmony_ci a parameter would default to TRUE if it existed. 4515bd8deadSopenharmony_ci 4525bd8deadSopenharmony_ci 7) How are "debug contexts" created? 4535bd8deadSopenharmony_ci 4545bd8deadSopenharmony_ci RESOLVED: by specifying the WGL_CONTEXT_DEBUG_BIT_ARB flag in the 4555bd8deadSopenharmony_ci WGL_CONTEXT_FLAGS_ARB attribute value. 4565bd8deadSopenharmony_ci 4575bd8deadSopenharmony_ci DISCUSSION: For the most part, the behavior of debug contexts is 4585bd8deadSopenharmony_ci being determined by the ARB Ecosystem TSG. However, whatever their 4595bd8deadSopenharmony_ci behavior, it's clear that "debug contexts" may differ at a basic 4605bd8deadSopenharmony_ci level from regular contexts. Debug contexts might even go down a 4615bd8deadSopenharmony_ci completely separate driver path. So it's essential to know at 4625bd8deadSopenharmony_ci context creation time if a debug context is required. 4635bd8deadSopenharmony_ci 4645bd8deadSopenharmony_ci 8) Is wglCreateContextVersion a good name? 4655bd8deadSopenharmony_ci 4665bd8deadSopenharmony_ci Ian Romanick suggests wglCreateContextAttribs instead. Changed in 4675bd8deadSopenharmony_ci version 12. 4685bd8deadSopenharmony_ci 4695bd8deadSopenharmony_ci 9) Should the context version be named with separate major and minor 4705bd8deadSopenharmony_ci number attributes, or as a single (major*100 + minor*10) number as 4715bd8deadSopenharmony_ci in GLSL (e.g. version == 220 <-> major = 2, minor = 2)? 4725bd8deadSopenharmony_ci 4735bd8deadSopenharmony_ci John Kessenich argues for consistency with the existing GLSL naming 4745bd8deadSopenharmony_ci scheme. 4755bd8deadSopenharmony_ci 4765bd8deadSopenharmony_ci10) How are profiles specified? Why is the profile attribute a bitmask 4775bd8deadSopenharmony_ci rather than an enum? 4785bd8deadSopenharmony_ci 4795bd8deadSopenharmony_ci RESOLVED: Profiles are specified as individual bits passed in a 4805bd8deadSopenharmony_ci bitmask attribute. This attribute is ignored unless the OpenGL 4815bd8deadSopenharmony_ci version requested defines profiles (OpenGL 3.2 and later). While 4825bd8deadSopenharmony_ci only a single profile can be specified today, it is not unlikely 4835bd8deadSopenharmony_ci that eventually there will be profiles defined than can be 4845bd8deadSopenharmony_ci implemented in the same context. In that case we will need to be 4855bd8deadSopenharmony_ci able to specify multiple profiles at context creation and in the GL 4865bd8deadSopenharmony_ci context profile query, for which a bitmask is appropriate. 4875bd8deadSopenharmony_ci 4885bd8deadSopenharmony_ci11) Why is the value of WGL_CONTEXT_PROFILE_MASK_ARB in the GL 4895bd8deadSopenharmony_ci core enumerant range? 4905bd8deadSopenharmony_ci 4915bd8deadSopenharmony_ci RESOLVED: The token value for the context profile mask and for the 4925bd8deadSopenharmony_ci context profile bits should be shared by GL, GLX, and WGL to ease 4935bd8deadSopenharmony_ci implementation and reduce programming errors. These values are drawn 4945bd8deadSopenharmony_ci from the GL token ranges. 4955bd8deadSopenharmony_ci 4965bd8deadSopenharmony_ci12) What errors can result from requesting a profile? 4975bd8deadSopenharmony_ci 4985bd8deadSopenharmony_ci RESOLVED: Only a single profile can currently be requested. 4995bd8deadSopenharmony_ci Requesting no profile, more than one profile, or an unrecognized 5005bd8deadSopenharmony_ci profile are all errors. 5015bd8deadSopenharmony_ci 5025bd8deadSopenharmony_ci13) How does the profile request interact with older GL versions? 5035bd8deadSopenharmony_ci 5045bd8deadSopenharmony_ci RESOLVED: It does not. The profile mask is ignored unless the 5055bd8deadSopenharmony_ci requested GL version is >= 3.2. 5065bd8deadSopenharmony_ci 5075bd8deadSopenharmony_ci DISCUSSION: Bruce had proposed using the profile mask to control 5085bd8deadSopenharmony_ci whether or not GL_ARB_compatibility was provided in earlier GL 5095bd8deadSopenharmony_ci versions, but general feeling was that apps had already had to sort 5105bd8deadSopenharmony_ci this out, and it's difficult to see how to define a default value 5115bd8deadSopenharmony_ci that can always be implemented (core profile) without changing the 5125bd8deadSopenharmony_ci existing behavior of wglCreateContextAttribsARB on implementations 5135bd8deadSopenharmony_ci which implement GL_ARB_compatibility by default when an OpenGL 3.1 5145bd8deadSopenharmony_ci context is requested. 5155bd8deadSopenharmony_ci 5165bd8deadSopenharmony_ci14) How does the profile request interact with the forward compatibility 5175bd8deadSopenharmony_ci bit? 5185bd8deadSopenharmony_ci 5195bd8deadSopenharmony_ci RESOLVED: Nothing special need be done here. If the forward 5205bd8deadSopenharmony_ci compatibility bit is set, the returned context must not implement 5215bd8deadSopenharmony_ci deprecated functionality in that profile (nothing is deprecated 5225bd8deadSopenharmony_ci from the OpenGL 3.2 compatibility profile, so a forward-compatible 5235bd8deadSopenharmony_ci compatibility profile has exactly the same functionality as 5245bd8deadSopenharmony_ci a non-forward-compatible compatibility profile, while a 5255bd8deadSopenharmony_ci forward-compatible core profile would leave out only the handful 5265bd8deadSopenharmony_ci of features - wide lines and two queries - deprecated from core 5275bd8deadSopenharmony_ci OpenGL 3.2). 5285bd8deadSopenharmony_ci 5295bd8deadSopenharmony_ci15) How is context sharing between contexts of different versions 5305bd8deadSopenharmony_ci handled? 5315bd8deadSopenharmony_ci 5325bd8deadSopenharmony_ci RESOLVED: It's up to the implementation whether or not to allow 5335bd8deadSopenharmony_ci this, and to define behavior when shared objects include state or 5345bd8deadSopenharmony_ci behaviors not described by one of the contexts sharing them (for 5355bd8deadSopenharmony_ci example, textures with nonzero width borders shared by 3.2 core and 5365bd8deadSopenharmony_ci compatibility profile contexts). 5375bd8deadSopenharmony_ci 5385bd8deadSopenharmony_ci16) Is the GL_ARB_compatibility extension equivalent to the 5395bd8deadSopenharmony_ci compatibility profile? 5405bd8deadSopenharmony_ci 5415bd8deadSopenharmony_ci RESOLVED: No. The extension refers specifically to functionality 5425bd8deadSopenharmony_ci removed from OpenGL 3.1 and restored by this extension. The 5435bd8deadSopenharmony_ci compatibility profile also restores this functionality, but may 5445bd8deadSopenharmony_ci define additional interactions between new features in version 3.N 5455bd8deadSopenharmony_ci and the functionality removed in OpenGL 3.1. 5465bd8deadSopenharmony_ci 5475bd8deadSopenharmony_ci In other words, the extension is a subset of the compatibility 5485bd8deadSopenharmony_ci profile. A context implementing the compatibility profile for OpenGL 5495bd8deadSopenharmony_ci 3.2 or greater may (and probably will) choose to export 5505bd8deadSopenharmony_ci GL_ARB_compatibility, but this is not required. 5515bd8deadSopenharmony_ci 5525bd8deadSopenharmony_ci17) If the core profile is requested, what additional functionality 5535bd8deadSopenharmony_ci can be provided? 5545bd8deadSopenharmony_ci 5555bd8deadSopenharmony_ci RESOLVED: Functionality defined only by the compatibility profile 5565bd8deadSopenharmony_ci cannot be implemented by a context supporting the core profile. For 5575bd8deadSopenharmony_ci example, if a 3.2 core profile is requested, that context cannot 5585bd8deadSopenharmony_ci implement the GL_ARB_compatibility extension. However, any desired 5595bd8deadSopenharmony_ci new functionality may be exposed via vendor or ARB extensions in the 5605bd8deadSopenharmony_ci normal fashion. 5615bd8deadSopenharmony_ci 5625bd8deadSopenharmony_ci 5635bd8deadSopenharmony_ciRevision History 5645bd8deadSopenharmony_ci 5655bd8deadSopenharmony_ci Version 20, 2009/07/28 - Correct issue 14 to note that the 3.2 5665bd8deadSopenharmony_ci compatibility profile does not deprecated anything. 5675bd8deadSopenharmony_ci 5685bd8deadSopenharmony_ci Version 19, 2009/07/27 - Add profiled context creation functionality 5695bd8deadSopenharmony_ci (WGL_CONTEXT_PROFILE_MASK_ARB and the associated bit tokens, error 5705bd8deadSopenharmony_ci code, and issues 10-16). Clarify that if the core profile is 5715bd8deadSopenharmony_ci requested, the returned context cannot restore functionality from 5725bd8deadSopenharmony_ci the compatibility profile (issue 17 and corresponding spec 5735bd8deadSopenharmony_ci language). Add ERROR_INVALID_PARAMETER error if an unrecognized 5745bd8deadSopenharmony_ci attribute is specified. Specify the interdependencies between the 5755bd8deadSopenharmony_ci two WGL extensions defined here and OpenGL 3.2, including the 5765bd8deadSopenharmony_ci requirement that WGL_ARB_create_context_profile be supported if an 5775bd8deadSopenharmony_ci OpenGL 3.2 or later implementation is supported. 5785bd8deadSopenharmony_ci 5795bd8deadSopenharmony_ci Version 18, 2009/07/24 - Specify that repeated attribute values 5805bd8deadSopenharmony_ci always result in the last specified value being used. 5815bd8deadSopenharmony_ci 5825bd8deadSopenharmony_ci Version 17, 2009/07/23 - Update the extension to clarify 5835bd8deadSopenharmony_ci interactions with OpenGL 3.1 and greater, allow returning 3.0 and 5845bd8deadSopenharmony_ci greater contexts from the legacy context creation routines so long 5855bd8deadSopenharmony_ci as they're backwards compatible, and mandate that requesting a 5865bd8deadSopenharmony_ci forward-compatible context always return exactly the requested 5875bd8deadSopenharmony_ci version (bugs 5112, 5349). 5885bd8deadSopenharmony_ci 5895bd8deadSopenharmony_ci Version 16, 2008/08/21 - Add initial viewport/scissor setting 5905bd8deadSopenharmony_ci behavior (cloned from GLX, including the case when no default 5915bd8deadSopenharmony_ci framebuffer is made current. 5925bd8deadSopenharmony_ci 5935bd8deadSopenharmony_ci Version 15, 2008/08/10 - Assign enumerant values and extension 5945bd8deadSopenharmony_ci number. 5955bd8deadSopenharmony_ci 5965bd8deadSopenharmony_ci Version 14, 2008/07/10 - Add trailing zero to array attributes in 5975bd8deadSopenharmony_ci wglCreateLayerContext example (Pat Brown). 5985bd8deadSopenharmony_ci 5995bd8deadSopenharmony_ci Version 13, 2008/07/03 - Update versioning behavior so asking for <= 6005bd8deadSopenharmony_ci 2.1 will return <= 2.1, asking for 3.0 will return 3.0, and noting 6015bd8deadSopenharmony_ci that we must update interactions with GL once 3.1 is defined. 6025bd8deadSopenharmony_ci Mandated behavior of legacy context creation APIs when this 6035bd8deadSopenharmony_ci extension is supported (bug 3595). 6045bd8deadSopenharmony_ci 6055bd8deadSopenharmony_ci Version 12, 2008/07/02 - Rename WGL_PREVIEW_BIT to 6065bd8deadSopenharmony_ci WGL_CONTEXT_FORWARD_COMPATIBLE_BIT and other replace "preview 6075bd8deadSopenharmony_ci context" with "forward-compatible context". Rename 6085bd8deadSopenharmony_ci wglCreateContextVersion to wglCreateContextAttribs. 6095bd8deadSopenharmony_ci 6105bd8deadSopenharmony_ci Version 11, 2008/06/12 - Use ARB suffix. Raise ERROR_INVALID_VERSION 6115bd8deadSopenharmony_ci instead of ERROR_INVALID_DATA on a bad version/preview combination. 6125bd8deadSopenharmony_ci 6135bd8deadSopenharmony_ci Version 10, 2008/04/08 - Changed "lite" to "preview" (still open for 6145bd8deadSopenharmony_ci discussion however), and changed version "2.2" to "3.0" following 6155bd8deadSopenharmony_ci the marketing TSG recommendation. Changed definition of preview 6165bd8deadSopenharmony_ci contexts so that deprecated functionality *must not* be supported. 6175bd8deadSopenharmony_ci Added issue 10 about how to handle profiles. 6185bd8deadSopenharmony_ci 6195bd8deadSopenharmony_ci Version 9, 2008/02/07 - Added version naming issue 9. 6205bd8deadSopenharmony_ci 6215bd8deadSopenharmony_ci Version 8, 2008/02/07 - Added naming issue 8. Removed reference to 6225bd8deadSopenharmony_ci GL version 3 in "Sharing Objects Between Contexts". 6235bd8deadSopenharmony_ci 6245bd8deadSopenharmony_ci Version 7, 2008/02/01 - Rewrote issues list in light of new API 6255bd8deadSopenharmony_ci direction, and reopened some issues. Added separate major and minor 6265bd8deadSopenharmony_ci version attributes and "lite" API flag. 6275bd8deadSopenharmony_ci 6285bd8deadSopenharmony_ci Version 6, 2007/05/22 - Resolve issue 4, although the exact 6295bd8deadSopenharmony_ci mechanism is still unknown. 6305bd8deadSopenharmony_ci 6315bd8deadSopenharmony_ci Version 5, 2007/04/09 - Added WGL_CONTEXT_FLAGS attribute and 6325bd8deadSopenharmony_ci WGL_CONTEXT_DEBUG_BIT flag, and a high-level description of the 6335bd8deadSopenharmony_ci concept of "debug contexts". 6345bd8deadSopenharmony_ci 6355bd8deadSopenharmony_ci Version 4, 2007/02/06 - Removed CreateContextVersion error when GL2 6365bd8deadSopenharmony_ci and Longs Peak contexts are placed in the same share group, and 6375bd8deadSopenharmony_ci referred to the GL_EXT_bind_image extension in issue 1. Added issues 6385bd8deadSopenharmony_ci 6 ("can be shared" attribute) and 7 (creation of debug contexts) per 6395bd8deadSopenharmony_ci discussion at the Atlanta F2F ARB meeting. Added error condition for 6405bd8deadSopenharmony_ci wglShareLists if passed a Longs Peak context handle. 6415bd8deadSopenharmony_ci 6425bd8deadSopenharmony_ci Version 3, 2007/01/22 - added issue 5. 6435bd8deadSopenharmony_ci 6445bd8deadSopenharmony_ci Version 2, 2007/01/17 - change to the same style as 6455bd8deadSopenharmony_ci eglCreateContext, using an attribute list. Add wglMakeCurrent 6465bd8deadSopenharmony_ci language disallowing current 3.x contexts bound to pbuffers, and 6475bd8deadSopenharmony_ci allowing current 3.x context without a window-system provided 6485bd8deadSopenharmony_ci framebuffer. 6495bd8deadSopenharmony_ci 6505bd8deadSopenharmony_ci Version 1, 2007/1/17 - First draft 651