15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci WGL_ARB_make_current_read 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci WGL_ARB_make_current_read 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Dale Kirkland, NVIDIA (dkirkland 'at' nvidia.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNotice 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Copyright (c) 2000-2013 The Khronos Group Inc. Copyright terms at 165bd8deadSopenharmony_ci http://www.khronos.org/registry/speccopyright.html 175bd8deadSopenharmony_ci 185bd8deadSopenharmony_ciSpecification Update Policy 195bd8deadSopenharmony_ci 205bd8deadSopenharmony_ci Khronos-approved extension specifications are updated in response to 215bd8deadSopenharmony_ci issues and bugs prioritized by the Khronos OpenGL Working Group. For 225bd8deadSopenharmony_ci extensions which have been promoted to a core Specification, fixes will 235bd8deadSopenharmony_ci first appear in the latest version of that core Specification, and will 245bd8deadSopenharmony_ci eventually be backported to the extension document. This policy is 255bd8deadSopenharmony_ci described in more detail at 265bd8deadSopenharmony_ci https://www.khronos.org/registry/OpenGL/docs/update_policy.php 275bd8deadSopenharmony_ci 285bd8deadSopenharmony_ciStatus 295bd8deadSopenharmony_ci 305bd8deadSopenharmony_ci Complete. Approved by ARB on March 15, 2000. 315bd8deadSopenharmony_ci 325bd8deadSopenharmony_ciVersion 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ci Last Modified Date: 03/12/2002 355bd8deadSopenharmony_ci Author Revision: 1.1 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci Based on: WGL_EXT_pbuffer specification 385bd8deadSopenharmony_ci Date: 3/1/1999 Version: 1.5 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciNumber 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci ARB Extension #10 435bd8deadSopenharmony_ci 445bd8deadSopenharmony_ciDependencies 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci WGL_ARB_extensions_string is required. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ciOverview 495bd8deadSopenharmony_ci 505bd8deadSopenharmony_ci The association of a separate "read" and "draw" DC with the current 515bd8deadSopenharmony_ci context allows for preprocessing of image data in an "off screen" 525bd8deadSopenharmony_ci DC which is then read into a visible DC for final display. 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciNew Procedures and Functions 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci BOOL wglMakeContextCurrentARB(HDC hDrawDC, 575bd8deadSopenharmony_ci HDC hReadDC, 585bd8deadSopenharmony_ci HGLRC hglrc); 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci HDC wglGetCurrentReadDCARB(VOID); 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ciNew Tokens 635bd8deadSopenharmony_ci 645bd8deadSopenharmony_ci New errors returned by GetLastError: 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 675bd8deadSopenharmony_ci ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.2 GL Specification (OpenGL Operation) 705bd8deadSopenharmony_ci 715bd8deadSopenharmony_ci None 725bd8deadSopenharmony_ci 735bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.2 GL Specification (Rasterization) 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci None 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 785bd8deadSopenharmony_ciand the Frame buffer) 795bd8deadSopenharmony_ci 805bd8deadSopenharmony_ci None 815bd8deadSopenharmony_ci 825bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.2 Specification (Special Functions) 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci None 855bd8deadSopenharmony_ci 865bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.2 Specification (State and State Requests) 875bd8deadSopenharmony_ci 885bd8deadSopenharmony_ci None 895bd8deadSopenharmony_ci 905bd8deadSopenharmony_ciAdditions to the GLX Specification 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci This specification is written for WGL. 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ciGLX Protocol 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci This specification is written for WGL. 975bd8deadSopenharmony_ci 985bd8deadSopenharmony_ciAdditions to the WGL specification 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci The function wglMakeContextCurrentARB associates the context <hglrc> 1015bd8deadSopenharmony_ci with the device <hDrawDC> for draws and the device <hReadDC> for 1025bd8deadSopenharmony_ci reads. All subsequent OpenGL calls made by the calling thread are 1035bd8deadSopenharmony_ci drawn on the device identified by <hDrawDC> and read on the device 1045bd8deadSopenharmony_ci identified by <hReadDC>. 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci The <hDrawDC> and <hReadDC> parameters must refer to drawing 1075bd8deadSopenharmony_ci surfaces supported by OpenGL. These parameters need not be the 1085bd8deadSopenharmony_ci same <hdc> that was passed to wglCreateContext when <hglrc> was 1095bd8deadSopenharmony_ci created. <hDrawDC> must have the same pixel format and be created 1105bd8deadSopenharmony_ci on the same physical device as the <hdc> that was passed into 1115bd8deadSopenharmony_ci wglCreateContext. <hReadDC> must be created on the same device as 1125bd8deadSopenharmony_ci the <hdc> that was passed to wglCreateContext and it must support 1135bd8deadSopenharmony_ci the same pixel type as the pixel format of the <hdc> that was 1145bd8deadSopenharmony_ci passed to wglCreateContext. 1155bd8deadSopenharmony_ci 1165bd8deadSopenharmony_ci If wglMakeContextCurrentARB is used to associate a different device 1175bd8deadSopenharmony_ci for reads than for draws, the "read" device will be used for the 1185bd8deadSopenharmony_ci following OpenGL operations: 1195bd8deadSopenharmony_ci 1205bd8deadSopenharmony_ci 1. Any pixel data that are sourced based on the value of READ_BUFFER. 1215bd8deadSopenharmony_ci Note, that accumulation operations use the value of READ_BUFFER, 1225bd8deadSopenharmony_ci but are not allowed when a different device context is used 1235bd8deadSopenharmony_ci for reads. In this case, the accumulation operation will 1245bd8deadSopenharmony_ci generate INVALID_OPERATION. 1255bd8deadSopenharmony_ci 1265bd8deadSopenharmony_ci 2. Any depth values that are retrieved by ReadPixels, CopyPixels, 1275bd8deadSopenharmony_ci or any OpenGL extension that sources depth images from the frame 1285bd8deadSopenharmony_ci buffer in the manner of ReadPixels and CopyPixels. 1295bd8deadSopenharmony_ci 1305bd8deadSopenharmony_ci 3. Any stencil values that are retrieved by ReadPixels, CopyPixels, 1315bd8deadSopenharmony_ci or any OpenGL extension that sources stencil images from the 1325bd8deadSopenharmony_ci framebuffer in the manner of ReadPixels and CopyPixels. 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci These frame buffer values are taken from the surface associated with 1355bd8deadSopenharmony_ci the device context specified by <hReadDC>. 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci No error will be generated if the value of READ_BUFFER at the time 1385bd8deadSopenharmony_ci the wglMakeContextCurrentARB call is made does not correspond to a 1395bd8deadSopenharmony_ci valid color buffer in <hReadDC>. Also, no error due to READ_BUFFER 1405bd8deadSopenharmony_ci mismatch will be generated by subsequent calls to any of the 1415bd8deadSopenharmony_ci operations enumerated above, but the pixels values used will be 1425bd8deadSopenharmony_ci undefined until READ_BUFFER is set to a color buffer that is valid 1435bd8deadSopenharmony_ci in the <hReadDC>. Operations that query the value of READ_BUFFER 1445bd8deadSopenharmony_ci (i.e., Get, PushAttrib) use the value set last in the context, 1455bd8deadSopenharmony_ci independent of whether it is a valid buffer in <hReadDC>. 1465bd8deadSopenharmony_ci 1475bd8deadSopenharmony_ci Error conditions set by ReadBuffer and by the operations enumerated 1485bd8deadSopenharmony_ci above are with respect to color and ancillary buffers available in 1495bd8deadSopenharmony_ci <hReadDC> (i.e., ReadBuffer(BACK_BUFFER) will generate an error 1505bd8deadSopenharmony_ci when <hReadDC> is single buffered, and so will an operation that 1515bd8deadSopenharmony_ci tries to source stencil images when <hReadDC> does not have a 1525bd8deadSopenharmony_ci stencil buffer). When the read buffer is set implicitly via 1535bd8deadSopenharmony_ci PopAttrib to a state not supported by the pixel format, an error 1545bd8deadSopenharmony_ci may be generated. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ci If wglMakeContextCurrentARB succeeds, the return value is TRUE. 1575bd8deadSopenharmony_ci If the function fails, the return value is FALSE. To get extended 1585bd8deadSopenharmony_ci error information, call GetLastError. Possible errors are as follows: 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci ERROR_INVALID_PIXEL_FORMAT The pixel format associated with 1615bd8deadSopenharmony_ci <hDrawDC> does not match the pixel 1625bd8deadSopenharmony_ci format associated with the render 1635bd8deadSopenharmony_ci context. 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ci ERROR_INVALID_PIXEL_TYPE_ARB The pixel type for <hReadDC> is 1665bd8deadSopenharmony_ci different than the pixel type 1675bd8deadSopenharmony_ci associated with the <hdc> that was 1685bd8deadSopenharmony_ci passed to wglCreateContext. 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 1715bd8deadSopenharmony_ci The device contexts specified by 1725bd8deadSopenharmony_ci <hReadDC> and <hDrawDC> are not 1735bd8deadSopenharmony_ci compatible. This can occur if the 1745bd8deadSopenharmony_ci device contexts are managed by 1755bd8deadSopenharmony_ci different drivers or possibly on 1765bd8deadSopenharmony_ci different graphics adapters. 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci ERROR_DC_NOT_FOUND <hReadDC> or <hDrawDC> is not a valid 1795bd8deadSopenharmony_ci device context. 1805bd8deadSopenharmony_ci 1815bd8deadSopenharmony_ci ERROR_NO_SYSTEM_RESOURCES The device contexts specified by 1825bd8deadSopenharmony_ci <hReadDC> and <hDrawDC> cannot exist 1835bd8deadSopenharmony_ci in the framebuffer simultaneously. 1845bd8deadSopenharmony_ci 1855bd8deadSopenharmony_ci wglGetCurrentReadDC returns a handle to the "read" device context that 1865bd8deadSopenharmony_ci is associated with the current OpenGL rendering context of the calling 1875bd8deadSopenharmony_ci thread. If the calling thread does not have a current context, the 1885bd8deadSopenharmony_ci return value is NULL. 1895bd8deadSopenharmony_ci 1905bd8deadSopenharmony_ciDependencies on WGL_ARB_extensions_string 1915bd8deadSopenharmony_ci 1925bd8deadSopenharmony_ci Because there is no way to extend wgl, these calls are defined in 1935bd8deadSopenharmony_ci the ICD and can be called by obtaining the address with 1945bd8deadSopenharmony_ci wglGetProcAddress. Because this extension is a WGL extension, it 1955bd8deadSopenharmony_ci is not included in the GL_EXTENSIONS string. Its existence can be 1965bd8deadSopenharmony_ci determined with the WGL_ARB_extensions_string extension. 1975bd8deadSopenharmony_ci 1985bd8deadSopenharmony_ciNew State 1995bd8deadSopenharmony_ci 2005bd8deadSopenharmony_ci None 2015bd8deadSopenharmony_ci 2025bd8deadSopenharmony_ciNew Implementation Dependent State 2035bd8deadSopenharmony_ci 2045bd8deadSopenharmony_ci None 2055bd8deadSopenharmony_ci 2065bd8deadSopenharmony_ciConformance Testing 2075bd8deadSopenharmony_ci 2085bd8deadSopenharmony_ci 1. Create two non-overlapping windows (windows 1 and 2). 2095bd8deadSopenharmony_ci 2. Create three contexts (context A, B, and C). 2105bd8deadSopenharmony_ci 3. Set context A to draw to window 1 and read from window 1. 2115bd8deadSopenharmony_ci 4. Set context B to draw to window 2 and read from window 1. 2125bd8deadSopenharmony_ci 5. Set context C to draw to window 2 and read from window 2. 2135bd8deadSopenharmony_ci 6. For a conformance test (TBD), 2145bd8deadSopenharmony_ci a. Draw using context A. 2155bd8deadSopenharmony_ci b. Blit from window to window using context B. 2165bd8deadSopenharmony_ci c. Test conformance using context C. 2175bd8deadSopenharmony_ci 7. If pixel buffers are supported, repeat using a pixel buffer. 2185bd8deadSopenharmony_ci 2195bd8deadSopenharmony_ciRevision History 2205bd8deadSopenharmony_ci 2215bd8deadSopenharmony_ci 12/16/1999 0.1 2225bd8deadSopenharmony_ci - First ARB draft based on the EXT specification. 2235bd8deadSopenharmony_ci 2245bd8deadSopenharmony_ci 03/15/2000 0.2 2255bd8deadSopenharmony_ci - Removed the changes to Chapter 4. 2265bd8deadSopenharmony_ci - Added a discussion that accumulation operations may 2275bd8deadSopenharmony_ci generate INVALID_OPERATION. 2285bd8deadSopenharmony_ci - PopAttrib may (not will) generate an error. 2295bd8deadSopenharmony_ci - Added an error if the read and draw DCs are not managed 2305bd8deadSopenharmony_ci on the same driver. 2315bd8deadSopenharmony_ci 2325bd8deadSopenharmony_ci 03/22/2000 1.0 2335bd8deadSopenharmony_ci - Changed rendering context to device context. 2345bd8deadSopenharmony_ci - Added the new error conditions values. 2355bd8deadSopenharmony_ci - Approved by ARB: 10-0-0. 2365bd8deadSopenharmony_ci 2375bd8deadSopenharmony_ci 03/12/2002 1.1 2385bd8deadSopenharmony_ci - Updated contact information. 239