1Name 2 3 EXT_make_current_read 4 5Name Strings 6 7 WGL_EXT_make_current_read 8 9Version 10 11 Date: 3/1/1999 Version: 1.5 12 13Number 14 15 169 16 17Dependencies 18 19 WGL_EXT_extensions_string is required. 20 21Overview 22 23 The association of a separate "read" and "draw" DC with the current 24 context allows for preprocessing of image data in an "off screen" 25 DC which is then read into a visible DC for final display. 26 27New Procedures and Functions 28 29 BOOL wglMakeContextCurrentEXT(HDC hDrawDC, 30 HDC hReadDC, 31 HGLRC hglrc); 32 33 HDC wglGetCurrentReadDCEXT(VOID); 34 35New Tokens 36 37 Returned by GetLastError (when wglMakeContextCurrentEXT fails): 38 39 ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 40 41Additions to Chapter 2 of the 1.2 GL Specification (OpenGL Operation) 42 43 None 44 45Additions to Chapter 3 of the 1.2 GL Specification (Rasterization) 46 47 None 48 49Additions to Chapter 4 of the 1.2 Specification (Per-Fragment Operations 50and the Frame buffer) 51 52 [The following restriction is added to the end of the introductory 53 paragraph of section 4.2.4] 54 55 Accumulation operations are only allowed when the device context used 56 for reading is identical to the device context used for drawing. 57 58 [The list of error conditions at the end of section 4.2.4] 59 If there is no accumulation buffer, or the GL is in color index mode, 60 or if the read device context and the draw device context are not 61 identical, Accum generates the error INVALID_OPERATION. 62 63Additions to Chapter 5 of the 1.2 Specification (Special Functions) 64 65 None 66 67Additions to Chapter 6 of the 1.2 Specification (State and State Requests) 68 69 None 70 71Additions to the WGL specification 72 73 The function wglMakeContextCurrentEXT associates the context <hglrc> 74 with the device <hDrawDC> for draws and the device <hReadDC> for 75 reads. All subsequent OpenGL calls made by the calling thread are 76 drawn on the device identified by <hDrawDC> and read on the device 77 identified by <hReadDC>. 78 79 The <hDrawDC> and <hReadDC> parameters must refer to drawing surfaces 80 supported by OpenGL. These parameters need not be the same <hdc> 81 that was passed to wglCreateContext when <hglrc> was created. 82 <hDrawDC> must have the same pixel format and be created on the 83 same device as the <hdc> that was passed into wlgCreateContext. 84 <hReadDC> must be created on the same device as the <hdc> that was 85 passed to wglCreateContext and it must support the same pixel type 86 as the pixel format of the <hdc> that was passed to wglCreateContext. 87 88 If wglMakeContextCurrentEXT is used to associate a different device 89 for reads than for draws, the "read" device will be used for the 90 following OpenGL operations: 91 92 1. Any pixel data that are sourced based on the value of READ_BUFFER. 93 Note, that accumulation operations use the value of READ_BUFFER, 94 but are not allowed when a different rendering context is used 95 for reads. 96 97 2. Any depth values that are retrieved by glReadPixels, glCopyPixels, 98 or any OpenGL extension that sources depth images from the frame 99 buffer in the manner of glReadPixels and glCopyPixels. 100 101 3. Any stencil values that are retrieved by glReadPixels, glCopyPixels, 102 or any OpenGL extension that sources stencil images from the frame 103 buffer in the manner of glReadPixels and glCopyPixels. 104 105 These frame buffer values are taken from the surface associated with 106 the device context specified by <hReadDC>. 107 108 No error will be generated if the value of READ_BUFFER at the time the 109 wglMakeContextCurrentEXT call is made does not correspond to a valid color 110 buffer in <hReadDC>. Also, no error due to READ_BUFFER mismatch will be 111 generated by subsequent calls to any of the operations enumerated 112 above, but the pixels values used will be undefined until READ_BUFFER 113 is set to a color buffer that is valid in the <hReadDC>. Operations that 114 query the value of READ_BUFFER (i.e., glGet, glPushAttrib) use the 115 value set last in the context, independent of whether it is a valid 116 buffer in <hReadDC>. 117 118 Error conditions set by glReadBuffer (even when called implicitly via 119 glPopAttrib) and by the operations enumerated above are with respect 120 to color and ancillary buffers available in <hReadDC> (i.e., 121 glReadBuffer(GL_BACK_BUFFER) will generate an error when <hReadDC> is 122 single buffered, and so will an operation that tries to source stencil 123 images when <hReadDC> does not have a stencil buffer). 124 125 If wglMakeContextCurrentEXT succeeds, the return value is TRUE. If 126 the function fails, the return value is FALSE. To get extended error 127 information, call GetLastError. Possible errors are as follows: 128 129 ERROR_INVALID_PIXEL_FORMAT The pixel format associated with 130 <hDrawDC> does not match the pixel 131 format associated with the render 132 context. 133 ERROR_INVALID_PIXEL_TYPE_EXT The pixel type for <hReadDC> is 134 different than the pixel type 135 associated with the <hdc> that was 136 passed to wglCreateContext. 137 ERROR_DC_NOT_FOUND <hReadDC> or <hDrawDC> is not a valid 138 device context. 139 ERROR_NO_SYSTEM_RESOURCES The device contexts specified by 140 <hReadDC> and <hDrawDC> cannot exist 141 in the framebuffer simultaneously. 142 143 wglGetCurrentReadDC returns a handle to the "read" device context that 144 is associated with the current OpenGL rendering context of the calling 145 thread. If the calling thread does not have a current context, the 146 return value is NULL. 147 148 Because there is no way to extend wgl, these calls are defined in the 149 ICD and can be called by obtaining the address with wglGetProcAddress. 150 Because this is not a GL extension, it is not included in the 151 GL_EXTENSIONS string. 152 153New State 154 155 None 156 157New Implementation Dependent State 158 159 None 160