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"""
37 HGLRC = Alias("HGLRC", HANDLE)
49 "PFD_NEED_SYSTEM_PALETTE",
52 "PFD_SWAP_LAYER_BUFFERS",
53 "PFD_GENERIC_ACCELERATED",
54 "PFD_SUPPORT_DIRECTDRAW",
56 "PFD_DOUBLEBUFFER_DONTCARE",
57 "PFD_STEREO_DONTCARE",
60 PIXELFORMATDESCRIPTOR = Struct("PIXELFORMATDESCRIPTOR", [
69 (BYTE, "cGreenShift"),
73 (BYTE, "cAlphaShift"),
75 (BYTE, "cAccumRedBits"),
76 (BYTE, "cAccumGreenBits"),
77 (BYTE, "cAccumBlueBits"),
78 (BYTE, "cAccumAlphaBits"),
80 (BYTE, "cStencilBits"),
81 (BYTE, "cAuxBuffers"),
84 (DWORD, "dwLayerMask"),
85 (DWORD, "dwVisibleMask"),
86 (DWORD, "dwDamageMask"),
89 POINTFLOAT = Struct("POINTFLOAT", [
94 GLYPHMETRICSFLOAT = Struct("GLYPHMETRICSFLOAT", [
95 (FLOAT, "gmfBlackBoxX"),
96 (FLOAT, "gmfBlackBoxY"),
97 (POINTFLOAT, "gmfptGlyphOrigin"),
98 (FLOAT, "gmfCellIncX"),
99 (FLOAT, "gmfCellIncY"),
101 LPGLYPHMETRICSFLOAT = Pointer(GLYPHMETRICSFLOAT)
103 COLORREF = Alias("COLORREF", DWORD)
106 LAYERPLANEDESCRIPTOR = Struct("LAYERPLANEDESCRIPTOR", [
110 (BYTE, "iPixelType"),
111 (BYTE, "cColorBits"),
114 (BYTE, "cGreenBits"),
115 (BYTE, "cGreenShift"),
117 (BYTE, "cBlueShift"),
118 (BYTE, "cAlphaBits"),
119 (BYTE, "cAlphaShift"),
120 (BYTE, "cAccumBits"),
121 (BYTE, "cAccumRedBits"),
122 (BYTE, "cAccumGreenBits"),
123 (BYTE, "cAccumBlueBits"),
124 (BYTE, "cAccumAlphaBits"),
125 (BYTE, "cDepthBits"),
126 (BYTE, "cStencilBits"),
127 (BYTE, "cAuxBuffers"),
128 (BYTE, "iLayerPlane"),
130 (COLORREF, "crTransparent"),
132 LPLAYERPLANEDESCRIPTOR = Pointer(LAYERPLANEDESCRIPTOR)
134 WGLSWAP = Struct("WGLSWAP", [
139 attribute = FakeEnum(Int, [
140 "WGL_NUMBER_PIXEL_FORMATS_EXT",
141 "WGL_DRAW_TO_WINDOW_EXT",
142 "WGL_DRAW_TO_BITMAP_EXT",
143 "WGL_ACCELERATION_EXT",
144 "WGL_NEED_PALETTE_EXT",
145 "WGL_NEED_SYSTEM_PALETTE_EXT",
146 "WGL_SWAP_LAYER_BUFFERS_EXT",
147 "WGL_SWAP_METHOD_EXT",
148 "WGL_NUMBER_OVERLAYS_EXT",
149 "WGL_NUMBER_UNDERLAYS_EXT",
150 "WGL_TRANSPARENT_EXT",
151 "WGL_TRANSPARENT_VALUE_EXT",
152 "WGL_SHARE_DEPTH_EXT",
153 "WGL_SHARE_STENCIL_EXT",
154 "WGL_SHARE_ACCUM_EXT",
155 "WGL_SUPPORT_GDI_EXT",
156 "WGL_SUPPORT_OPENGL_EXT",
157 "WGL_DOUBLE_BUFFER_EXT",
159 "WGL_PIXEL_TYPE_EXT",
160 "WGL_COLOR_BITS_EXT",
163 "WGL_GREEN_BITS_EXT",
164 "WGL_GREEN_SHIFT_EXT",
166 "WGL_BLUE_SHIFT_EXT",
167 "WGL_ALPHA_BITS_EXT",
168 "WGL_ALPHA_SHIFT_EXT",
169 "WGL_ACCUM_BITS_EXT",
170 "WGL_ACCUM_RED_BITS_EXT",
171 "WGL_ACCUM_GREEN_BITS_EXT",
172 "WGL_ACCUM_BLUE_BITS_EXT",
173 "WGL_ACCUM_ALPHA_BITS_EXT",
174 "WGL_DEPTH_BITS_EXT",
175 "WGL_STENCIL_BITS_EXT",
176 "WGL_AUX_BUFFERS_EXT",
177 "WGL_NO_ACCELERATION_EXT",
178 "WGL_GENERIC_ACCELERATION_EXT",
179 "WGL_FULL_ACCELERATION_EXT",
180 "WGL_SWAP_EXCHANGE_EXT",
182 "WGL_SWAP_UNDEFINED_EXT",
184 "WGL_TYPE_COLORINDEX_EXT",
187 HPBUFFERARB = Alias("HPBUFFERARB", HANDLE)
190 wglapi.add_functions([
192 StdFunction(HGLRC, "wglCreateContext", [(HDC, "hdc")]),
193 StdFunction(BOOL, "wglDeleteContext", [(HGLRC, "hglrc")]),
194 StdFunction(HGLRC, "wglGetCurrentContext", [], sideeffects=False),
195 StdFunction(BOOL, "wglMakeCurrent", [(HDC, "hdc"), (HGLRC, "hglrc")]),
196 StdFunction(BOOL, "wglCopyContext", [(HGLRC, "hglrcSrc"), (HGLRC, "hglrcDst"), (UINT, "mask")]),
197 StdFunction(Int, "wglChoosePixelFormat", [(HDC, "hdc"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]),
198 StdFunction(Int, "wglDescribePixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (UINT, "nBytes"), Out(Pointer(PIXELFORMATDESCRIPTOR), "ppfd")]),
199 StdFunction(HDC, "wglGetCurrentDC", [], sideeffects=False),
200 StdFunction(PROC, "wglGetDefaultProcAddress", [(LPCSTR, "lpszProc")], sideeffects=False),
201 StdFunction(Int, "wglGetPixelFormat", [(HDC, "hdc")], sideeffects=False),
202 StdFunction(BOOL, "wglSetPixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]),
203 StdFunction(BOOL, "wglSwapBuffers", [(HDC, "hdc")]),
204 StdFunction(BOOL, "wglShareLists", [(HGLRC, "hglrc1"), (HGLRC, "hglrc2")]),
205 StdFunction(HGLRC, "wglCreateLayerContext", [(HDC, "hdc"), (Int, "iLayerPlane")]),
206 StdFunction(BOOL, "wglDescribeLayerPlane", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nBytes"), Out(Pointer(LAYERPLANEDESCRIPTOR), "plpd")]),
207 StdFunction(Int, "wglSetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), (Array(Const(COLORREF), "cEntries"), "pcr")]),
208 StdFunction(Int, "wglGetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), Out(Array(COLORREF, "cEntries"), "pcr")], sideeffects=False),
209 StdFunction(BOOL, "wglRealizeLayerPalette", [(HDC, "hdc"), (Int, "iLayerPlane"), (BOOL, "bRealize")]),
210 StdFunction(BOOL, "wglSwapLayerBuffers", [(HDC, "hdc"), (UINT, "fuPlanes")]),
211 StdFunction(BOOL, "wglUseFontBitmapsA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
212 StdFunction(BOOL, "wglUseFontBitmapsW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]),
213 StdFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]),
214 StdFunction(BOOL, "wglUseFontOutlinesA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
215 StdFunction(BOOL, "wglUseFontOutlinesW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]),
217 # WGL_ARB_buffer_region
218 StdFunction(HANDLE, "wglCreateBufferRegionARB", [(HDC, "hDC"), (Int, "iLayerPlane"), (UINT, "uType")]),
219 StdFunction(VOID, "wglDeleteBufferRegionARB", [(HANDLE, "hRegion")]),
220 StdFunction(BOOL, "wglSaveBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height")]),
221 StdFunction(BOOL, "wglRestoreBufferRegionARB", [(HANDLE, "hRegion"), (Int, "x"), (Int, "y"), (Int, "width"), (Int, "height"), (Int, "xSrc"), (Int, "ySrc")]),
223 # WGL_ARB_extensions_string
224 StdFunction(Const(CString), "wglGetExtensionsStringARB", [(HDC, "hdc")], sideeffects=False),
226 # WGL_ARB_pixel_format
227 StdFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
228 StdFunction(BOOL, "wglGetPixelFormatAttribfvARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
229 StdFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Const(OpaquePointer(Int)), "piAttribIList"), (Const(OpaquePointer(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
231 # WGL_ARB_make_current_read
232 StdFunction(BOOL, "wglMakeContextCurrentARB", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
233 StdFunction(HDC, "wglGetCurrentReadDCARB", [], sideeffects=False),
236 StdFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Const(OpaquePointer(Int)), "piAttribList")]),
237 StdFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")], sideeffects=False),
238 StdFunction(Int, "wglReleasePbufferDCARB", [(HPBUFFERARB, "hPbuffer"), (HDC, "hDC")]),
239 StdFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]),
240 StdFunction(BOOL, "wglQueryPbufferARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iAttribute"), Out(Pointer(Int), "piValue")]),
242 # WGL_ARB_render_texture
243 StdFunction(BOOL, "wglBindTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
244 StdFunction(BOOL, "wglReleaseTexImageARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iBuffer")]),
245 StdFunction(BOOL, "wglSetPbufferAttribARB", [(HPBUFFERARB, "hPbuffer"), (Const(OpaquePointer(Int)), "piAttribList")]),
247 # WGL_ARB_create_context
248 StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (Const(OpaquePointer(Int)), "attribList")]),
250 # WGL_EXT_extensions_string
251 StdFunction(Const(CString), "wglGetExtensionsStringEXT", [], sideeffects=False),
253 # WGL_EXT_make_current_read
254 StdFunction(BOOL, "wglMakeContextCurrentEXT", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
255 StdFunction(HDC, "wglGetCurrentReadDCEXT", [], sideeffects=False),
257 # WGL_EXT_pixel_format
258 StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
259 StdFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
260 StdFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]),
262 # WGL_EXT_swap_control
263 StdFunction(BOOL, "wglSwapIntervalEXT", [(Int, "interval")]),
264 StdFunction(Int, "wglGetSwapIntervalEXT", [], sideeffects=False),
266 # WGL_NV_vertex_array_range
267 StdFunction(OpaquePointer(Void), "wglAllocateMemoryNV", [(GLsizei, "size"), (GLfloat, "readfreq"), (GLfloat, "writefreq"), (GLfloat, "priority")]),
268 StdFunction(Void, "wglFreeMemoryNV", [(OpaquePointer(Void), "pointer")]),
271 StdFunction(Void, "glAddSwapHintRectWIN", [(GLint, "x"), (GLint, "y"), (GLsizei, "width"), (GLsizei, "height")]),
274 StdFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]),