1 ##########################################################################
3 # Copyright 2008-2009 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 ##########################################################################/
26 """GLX API description."""
30 from glapi import glapi
32 VisualID = Alias("VisualID", UInt32)
33 Display = Opaque("Display *")
34 Visual = Opaque("Visual *")
35 Font = Alias("Font", UInt32)
36 Pixmap = Alias("Pixmap", UInt32)
37 Window = Alias("Window", UInt32)
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)
48 XVisualInfo = Struct("XVisualInfo", [
50 (VisualID, "visualid"),
55 (ULong, "green_mask"),
57 (Int, "colormap_size"),
58 (Int, "bits_per_rgb"),
61 Bool_ = Alias("Bool", Int)
65 PROC = Opaque("__GLXextFuncPtr")
67 glxapi.add_functions(glapi.functions)
68 glxapi.add_functions([
70 Function(Pointer(XVisualInfo), "glXChooseVisual", [(Display, "dpy"), (Int, "screen"), (Pointer(Int), "attribList")]),
71 Function(GLXContext, "glXCreateContext", [(Display, "dpy"), (Pointer(XVisualInfo), "vis"), (GLXContext, "shareList"), (Bool_, "direct")]),
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"),
76 Function(Void, "glXSwapBuffers", [(Display, "dpy"), (GLXDrawable, "drawable")]),
77 Function(GLXPixmap, "glXCreateGLXPixmap", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
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")]),
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")]),
97 Function(Display, "glXGetCurrentDisplay", [], sideeffects=False),
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"),
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"),
129 Function(Void, "glXGetSelectedEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
130 (Pointer(ULong), "mask")]),
134 Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]),
135 Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]),