José Fonseca | 99771fc | 2010-11-25 20:32:59 +0000 | [diff] [blame] | 1 | ########################################################################## |
| 2 | # |
| 3 | # Copyright 2008-2009 VMware, Inc. |
| 4 | # All Rights Reserved. |
| 5 | # |
| 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: |
| 12 | # |
| 13 | # The above copyright notice and this permission notice shall be included in |
| 14 | # all copies or substantial portions of the Software. |
| 15 | # |
| 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. |
| 23 | # |
| 24 | ##########################################################################/ |
| 25 | |
José Fonseca | 4a826ed | 2010-11-30 16:58:22 +0000 | [diff] [blame] | 26 | """GLX API description.""" |
| 27 | |
José Fonseca | 99771fc | 2010-11-25 20:32:59 +0000 | [diff] [blame] | 28 | |
| 29 | from stdapi import * |
| 30 | from glapi import glapi |
| 31 | |
José Fonseca | e90885a | 2010-11-26 15:01:18 +0000 | [diff] [blame] | 32 | VisualID = Alias("VisualID", UInt32) |
José Fonseca | e90885a | 2010-11-26 15:01:18 +0000 | [diff] [blame] | 33 | Display = Opaque("Display *") |
| 34 | Visual = Opaque("Visual *") |
Zack Rusin | f3f2e46 | 2011-03-23 18:35:39 -0400 | [diff] [blame^] | 35 | Font = Alias("Font", UInt32) |
| 36 | Pixmap = Alias("Pixmap", UInt32) |
| 37 | Window = Alias("Window", UInt32) |
| 38 | |
| 39 | GLXContext = Opaque("GLXContext") |
| 40 | GLXPixmap = Alias("GLXPixmap", UInt32) |
| 41 | GLXDrawable = Alias("GLXDrawable", UInt32) |
| 42 | GLXFBConfig = Opaque("GLXFBConfig") |
| 43 | GLXFBConfigID = Alias("GLXFBConfigID", UInt32) |
| 44 | GLXContextID = Alias("GLXContextID", UInt32) |
| 45 | GLXWindow = Alias("GLXWindow", UInt32) |
| 46 | GLXPbuffer = Alias("GLXPbuffer", UInt32) |
José Fonseca | e90885a | 2010-11-26 15:01:18 +0000 | [diff] [blame] | 47 | |
| 48 | XVisualInfo = Struct("XVisualInfo", [ |
| 49 | (Visual, "visual"), |
| 50 | (VisualID, "visualid"), |
| 51 | (Int, "screen"), |
| 52 | (Int, "depth"), |
| 53 | (Int, "c_class"), |
| 54 | (ULong, "red_mask"), |
| 55 | (ULong, "green_mask"), |
| 56 | (ULong, "blue_mask"), |
| 57 | (Int, "colormap_size"), |
| 58 | (Int, "bits_per_rgb"), |
| 59 | ]) |
| 60 | |
| 61 | Bool_ = Alias("Bool", Int) |
José Fonseca | 99771fc | 2010-11-25 20:32:59 +0000 | [diff] [blame] | 62 | |
| 63 | glxapi = API("GLX") |
| 64 | |
| 65 | PROC = Opaque("__GLXextFuncPtr") |
| 66 | |
| 67 | glxapi.add_functions(glapi.functions) |
| 68 | glxapi.add_functions([ |
Zack Rusin | f3f2e46 | 2011-03-23 18:35:39 -0400 | [diff] [blame^] | 69 | # GLX |
| 70 | Function(Pointer(XVisualInfo), "glXChooseVisual", [(Display, "dpy"), (Int, "screen"), (Pointer(Int), "attribList")]), |
José Fonseca | e90885a | 2010-11-26 15:01:18 +0000 | [diff] [blame] | 71 | Function(GLXContext, "glXCreateContext", [(Display, "dpy"), (Pointer(XVisualInfo), "vis"), (GLXContext, "shareList"), (Bool_, "direct")]), |
Zack Rusin | f3f2e46 | 2011-03-23 18:35:39 -0400 | [diff] [blame^] | 72 | Function(Void, "glXDestroyContext", [(Display, "dpy"), (GLXContext, "ctx")]), |
| 73 | Function(Bool_, "glXMakeCurrent", [(Display, "dpy"), (GLXDrawable, "drawable"), (GLXContext, "ctx")]), |
| 74 | Function(Void, "glXCopyContext", [(Display, "dpy"), (GLXContext, "src"), (GLXContext, "dst"), |
| 75 | (ULong, "mask")]), |
| 76 | Function(Void, "glXSwapBuffers", [(Display, "dpy"), (GLXDrawable, "drawable")]), |
| 77 | Function(GLXPixmap, "glXCreateGLXPixmap", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"), |
| 78 | (Pixmap, "pixmap")]), |
| 79 | Function(Void, "glXDestroyGLXPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]), |
| 80 | Function(Bool_, "glXQueryExtension", [(Display, "dpy"), (Pointer(Int), "errorb"), (Pointer(Int), "event")]), |
| 81 | Function(Bool_, "glXQueryVersion", [(Display, "dpy"), (Pointer(Int), "maj"), (Pointer(Int), "min")]), |
| 82 | Function(Bool_, "glXIsDirect", [(Display, "dpy"), (GLXContext, "ctx")]), |
| 83 | Function(Int, "glXGetConfig", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"), |
| 84 | (Int, "attrib"), (Pointer(Int), "value")]), |
| 85 | Function(GLXContext, "glXGetCurrentContext", [], sideeffects=False), |
| 86 | Function(GLXDrawable, "glXGetCurrentDrawable", [], sideeffects=False), |
| 87 | Function(Void, "glXWaitGL", []), |
| 88 | Function(Void, "glXWaitX", []), |
| 89 | Function(Void, "glXUseXFont", [(Font, "font"), (Int, "first"), (Int, "count"), (Int, "list")]), |
| 90 | |
| 91 | # GLX 1.1 and later |
| 92 | Function((Const(String("char *"))), "glXQueryExtensionsString", [(Display, "dpy"), (Int, "screen")]), |
| 93 | Function((Const(String("char *"))), "glXQueryServerString", [(Display, "dpy"), (Int, "screen"), (Int, "name")]), |
| 94 | Function((Const(String("char *"))), "glXGetClientString", [(Display, "dpy"), (Int, "name")]), |
| 95 | |
| 96 | # GLX 1.2 and later |
| 97 | Function(Display, "glXGetCurrentDisplay", [], sideeffects=False), |
| 98 | |
| 99 | # GLX 1.3 and later |
| 100 | Function(Pointer(GLXFBConfig), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), |
| 101 | (Pointer(Const(Int)), "attribList"), (Pointer(Int), "nitems")]), |
| 102 | Function(Int, "glXGetFBConfigAttrib", [(Display, "dpy"), (GLXFBConfig, "config"), |
| 103 | (Int, "attribute"), (Pointer(Int), "value")]), |
| 104 | Function(Pointer(GLXFBConfig), "glXGetFBConfigs", [(Display, "dpy"), (Int, "screen"), |
| 105 | (Pointer(Int), "nelements")]), |
| 106 | Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfig", [(Display, "dpy"), |
| 107 | (GLXFBConfig, "config")]), |
| 108 | Function(GLXWindow, "glXCreateWindow", [(Display, "dpy"), (GLXFBConfig, "config"), |
| 109 | (Window, "win"), (Pointer(Const(Int)), "attribList")]), |
| 110 | Function(Void, "glXDestroyWindow", [(Display, "dpy"), (GLXWindow, "window")]), |
| 111 | Function(GLXPixmap, "glXCreatePixmap", [(Display, "dpy"), (GLXFBConfig, "config"), |
| 112 | (Pixmap, "pixmap"), (Pointer(Const(Int)), "attribList")]), |
| 113 | Function(Void, "glXDestroyPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]), |
| 114 | Function(GLXPbuffer, "glXCreatePbuffer", [(Display, "dpy"), (GLXFBConfig, "config"), |
| 115 | (Pointer(Const(Int)), "attribList")]), |
| 116 | Function(Void, "glXDestroyPbuffer", [(Display, "dpy"), (GLXPbuffer, "pbuf")]), |
| 117 | Function(Void, "glXQueryDrawable", [(Display, "dpy"), (GLXDrawable, "draw"), (Int, "attribute"), |
| 118 | (Pointer(UInt), "value")]), |
| 119 | Function(GLXContext, "glXCreateNewContext", [(Display, "dpy"), (GLXFBConfig, "config"), |
| 120 | (Int, "renderType"), (GLXContext, "shareList"), |
| 121 | (Bool_, "direct")]), |
| 122 | Function(Bool_, "glXMakeContextCurrent", [(Display, "dpy"), (GLXDrawable, "draw"), |
| 123 | (GLXDrawable, "read"), (GLXContext, "ctx")]), |
| 124 | Function(GLXDrawable, "glXGetCurrentReadDrawable", []), |
| 125 | Function(Int, "glXQueryContext", [(Display, "dpy"), (GLXContext, "ctx"), (Int, "attribute"), |
| 126 | (Pointer(Int), "value")]), |
| 127 | Function(Void, "glXSelectEvent", [(Display, "dpy"), (GLXDrawable, "drawable"), |
| 128 | (ULong, "mask")]), |
| 129 | Function(Void, "glXGetSelectedEvent", [(Display, "dpy"), (GLXDrawable, "drawable"), |
| 130 | (Pointer(ULong), "mask")]), |
| 131 | # TODO: extensions |
José Fonseca | e90885a | 2010-11-26 15:01:18 +0000 | [diff] [blame] | 132 | |
José Fonseca | 4a826ed | 2010-11-30 16:58:22 +0000 | [diff] [blame] | 133 | # Must be last |
José Fonseca | 99771fc | 2010-11-25 20:32:59 +0000 | [diff] [blame] | 134 | Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]), |
| 135 | Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]), |
| 136 | ]) |
| 137 | |
| 138 | |