1 ##########################################################################
3 # Copyright 2008-2010 VMware, Inc.
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 ##########################################################################/
27 """WGL API description"""
35 wglapi.add_functions(glapi.functions)
38 HGLRC = Alias("HGLRC", HANDLE)
50 "PFD_NEED_SYSTEM_PALETTE",
53 "PFD_SWAP_LAYER_BUFFERS",
54 "PFD_GENERIC_ACCELERATED",
55 "PFD_SUPPORT_DIRECTDRAW",
57 "PFD_DOUBLEBUFFER_DONTCARE",
58 "PFD_STEREO_DONTCARE",
61 PIXELFORMATDESCRIPTOR = Struct("PIXELFORMATDESCRIPTOR", [
70 (BYTE, "cGreenShift"),
74 (BYTE, "cAlphaShift"),
76 (BYTE, "cAccumRedBits"),
77 (BYTE, "cAccumGreenBits"),
78 (BYTE, "cAccumBlueBits"),
79 (BYTE, "cAccumAlphaBits"),
81 (BYTE, "cStencilBits"),
82 (BYTE, "cAuxBuffers"),
85 (DWORD, "dwLayerMask"),
86 (DWORD, "dwVisibleMask"),
87 (DWORD, "dwDamageMask"),
90 POINTFLOAT = Struct("POINTFLOAT", [
95 GLYPHMETRICSFLOAT = Struct("GLYPHMETRICSFLOAT", [
96 (FLOAT, "gmfBlackBoxX"),
97 (FLOAT, "gmfBlackBoxY"),
98 (POINTFLOAT, "gmfptGlyphOrigin"),
99 (FLOAT, "gmfCellIncX"),
100 (FLOAT, "gmfCellIncY"),
102 LPGLYPHMETRICSFLOAT = Pointer(GLYPHMETRICSFLOAT)
104 COLORREF = Alias("COLORREF", DWORD)
107 LAYERPLANEDESCRIPTOR = Struct("LAYERPLANEDESCRIPTOR", [
111 (BYTE, "iPixelType"),
112 (BYTE, "cColorBits"),
115 (BYTE, "cGreenBits"),
116 (BYTE, "cGreenShift"),
118 (BYTE, "cBlueShift"),
119 (BYTE, "cAlphaBits"),
120 (BYTE, "cAlphaShift"),
121 (BYTE, "cAccumBits"),
122 (BYTE, "cAccumRedBits"),
123 (BYTE, "cAccumGreenBits"),
124 (BYTE, "cAccumBlueBits"),
125 (BYTE, "cAccumAlphaBits"),
126 (BYTE, "cDepthBits"),
127 (BYTE, "cStencilBits"),
128 (BYTE, "cAuxBuffers"),
129 (BYTE, "iLayerPlane"),
131 (COLORREF, "crTransparent"),
133 LPLAYERPLANEDESCRIPTOR = Pointer(LAYERPLANEDESCRIPTOR)
135 WGLSWAP = Struct("WGLSWAP", [
140 attribute = FakeEnum(Int, [
141 "WGL_NUMBER_PIXEL_FORMATS_EXT",
142 "WGL_DRAW_TO_WINDOW_EXT",
143 "WGL_DRAW_TO_BITMAP_EXT",
144 "WGL_ACCELERATION_EXT",
145 "WGL_NEED_PALETTE_EXT",
146 "WGL_NEED_SYSTEM_PALETTE_EXT",
147 "WGL_SWAP_LAYER_BUFFERS_EXT",
148 "WGL_SWAP_METHOD_EXT",
149 "WGL_NUMBER_OVERLAYS_EXT",
150 "WGL_NUMBER_UNDERLAYS_EXT",
151 "WGL_TRANSPARENT_EXT",
152 "WGL_TRANSPARENT_VALUE_EXT",
153 "WGL_SHARE_DEPTH_EXT",
154 "WGL_SHARE_STENCIL_EXT",
155 "WGL_SHARE_ACCUM_EXT",
156 "WGL_SUPPORT_GDI_EXT",
157 "WGL_SUPPORT_OPENGL_EXT",
158 "WGL_DOUBLE_BUFFER_EXT",
160 "WGL_PIXEL_TYPE_EXT",
161 "WGL_COLOR_BITS_EXT",
164 "WGL_GREEN_BITS_EXT",
165 "WGL_GREEN_SHIFT_EXT",
167 "WGL_BLUE_SHIFT_EXT",
168 "WGL_ALPHA_BITS_EXT",
169 "WGL_ALPHA_SHIFT_EXT",
170 "WGL_ACCUM_BITS_EXT",
171 "WGL_ACCUM_RED_BITS_EXT",
172 "WGL_ACCUM_GREEN_BITS_EXT",
173 "WGL_ACCUM_BLUE_BITS_EXT",
174 "WGL_ACCUM_ALPHA_BITS_EXT",
175 "WGL_DEPTH_BITS_EXT",
176 "WGL_STENCIL_BITS_EXT",
177 "WGL_AUX_BUFFERS_EXT",
178 "WGL_NO_ACCELERATION_EXT",
179 "WGL_GENERIC_ACCELERATION_EXT",
180 "WGL_FULL_ACCELERATION_EXT",
181 "WGL_SWAP_EXCHANGE_EXT",
183 "WGL_SWAP_UNDEFINED_EXT",
185 "WGL_TYPE_COLORINDEX_EXT",
188 HPBUFFERARB = Alias("HPBUFFERARB", HANDLE)
191 wglapi.add_functions([
193 StdFunction(HGLRC, "wglCreateContext", [(HDC, "hdc")]),
194 StdFunction(BOOL, "wglDeleteContext", [(HGLRC, "hglrc")]),
195 StdFunction(HGLRC, "wglGetCurrentContext", [], sideeffects=False),
196 StdFunction(BOOL, "wglMakeCurrent", [(HDC, "hdc"), (HGLRC, "hglrc")]),
197 StdFunction(BOOL, "wglCopyContext", [(HGLRC, "hglrcSrc"), (HGLRC, "hglrcDst"), (UINT, "mask")]),
198 StdFunction(Int, "wglChoosePixelFormat", [(HDC, "hdc"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]),
199 StdFunction(Int, "wglDescribePixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (UINT, "nBytes"), Out(Pointer(PIXELFORMATDESCRIPTOR), "ppfd")]),
200 StdFunction(HDC, "wglGetCurrentDC", [], sideeffects=False),
201 StdFunction(PROC, "wglGetDefaultProcAddress", [(LPCSTR, "lpszProc")], sideeffects=False),
202 StdFunction(Int, "wglGetPixelFormat", [(HDC, "hdc")], sideeffects=False),
203 StdFunction(BOOL, "wglSetPixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]),
204 StdFunction(BOOL, "wglSwapBuffers", [(HDC, "hdc")]),
205 StdFunction(BOOL, "wglShareLists", [(HGLRC, "hglrc1"), (HGLRC, "hglrc2")]),
206 StdFunction(HGLRC, "wglCreateLayerContext", [(HDC, "hdc"), (Int, "iLayerPlane")]),
207 StdFunction(BOOL, "wglDescribeLayerPlane", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nBytes"), Out(Pointer(LAYERPLANEDESCRIPTOR), "plpd")]),
208 StdFunction(Int, "wglSetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), (Array(Const(COLORREF), "cEntries"), "pcr")]),
209 StdFunction(Int, "wglGetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), Out(Array(COLORREF, "cEntries"), "pcr")], sideeffects=False),
210 StdFunction(BOOL, "wglRealizeLayerPalette", [(HDC, "hdc"), (Int, "iLayerPlane"), (BOOL, "bRealize")]),
211 StdFunction(BOOL, "wglSwapLayerBuffers", [(HDC, "hdc"), (UINT, "fuPlanes")]),
212 StdFunction(BOOL, "wglUseFontBitmapsA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
213 StdFunction(BOOL, "wglUseFontBitmapsW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
214 StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]),
215 StdFunction(BOOL, "wglUseFontOutlinesA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
216 StdFunction(BOOL, "wglUseFontOutlinesW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
218 # WGL_ARB_buffer_region
219 StdFunction(HANDLE, "wglCreateBufferRegionARB", [(HDC, "hDC"), (Int, "iLayerPlane"), (UINT, "uType")]),
220 StdFunction(VOID, "wglDeleteBufferRegionARB", [(HANDLE, "hRegion")]),
221 StdFunction(BOOL, "wglSaveBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height")]),
222 StdFunction(BOOL, "wglRestoreBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height"), (Int, "xSrc"), (Int, "ySrc")]),
224 # WGL_ARB_extensions_string
225 StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False),
227 # WGL_ARB_pixel_format
228 StdFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
229 StdFunction(BOOL, "wglGetPixelFormatAttribfvARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
230 StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Const(OpaquePointer(Int)), "piAttribIList"), (Const(OpaquePointer(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
232 # WGL_ARB_make_current_read
233 StdFunction(BOOL, "wglMakeContextCurrentARB", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
234 StdFunction(HDC, "wglGetCurrentReadDCARB", [], sideeffects=False),
237 StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Const(OpaquePointer(Int)), "piAttribList")]),
238 StdFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")], sideeffects=False),
239 StdFunction(Int, "wglReleasePbufferDCARB", [(HPBUFFERARB, "hPbuffer"), (HDC, "hDC")]),
240 StdFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]),
241 StdFunction(BOOL, "wglQueryPbufferARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iAttribute"), Out(Pointer(Int), "piValue")]),
243 # WGL_ARB_render_texture
244 StdFunction(BOOL, "wglBindTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
245 StdFunction(BOOL, "wglReleaseTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
246 StdFunction(BOOL, "wglSetPbufferAttribARB", [(HPBUFFERARB, "hPbuffer"), (Const(OpaquePointer(Int)), "piAttribList")]),
248 # WGL_ARB_create_context
249 StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Const(OpaquePointer(Int)), "attribList")]),
251 # WGL_EXT_extensions_string
252 StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False),
254 # WGL_EXT_make_current_read
255 StdFunction(BOOL, "wglMakeContextCurrentEXT", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
256 StdFunction(HDC, "wglGetCurrentReadDCEXT", [], sideeffects=False),
258 # WGL_EXT_pixel_format
259 StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
260 StdFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
261 StdFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
263 # WGL_EXT_swap_control
264 StdFunction(BOOL, "wglSwapIntervalEXT", [(Int, "interval")]),
265 StdFunction(Int, "wglGetSwapIntervalEXT", [], sideeffects=False),
267 # WGL_NV_vertex_array_range
268 StdFunction(OpaquePointer(Void), "wglAllocateMemoryNV", [(GLsizei, "size"), (GLfloat, "readfreq"), (GLfloat, "writefreq"), (GLfloat, "priority")]),
269 StdFunction(Void, "wglFreeMemoryNV", [(OpaquePointer(Void), "pointer")]),
272 StdFunction(Void, "glAddSwapHintRectWIN", [(GLint, "x"), (GLint, "y"), (GLsizei, "width"), (GLsizei, "height")]),
275 StdFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]),