1 ##########################################################################
3 # Copyright 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 """Generated an header, glproc.hpp, which does pretty much what GLEW does, but
28 covers all the functions we support.
33 from dispatch import Dispatcher
34 from glapi import glapi
35 from glxapi import glxapi
36 from wglapi import wglapi
39 # See http://www.opengl.org/registry/ABI/
40 public_symbols = set([
43 "glAreTexturesResident",
96 "glCopyTexSubImage1D",
97 "glCopyTexSubImage2D",
106 "glDisableClientState",
115 "glEnableClientState",
158 "glGetPolygonStipple",
166 "glGetTexLevelParameterfv",
167 "glGetTexLevelParameteriv",
168 "glGetTexParameterfv",
169 "glGetTexParameteriv",
184 "glInterleavedArrays",
249 "glPrioritizeTextures",
251 "glPushClientAttrib",
378 "wglChoosePixelFormat",
381 "wglCreateLayerContext",
383 "wglDescribeLayerPlane",
384 "wglDescribePixelFormat",
385 "wglGetCurrentContext",
387 "wglGetDefaultProcAddress",
388 "wglGetLayerPaletteEntries",
392 "wglRealizeLayerPalette",
393 "wglSetLayerPaletteEntries",
397 "wglSwapLayerBuffers",
398 "wglSwapMultipleBuffers",
399 "wglUseFontBitmapsA",
400 "wglUseFontBitmapsW",
401 "wglUseFontOutlinesA",
402 "wglUseFontOutlinesW",
404 "glXGetProcAddressARB",
409 class GlDispatcher(Dispatcher):
412 print '#ifdef RETRACE'
413 print '# ifdef WIN32'
414 print '# define __getPrivateProcAddress(name) wglGetProcAddress(name)'
416 print '# define __getPrivateProcAddress(name) glXGetProcAddressARB((const GLubyte *)(name))'
418 print '# define __abort() OS::Abort()'
419 print '#else /* !RETRACE */'
420 print '# ifdef WIN32'
421 print '# define __getPrivateProcAddress(name) __wglGetProcAddress(name)'
422 print ' static inline PROC __stdcall __wglGetProcAddress(const char * lpszProc);'
424 print '# define __getPublicProcAddress(name) dlsym(RTLD_NEXT, name)'
425 print '# define __getPrivateProcAddress(name) __glXGetProcAddressARB((const GLubyte *)(name))'
426 print ' static inline __GLXextFuncPtr __glXGetProcAddressARB(const GLubyte * procName);'
428 print '# define __abort() Trace::Abort()'
429 print '#endif /* !RETRACE */'
432 def is_public_function(self, function):
433 return function.name in public_symbols
436 if __name__ == '__main__':
438 print '#ifndef _GLPROC_HPP_'
439 print '#define _GLPROC_HPP_'
441 print '#include "glimports.hpp"'
442 print '#include "os.hpp"'
445 dispatcher = GlDispatcher()
449 dispatcher.dispatch_api(wglapi)
450 print '#else /* !WIN32 */'
452 dispatcher.dispatch_api(glxapi)
453 print '#endif /* !WIN32 */'
455 dispatcher.dispatch_api(glapi)
457 print '#endif /* !_GLPROC_HPP_ */'