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_ = FakeEnum(Int, [
66 GLXAttrib = FakeEnum(Int, [
81 "GLX_ACCUM_GREEN_SIZE",
82 "GLX_ACCUM_BLUE_SIZE",
83 "GLX_ACCUM_ALPHA_SIZE",
86 "GLX_TRANSPARENT_TYPE",
87 "GLX_TRANSPARENT_INDEX_VALUE",
88 "GLX_TRANSPARENT_RED_VALUE",
89 "GLX_TRANSPARENT_GREEN_VALUE",
90 "GLX_TRANSPARENT_BLUE_VALUE",
91 "GLX_TRANSPARENT_ALPHA_VALUE",
95 GLXError = FakeEnum(Int, [
106 GLXbuffer = Flags(Int, [
110 "GLX_AUX_BUFFERS_BIT",
111 "GLX_FRONT_LEFT_BUFFER_BIT",
112 "GLX_FRONT_RIGHT_BUFFER_BIT",
113 "GLX_BACK_LEFT_BUFFER_BIT",
114 "GLX_BACK_RIGHT_BUFFER_BIT",
115 "GLX_DEPTH_BUFFER_BIT",
116 "GLX_STENCIL_BUFFER_BIT",
117 "GLX_ACCUM_BUFFER_BIT",
120 GLXEnum = FakeEnum(Int, [
129 "GLX_TRANSPARENT_RGB",
130 "GLX_TRANSPARENT_INDEX",
133 "GLX_NON_CONFORMANT_CONFIG",
139 "GLX_COLOR_INDEX_TYPE",
140 "GLX_MAX_PBUFFER_WIDTH",
141 "GLX_MAX_PBUFFER_HEIGHT",
142 "GLX_MAX_PBUFFER_PIXELS",
143 "GLX_PRESERVED_CONTENTS",
144 "GLX_LARGEST_PBUFFER",
152 "GLX_PBUFFER_HEIGHT",
156 GLXbuffer = Flags(Int, [
158 "GLX_COLOR_INDEX_BIT",
159 "GLX_PBUFFER_CLOBBER_MASK",
164 PROC = Opaque("__GLXextFuncPtr")
166 glxapi.add_functions([
168 Function(Pointer(XVisualInfo), "glXChooseVisual", [(Display, "dpy"), (Int, "screen"), (Array(GLXAttrib, "__AttribList_size(attribList)"), "attribList")]),
169 Function(GLXContext, "glXCreateContext", [(Display, "dpy"), (Pointer(XVisualInfo), "vis"), (GLXContext, "shareList"), (Bool_, "direct")]),
170 Function(Void, "glXDestroyContext", [(Display, "dpy"), (GLXContext, "ctx")]),
171 Function(Bool_, "glXMakeCurrent", [(Display, "dpy"), (GLXDrawable, "drawable"), (GLXContext, "ctx")]),
172 Function(Void, "glXCopyContext", [(Display, "dpy"), (GLXContext, "src"), (GLXContext, "dst"),
174 Function(Void, "glXSwapBuffers", [(Display, "dpy"), (GLXDrawable, "drawable")]),
175 Function(GLXPixmap, "glXCreateGLXPixmap", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
176 (Pixmap, "pixmap")]),
177 Function(Void, "glXDestroyGLXPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
178 Function(Bool_, "glXQueryExtension", [(Display, "dpy"), Out(Pointer(Int), "errorb"), Out(Pointer(Int), "event")]),
179 Function(Bool_, "glXQueryVersion", [(Display, "dpy"), Out(Pointer(Int), "maj"), Out(Pointer(Int), "min")]),
180 Function(Bool_, "glXIsDirect", [(Display, "dpy"), (GLXContext, "ctx")]),
181 Function(GLXError, "glXGetConfig", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
182 (GLXAttrib, "attrib"), Out(Pointer(Int), "value")]),
183 Function(GLXContext, "glXGetCurrentContext", [], sideeffects=False),
184 Function(GLXDrawable, "glXGetCurrentDrawable", [], sideeffects=False),
185 Function(Void, "glXWaitGL", []),
186 Function(Void, "glXWaitX", []),
187 Function(Void, "glXUseXFont", [(Font, "font"), (Int, "first"), (Int, "count"), (Int, "list")]),
190 Function((Const(String("char *"))), "glXQueryExtensionsString", [(Display, "dpy"), (Int, "screen")]),
191 Function((Const(String("char *"))), "glXQueryServerString", [(Display, "dpy"), (Int, "screen"), (Int, "name")]),
192 Function((Const(String("char *"))), "glXGetClientString", [(Display, "dpy"), (Int, "name")]),
195 Function(Display, "glXGetCurrentDisplay", [], sideeffects=False),
198 Function(Array(GLXFBConfig, "*nitems"), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), (Const(Array(GLXAttrib, "__AttribList_size(attribList)")), "attribList"), Out(Pointer(Int), "nitems")]),
199 Function(Int, "glXGetFBConfigAttrib", [(Display, "dpy"), (GLXFBConfig, "config"), (GLXAttrib, "attribute"), Out(Pointer(Int), "value")]),
200 Function(Array(GLXFBConfig, "*nelements"), "glXGetFBConfigs", [(Display, "dpy"), (Int, "screen"),
201 Out(Pointer(Int), "nelements")]),
202 Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfig", [(Display, "dpy"),
203 (GLXFBConfig, "config")]),
204 Function(GLXWindow, "glXCreateWindow", [(Display, "dpy"), (GLXFBConfig, "config"),
205 (Window, "win"), (Const(Array(Int, "__AttribList_size(attribList)")), "attribList")]),
206 Function(Void, "glXDestroyWindow", [(Display, "dpy"), (GLXWindow, "window")]),
207 Function(GLXPixmap, "glXCreatePixmap", [(Display, "dpy"), (GLXFBConfig, "config"),
208 (Pixmap, "pixmap"), (Const(Array(Int, "__AttribList_size(attribList)")), "attribList")]),
209 Function(Void, "glXDestroyPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
210 Function(GLXPbuffer, "glXCreatePbuffer", [(Display, "dpy"), (GLXFBConfig, "config"),
211 (Const(Array(GLXEnum, "__AttribList_size(attribList)")), "attribList")]),
212 Function(Void, "glXDestroyPbuffer", [(Display, "dpy"), (GLXPbuffer, "pbuf")]),
213 Function(Void, "glXQueryDrawable", [(Display, "dpy"), (GLXDrawable, "draw"), (GLXEnum, "attribute"),
214 Out(Pointer(UInt), "value")]),
215 Function(GLXContext, "glXCreateNewContext", [(Display, "dpy"), (GLXFBConfig, "config"),
216 (GLXEnum, "renderType"), (GLXContext, "shareList"),
218 Function(Bool_, "glXMakeContextCurrent", [(Display, "dpy"), (GLXDrawable, "draw"),
219 (GLXDrawable, "read"), (GLXContext, "ctx")]),
220 Function(GLXDrawable, "glXGetCurrentReadDrawable", []),
221 Function(Int, "glXQueryContext", [(Display, "dpy"), (GLXContext, "ctx"), (GLXEnum, "attribute"),
222 Out(Pointer(Int), "value")]),
223 Function(Void, "glXSelectEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
225 Function(Void, "glXGetSelectedEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
226 Out(Pointer(ULong), "mask")]),
230 Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]),
231 Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]),