blob: d117ed4ed983c85209e3a2e8a7e2baed1b378a4e [file] [log] [blame]
José Fonseca99771fc2010-11-25 20:32:59 +00001##########################################################################
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é Fonseca4a826ed2010-11-30 16:58:22 +000026"""GLX API description."""
27
José Fonseca99771fc2010-11-25 20:32:59 +000028
29from stdapi import *
30from glapi import glapi
31
José Fonsecae90885a2010-11-26 15:01:18 +000032VisualID = Alias("VisualID", UInt32)
José Fonsecae90885a2010-11-26 15:01:18 +000033Display = Opaque("Display *")
34Visual = Opaque("Visual *")
Zack Rusinf3f2e462011-03-23 18:35:39 -040035Font = Alias("Font", UInt32)
36Pixmap = Alias("Pixmap", UInt32)
37Window = Alias("Window", UInt32)
38
39GLXContext = Opaque("GLXContext")
40GLXPixmap = Alias("GLXPixmap", UInt32)
41GLXDrawable = Alias("GLXDrawable", UInt32)
42GLXFBConfig = Opaque("GLXFBConfig")
43GLXFBConfigID = Alias("GLXFBConfigID", UInt32)
44GLXContextID = Alias("GLXContextID", UInt32)
45GLXWindow = Alias("GLXWindow", UInt32)
46GLXPbuffer = Alias("GLXPbuffer", UInt32)
José Fonsecae90885a2010-11-26 15:01:18 +000047
48XVisualInfo = 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
61Bool_ = Alias("Bool", Int)
José Fonseca99771fc2010-11-25 20:32:59 +000062
63glxapi = API("GLX")
64
65PROC = Opaque("__GLXextFuncPtr")
66
67glxapi.add_functions(glapi.functions)
68glxapi.add_functions([
Zack Rusinf3f2e462011-03-23 18:35:39 -040069 # GLX
70 Function(Pointer(XVisualInfo), "glXChooseVisual", [(Display, "dpy"), (Int, "screen"), (Pointer(Int), "attribList")]),
José Fonsecae90885a2010-11-26 15:01:18 +000071 Function(GLXContext, "glXCreateContext", [(Display, "dpy"), (Pointer(XVisualInfo), "vis"), (GLXContext, "shareList"), (Bool_, "direct")]),
Zack Rusinf3f2e462011-03-23 18:35:39 -040072 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é Fonsecae90885a2010-11-26 15:01:18 +0000132
José Fonseca4a826ed2010-11-30 16:58:22 +0000133 # Must be last
José Fonseca99771fc2010-11-25 20:32:59 +0000134 Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]),
135 Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]),
136])
137
138