José Fonseca | 7ad4026 | 2009-09-30 17:17:12 +0100 | [diff] [blame] | 1 | ########################################################################## |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 2 | # |
José Fonseca | 7ad4026 | 2009-09-30 17:17:12 +0100 | [diff] [blame] | 3 | # Copyright 2008-2009 VMware, Inc. |
| 4 | # All Rights Reserved. |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 5 | # |
José Fonseca | 7ad4026 | 2009-09-30 17:17:12 +0100 | [diff] [blame] | 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: |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 12 | # |
José Fonseca | 7ad4026 | 2009-09-30 17:17:12 +0100 | [diff] [blame] | 13 | # The above copyright notice and this permission notice shall be included in |
| 14 | # all copies or substantial portions of the Software. |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 15 | # |
José Fonseca | 7ad4026 | 2009-09-30 17:17:12 +0100 | [diff] [blame] | 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 |
| 22 | # THE SOFTWARE. |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 23 | # |
José Fonseca | 7ad4026 | 2009-09-30 17:17:12 +0100 | [diff] [blame] | 24 | ##########################################################################/ |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 25 | |
| 26 | from gl import * |
| 27 | from windows import * |
| 28 | |
| 29 | opengl32 = Dll("opengl32") |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 30 | opengl32.functions += basic_functions(DllFunction) |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 31 | |
| 32 | HGLRC = Alias("HGLRC", HANDLE) |
José Fonseca | f6592d7 | 2010-11-21 12:44:41 +0000 | [diff] [blame] | 33 | PROC = Opaque("PROC") |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 34 | |
José Fonseca | 0fae970 | 2009-04-30 12:42:36 +0100 | [diff] [blame] | 35 | PFD = Flags(DWORD, [ |
| 36 | "PFD_DOUBLEBUFFER", |
| 37 | "PFD_STEREO", |
| 38 | "PFD_DRAW_TO_WINDOW", |
| 39 | "PFD_DRAW_TO_BITMAP", |
| 40 | "PFD_SUPPORT_GDI", |
| 41 | "PFD_SUPPORT_OPENGL", |
| 42 | "PFD_GENERIC_FORMAT", |
| 43 | "PFD_NEED_PALETTE", |
| 44 | "PFD_NEED_SYSTEM_PALETTE", |
| 45 | "PFD_SWAP_EXCHANGE", |
| 46 | "PFD_SWAP_COPY", |
| 47 | "PFD_SWAP_LAYER_BUFFERS", |
| 48 | "PFD_GENERIC_ACCELERATED", |
José Fonseca | cd57a40 | 2010-04-06 15:09:26 +0100 | [diff] [blame] | 49 | "PFD_SUPPORT_DIRECTDRAW", |
| 50 | "PFD_DEPTH_DONTCARE", |
| 51 | "PFD_DOUBLEBUFFER_DONTCARE", |
| 52 | "PFD_STEREO_DONTCARE", |
José Fonseca | 0fae970 | 2009-04-30 12:42:36 +0100 | [diff] [blame] | 53 | ]) |
| 54 | |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 55 | PIXELFORMATDESCRIPTOR = Struct("PIXELFORMATDESCRIPTOR", [ |
| 56 | (WORD, "nSize"), |
| 57 | (WORD, "nVersion"), |
José Fonseca | 0fae970 | 2009-04-30 12:42:36 +0100 | [diff] [blame] | 58 | (PFD, "dwFlags"), |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 59 | (BYTE, "iPixelType"), |
| 60 | (BYTE, "cColorBits"), |
| 61 | (BYTE, "cRedBits"), |
| 62 | (BYTE, "cRedShift"), |
| 63 | (BYTE, "cGreenBits"), |
| 64 | (BYTE, "cGreenShift"), |
| 65 | (BYTE, "cBlueBits"), |
| 66 | (BYTE, "cBlueShift"), |
| 67 | (BYTE, "cAlphaBits"), |
| 68 | (BYTE, "cAlphaShift"), |
| 69 | (BYTE, "cAccumBits"), |
| 70 | (BYTE, "cAccumRedBits"), |
| 71 | (BYTE, "cAccumGreenBits"), |
| 72 | (BYTE, "cAccumBlueBits"), |
| 73 | (BYTE, "cAccumAlphaBits"), |
| 74 | (BYTE, "cDepthBits"), |
| 75 | (BYTE, "cStencilBits"), |
| 76 | (BYTE, "cAuxBuffers"), |
| 77 | (BYTE, "iLayerType"), |
| 78 | (BYTE, "bReserved"), |
| 79 | (DWORD, "dwLayerMask"), |
| 80 | (DWORD, "dwVisibleMask"), |
| 81 | (DWORD, "dwDamageMask"), |
| 82 | ]) |
| 83 | |
| 84 | POINTFLOAT = Struct("POINTFLOAT", [ |
| 85 | (FLOAT, "x"), |
| 86 | (FLOAT, "y"), |
| 87 | ]) |
| 88 | |
| 89 | GLYPHMETRICSFLOAT = Struct("GLYPHMETRICSFLOAT", [ |
| 90 | (FLOAT, "gmfBlackBoxX"), |
| 91 | (FLOAT, "gmfBlackBoxY"), |
| 92 | (POINTFLOAT, "gmfptGlyphOrigin"), |
| 93 | (FLOAT, "gmfCellIncX"), |
| 94 | (FLOAT, "gmfCellIncY"), |
| 95 | ]) |
| 96 | LPGLYPHMETRICSFLOAT = Pointer(GLYPHMETRICSFLOAT) |
| 97 | |
| 98 | COLORREF = Alias("COLORREF", DWORD) |
José Fonseca | 0fae970 | 2009-04-30 12:42:36 +0100 | [diff] [blame] | 99 | |
| 100 | |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 101 | LAYERPLANEDESCRIPTOR = Struct("LAYERPLANEDESCRIPTOR", [ |
| 102 | (WORD, "nSize"), |
| 103 | (WORD, "nVersion"), |
| 104 | (DWORD, "dwFlags"), |
| 105 | (BYTE, "iPixelType"), |
| 106 | (BYTE, "cColorBits"), |
| 107 | (BYTE, "cRedBits"), |
| 108 | (BYTE, "cRedShift"), |
| 109 | (BYTE, "cGreenBits"), |
| 110 | (BYTE, "cGreenShift"), |
| 111 | (BYTE, "cBlueBits"), |
| 112 | (BYTE, "cBlueShift"), |
| 113 | (BYTE, "cAlphaBits"), |
| 114 | (BYTE, "cAlphaShift"), |
| 115 | (BYTE, "cAccumBits"), |
| 116 | (BYTE, "cAccumRedBits"), |
| 117 | (BYTE, "cAccumGreenBits"), |
| 118 | (BYTE, "cAccumBlueBits"), |
| 119 | (BYTE, "cAccumAlphaBits"), |
| 120 | (BYTE, "cDepthBits"), |
| 121 | (BYTE, "cStencilBits"), |
| 122 | (BYTE, "cAuxBuffers"), |
| 123 | (BYTE, "iLayerPlane"), |
| 124 | (BYTE, "bReserved"), |
| 125 | (COLORREF, "crTransparent"), |
| 126 | ]) |
| 127 | LPLAYERPLANEDESCRIPTOR = Pointer(LAYERPLANEDESCRIPTOR) |
| 128 | |
José Fonseca | 2d03463 | 2010-02-13 11:51:49 +0000 | [diff] [blame] | 129 | WGLSWAP = Struct("WGLSWAP", [ |
| 130 | (HDC, "hdc"), |
| 131 | (UINT, "uiFlags"), |
| 132 | ]) |
| 133 | |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 134 | opengl32.functions += [ |
José Fonseca | 3c2c929 | 2009-05-04 12:16:30 +0100 | [diff] [blame] | 135 | DllFunction(BOOL, "wglCopyContext", [(HGLRC, "hglrcSrc"), (HGLRC, "hglrcDst"), (UINT, "mask")]), |
| 136 | DllFunction(HGLRC, "wglCreateContext", [(HDC, "hdc")]), |
| 137 | DllFunction(HGLRC, "wglCreateLayerContext", [(HDC, "hdc"), (Int, "iLayerPlane")]), |
| 138 | DllFunction(BOOL, "wglDeleteContext", [(HGLRC, "hglrc")]), |
| 139 | DllFunction(HGLRC, "wglGetCurrentContext", []), |
| 140 | DllFunction(HDC, "wglGetCurrentDC", []), |
José Fonseca | 3c2c929 | 2009-05-04 12:16:30 +0100 | [diff] [blame] | 141 | DllFunction(PROC, "wglGetDefaultProcAddress", [(LPCSTR, "lpszProc")]), |
| 142 | DllFunction(Int, "wglChoosePixelFormat", [(HDC, "hdc"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]), |
José Fonseca | c9096f0 | 2010-11-22 13:02:26 +0000 | [diff] [blame] | 143 | DllFunction(Int, "wglDescribePixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (UINT, "nBytes"), Out(Pointer(PIXELFORMATDESCRIPTOR), "ppfd")]), |
José Fonseca | 3c2c929 | 2009-05-04 12:16:30 +0100 | [diff] [blame] | 144 | DllFunction(Int, "wglGetPixelFormat", [(HDC, "hdc")]), |
| 145 | DllFunction(BOOL, "wglSetPixelFormat", [(HDC, "hdc"), (Int, "iPixelFormat"), (Pointer(Const(PIXELFORMATDESCRIPTOR)), "ppfd")]), |
| 146 | DllFunction(BOOL, "wglMakeCurrent", [(HDC, "hdc"), (HGLRC, "hglrc")]), |
| 147 | DllFunction(BOOL, "wglShareLists", [(HGLRC, "hglrc1"), (HGLRC, "hglrc2")]), |
| 148 | DllFunction(BOOL, "wglUseFontBitmapsA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]), |
| 149 | DllFunction(BOOL, "wglUseFontBitmapsW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase")]), |
| 150 | DllFunction(BOOL, "wglSwapBuffers", [(HDC, "hdc")]), |
| 151 | DllFunction(BOOL, "wglUseFontOutlinesA", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]), |
| 152 | DllFunction(BOOL, "wglUseFontOutlinesW", [(HDC, "hdc"), (DWORD, "first"), (DWORD, "count"), (DWORD, "listBase"), (FLOAT, "deviation"), (FLOAT, "extrusion"), (Int, "format"), (LPGLYPHMETRICSFLOAT, "lpgmf")]), |
José Fonseca | c9096f0 | 2010-11-22 13:02:26 +0000 | [diff] [blame] | 153 | DllFunction(BOOL , "wglDescribeLayerPlane", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nBytes"), Out(Pointer(LAYERPLANEDESCRIPTOR), "plpd")]), |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 154 | DllFunction(Int , "wglSetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), (Array(Const(COLORREF), "cEntries"), "pcr")]), |
| 155 | DllFunction(Int , "wglGetLayerPaletteEntries", [(HDC, "hdc"), (Int, "iLayerPlane"), (Int, "iStart"), (Int, "cEntries"), Out(Array(COLORREF, "cEntries"), "pcr")]), |
José Fonseca | 3c2c929 | 2009-05-04 12:16:30 +0100 | [diff] [blame] | 156 | DllFunction(BOOL , "wglRealizeLayerPalette", [(HDC, "hdc"), (Int, "iLayerPlane"), (BOOL, "bRealize")]), |
| 157 | DllFunction(BOOL , "wglSwapLayerBuffers", [(HDC, "hdc"), (UINT, "fuPlanes")]), |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 158 | DllFunction(DWORD, "wglSwapMultipleBuffers", [(UINT, "n"), (Array(Const(WGLSWAP), "n"), "ps")]), |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 159 | ] |
| 160 | |
José Fonseca | c77023d | 2009-05-04 12:53:50 +0100 | [diff] [blame] | 161 | |
| 162 | class WglGetProcAddressFunction(DllFunction): |
| 163 | |
| 164 | def __init__(self, type, name, args): |
| 165 | DllFunction.__init__(self, type, name, args) |
| 166 | self.functions = [] |
| 167 | |
| 168 | def wrap_decl(self): |
| 169 | for function in self.functions: |
| 170 | function.wrap_decl() |
| 171 | DllFunction.wrap_decl(self) |
| 172 | |
| 173 | def wrap_impl(self): |
| 174 | for function in self.functions: |
| 175 | function.wrap_impl() |
| 176 | DllFunction.wrap_impl(self) |
| 177 | |
| 178 | def post_call_impl(self): |
José Fonseca | 355a8fa | 2009-05-04 22:34:38 +0100 | [diff] [blame] | 179 | print ' if(result) {' |
José Fonseca | c77023d | 2009-05-04 12:53:50 +0100 | [diff] [blame] | 180 | for function in self.functions: |
| 181 | ptype = function.pointer_type() |
| 182 | pvalue = function.pointer_value() |
José Fonseca | 355a8fa | 2009-05-04 22:34:38 +0100 | [diff] [blame] | 183 | print ' if(!strcmp("%s", lpszProc)) {' % function.name |
| 184 | print ' %s = (%s)result;' % (pvalue, ptype) |
| 185 | print ' result = (PROC)&%s;' % function.name; |
| 186 | print ' }' |
| 187 | print ' }' |
José Fonseca | c77023d | 2009-05-04 12:53:50 +0100 | [diff] [blame] | 188 | |
| 189 | |
| 190 | wglgetprocaddress = WglGetProcAddressFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]) |
| 191 | opengl32.functions.append(wglgetprocaddress) |
| 192 | |
| 193 | class WglFunction(Function): |
| 194 | |
| 195 | def get_true_pointer(self): |
| 196 | ptype = self.pointer_type() |
| 197 | pvalue = self.pointer_value() |
| 198 | print ' if(!%s)' % (pvalue,) |
| 199 | self.fail_impl() |
| 200 | |
José Fonseca | 7c1d233 | 2009-05-04 22:34:59 +0100 | [diff] [blame] | 201 | attribute = FakeEnum(Int, [ |
| 202 | "WGL_NUMBER_PIXEL_FORMATS_EXT", |
| 203 | "WGL_DRAW_TO_WINDOW_EXT", |
| 204 | "WGL_DRAW_TO_BITMAP_EXT", |
| 205 | "WGL_ACCELERATION_EXT", |
| 206 | "WGL_NEED_PALETTE_EXT", |
| 207 | "WGL_NEED_SYSTEM_PALETTE_EXT", |
| 208 | "WGL_SWAP_LAYER_BUFFERS_EXT", |
| 209 | "WGL_SWAP_METHOD_EXT", |
| 210 | "WGL_NUMBER_OVERLAYS_EXT", |
| 211 | "WGL_NUMBER_UNDERLAYS_EXT", |
| 212 | "WGL_TRANSPARENT_EXT", |
| 213 | "WGL_TRANSPARENT_VALUE_EXT", |
| 214 | "WGL_SHARE_DEPTH_EXT", |
| 215 | "WGL_SHARE_STENCIL_EXT", |
| 216 | "WGL_SHARE_ACCUM_EXT", |
| 217 | "WGL_SUPPORT_GDI_EXT", |
| 218 | "WGL_SUPPORT_OPENGL_EXT", |
| 219 | "WGL_DOUBLE_BUFFER_EXT", |
| 220 | "WGL_STEREO_EXT", |
| 221 | "WGL_PIXEL_TYPE_EXT", |
| 222 | "WGL_COLOR_BITS_EXT", |
| 223 | "WGL_RED_BITS_EXT", |
| 224 | "WGL_RED_SHIFT_EXT", |
| 225 | "WGL_GREEN_BITS_EXT", |
| 226 | "WGL_GREEN_SHIFT_EXT", |
| 227 | "WGL_BLUE_BITS_EXT", |
| 228 | "WGL_BLUE_SHIFT_EXT", |
| 229 | "WGL_ALPHA_BITS_EXT", |
| 230 | "WGL_ALPHA_SHIFT_EXT", |
| 231 | "WGL_ACCUM_BITS_EXT", |
| 232 | "WGL_ACCUM_RED_BITS_EXT", |
| 233 | "WGL_ACCUM_GREEN_BITS_EXT", |
| 234 | "WGL_ACCUM_BLUE_BITS_EXT", |
| 235 | "WGL_ACCUM_ALPHA_BITS_EXT", |
| 236 | "WGL_DEPTH_BITS_EXT", |
| 237 | "WGL_STENCIL_BITS_EXT", |
| 238 | "WGL_AUX_BUFFERS_EXT", |
| 239 | "WGL_NO_ACCELERATION_EXT", |
| 240 | "WGL_GENERIC_ACCELERATION_EXT", |
| 241 | "WGL_FULL_ACCELERATION_EXT", |
| 242 | "WGL_SWAP_EXCHANGE_EXT", |
| 243 | "WGL_SWAP_COPY_EXT", |
| 244 | "WGL_SWAP_UNDEFINED_EXT", |
| 245 | "WGL_TYPE_RGBA_EXT", |
| 246 | "WGL_TYPE_COLORINDEX_EXT", |
| 247 | ]) |
| 248 | |
José Fonseca | 3eb4c94 | 2009-11-30 16:03:34 +0000 | [diff] [blame] | 249 | HPBUFFERARB = Alias("HPBUFFERARB", HANDLE) |
| 250 | |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 251 | wglgetprocaddress.functions += extended_functions(WglFunction) |
| 252 | |
José Fonseca | c77023d | 2009-05-04 12:53:50 +0100 | [diff] [blame] | 253 | wglgetprocaddress.functions += [ |
José Fonseca | 7c1d233 | 2009-05-04 22:34:59 +0100 | [diff] [blame] | 254 | # WGL_ARB_extensions_string |
José Fonseca | c77023d | 2009-05-04 12:53:50 +0100 | [diff] [blame] | 255 | WglFunction(Const(String), "wglGetExtensionsStringARB", [(HDC, "hdc")]), |
José Fonseca | 3eb4c94 | 2009-11-30 16:03:34 +0000 | [diff] [blame] | 256 | # WGL_ARB_pbuffer |
| 257 | WglFunction(HPBUFFERARB, "wglCreatePbufferARB", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (Pointer(Const(Int)), "piAttribList")]), |
| 258 | WglFunction(HDC, "wglGetPbufferDCARB", [(HPBUFFERARB, "hPbuffer")]), |
| 259 | WglFunction(Int, "wglReleasePbufferDCARB", [(HPBUFFERARB, "hPbuffer"), (HDC, "hDC")]), |
| 260 | WglFunction(BOOL, "wglDestroyPbufferARB", [(HPBUFFERARB, "hPbuffer")]), |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 261 | WglFunction(BOOL, "wglQueryPbufferARB", [(HPBUFFERARB, "hPbuffer"), (Int, "iAttribute"), Out(Pointer(Int), "piValue")]), |
José Fonseca | 1eac39b | 2009-06-30 19:47:38 +0100 | [diff] [blame] | 262 | # WGL_ARB_pixel_format |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 263 | WglFunction(BOOL, "wglGetPixelFormatAttribivARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")]), |
| 264 | WglFunction(BOOL, "wglGetPixelFormatAttribfvARB", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")]), |
| 265 | WglFunction(BOOL, "wglChoosePixelFormatARB", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), |
José Fonseca | 7c1d233 | 2009-05-04 22:34:59 +0100 | [diff] [blame] | 266 | # WGL_EXT_extensions_string |
| 267 | WglFunction(Const(String), "wglGetExtensionsStringEXT", []), |
| 268 | # WGL_EXT_pixel_format |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 269 | WglFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")]), |
| 270 | WglFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(attribute, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")]), |
| 271 | WglFunction(BOOL, "wglChoosePixelFormatEXT", [(HDC, "hdc"), (Pointer(Const(Int)), "piAttribIList"), (Pointer(Const(FLOAT)), "pfAttribFList"), (UINT, "nMaxFormats"), Out(Array(Int, "nMaxFormats"), "piFormats"), Out(Pointer(UINT), "nNumFormats")]), |
José Fonseca | c77023d | 2009-05-04 12:53:50 +0100 | [diff] [blame] | 272 | ] |
| 273 | |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 274 | if __name__ == '__main__': |
| 275 | print |
| 276 | print '#define _GDI32_' |
| 277 | print |
| 278 | print '#include <windows.h>' |
| 279 | print '#include <tchar.h>' |
| 280 | print '#include <GL/gl.h>' |
José Fonseca | ed9c016 | 2009-05-04 10:51:42 +0100 | [diff] [blame] | 281 | print '#include "glext.h"' |
| 282 | print '#include "wglext.h"' |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 283 | print |
José Fonseca | 2defc98 | 2010-11-22 16:59:10 +0000 | [diff] [blame^] | 284 | print '#include "glhelpers.hpp"' |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 285 | print '#include "log.hpp"' |
| 286 | print |
José Fonseca | cd57a40 | 2010-04-06 15:09:26 +0100 | [diff] [blame] | 287 | print '#ifndef PFD_SUPPORT_DIRECTDRAW' |
| 288 | print '#define PFD_SUPPORT_DIRECTDRAW 0x00002000' |
| 289 | print '#endif' |
| 290 | print '#ifndef PFD_SUPPORT_COMPOSITION' |
| 291 | print '#define PFD_SUPPORT_COMPOSITION 0x00008000' |
| 292 | print '#endif' |
| 293 | print |
José Fonseca | 2d03463 | 2010-02-13 11:51:49 +0000 | [diff] [blame] | 294 | print '#ifdef __MINGW32__' |
| 295 | print '' |
| 296 | print 'typedef struct _WGLSWAP' |
| 297 | print '{' |
| 298 | print ' HDC hdc;' |
| 299 | print ' UINT uiFlags;' |
| 300 | print '} WGLSWAP, *PWGLSWAP, FAR *LPWGLSWAP;' |
| 301 | print '' |
| 302 | print '#define WGL_SWAPMULTIPLE_MAX 16' |
| 303 | print '' |
| 304 | print '#endif' |
| 305 | print |
José Fonseca | 2272ecd | 2009-05-04 10:24:12 +0100 | [diff] [blame] | 306 | print 'extern "C" {' |
| 307 | print |
José Fonseca | 36e25aa | 2009-04-13 14:08:08 +0100 | [diff] [blame] | 308 | wrap() |
José Fonseca | 2272ecd | 2009-05-04 10:24:12 +0100 | [diff] [blame] | 309 | print |
| 310 | print '}' |