1 /******************************************************************************
2     Based on the generated files from the BCD tool
3     modified by: Frank Benoit <keinfarbton@googlemail.com>
4 ******************************************************************************/
5 module org.eclipse.swt.internal.c.glx;
6 
7 private import org.eclipse.swt.internal.c.X;
8 
9 import java.lang.all;
10 
11 public import org.eclipse.swt.internal.c.Xutil;
12 
13 version(Tango){
14     import tango.stdc.stdint;
15 } else { // Phobos
16     import std.stdint;
17 }
18 
19 version=DYNLINK;
20 
21 version(DYNLINK){
22     import java.nonstandard.SharedLib;
23 }
24 
25 void loadLib(){
26     version(DYNLINK){
27         SharedLib.loadLibSymbols( symbols, "libGL.so" );
28     }
29 }
30 
31 extern(C):
32 
33 alias c_int GLint;
34 alias c_uint GLuint;
35 alias c_long GLlong;
36 alias c_ulong GLulong;
37 alias GLint Bool;
38 alias GLint GLsizei;
39 alias GLuint GLenum;
40 alias __GLXEvent GLXEvent;
41 alias XID GLXDrawable;
42 alias void * GLXFBConfig;
43 alias void * GLXContext;
44 alias XID GLXFBConfigID;
45 alias XID GLXWindow;
46 alias XID GLXPbuffer;
47 alias XID GLXPixmap;
48 alias XID GLXContextID;
49 alias void function() _BCD_func__2197;
50 union __GLXEvent {
51 GLXPbufferClobberEvent glxpbufferclobber;
52 GLlong [24] pad;
53 }
54 struct GLXPbufferClobberEvent {
55 GLint event_type;
56 GLint draw_type;
57 GLulong serial;
58 Bool send_event;
59 void * display;
60 GLXDrawable drawable;
61 GLuint buffer_mask;
62 GLuint aux_buffer;
63 GLint x;
64 GLint y;
65 GLint width;
66 GLint height;
67 GLint count;
68 }
69 
70 version(DYNLINK){
71 mixin(gshared!(
72 "extern (C) void function(GLenum, GLint*) dwt_glGetIntegerv;
73 extern (C) void function(GLint,GLint,GLsizei,GLsizei) dwt_glViewport;
74 
75 extern (C) GLint function(GLint)dwt_glXSwapIntervalSGI;
76 extern (C) _BCD_func__2197 function(char *)dwt_glXGetProcAddressARB;
77 extern (C) Bool function(void *, GLXDrawable, void *)dwt_glXMakeCurrent;
78 extern (C) void * function(void *, XVisualInfo *, void *, Bool)dwt_glXCreateContext;
79 extern (C) void function(void *, GLXPixmap)dwt_glXDestroyGLXPixmap;
80 extern (C) GLXPixmap function(void *, XVisualInfo *, Pixmap)dwt_glXCreateGLXPixmap;
81 extern (C) XVisualInfo * function(void *, GLint, GLint *)dwt_glXChooseVisual;
82 extern (C) GLint function(void *, XVisualInfo *, GLint, GLint *)dwt_glXGetConfig;
83 extern (C) void function(Font, GLint, GLint, GLint)dwt_glXUseXFont;
84 extern (C) void function(void *, GLXDrawable)dwt_glXSwapBuffers;
85 extern (C) void function()dwt_glXWaitX;
86 extern (C) void function()dwt_glXWaitGL;
87 extern (C) void function(void *, GLXDrawable, GLulong *)dwt_glXGetSelectedEvent;
88 extern (C) void function(void *, GLXDrawable, GLulong)dwt_glXSelectEvent;
89 extern (C) GLint function(void *, void *, GLint, GLint *)dwt_glXQueryContext;
90 extern (C) void * function()dwt_glXGetCurrentDisplay;
91 extern (C) GLXDrawable function()dwt_glXGetCurrentReadDrawable;
92 extern (C) GLXDrawable function()dwt_glXGetCurrentDrawable;
93 extern (C) void * function()dwt_glXGetCurrentContext;
94 extern (C) void function(void *, void *, void *, GLulong)dwt_glXCopyContext;
95 extern (C) Bool function(void *, GLXDrawable, GLXDrawable, void *)dwt_glXMakeContextCurrent;
96 extern (C) void function(void *, void *)dwt_glXDestroyContext;
97 extern (C) Bool function(void *, void *)dwt_glXIsDirect;
98 extern (C) void * function(void *, void *, GLint, void *, Bool)dwt_glXCreateNewContext;
99 extern (C) void function(void *, GLXDrawable, GLint, GLuint *)dwt_glXQueryDrawable;
100 extern (C) void function(void *, GLXPbuffer)dwt_glXDestroyPbuffer;
101 extern (C) GLXPbuffer function(void *, void *, const GLint *)dwt_glXCreatePbuffer;
102 extern (C) void function(void *, GLXPixmap)dwt_glXDestroyPixmap;
103 extern (C) GLXPixmap function(void *, void *, Pixmap, const GLint *)dwt_glXCreatePixmap;
104 extern (C) void function(void *, GLXWindow)dwt_glXDestroyWindow;
105 extern (C) GLXWindow function(void *, void *, Window, const GLint *)dwt_glXCreateWindow;
106 extern (C) XVisualInfo * function(void *, void *)dwt_glXGetVisualFromFBConfig;
107 extern (C) GLint function(void *, void *, GLint, GLint *)dwt_glXGetFBConfigAttrib;
108 extern (C) void * * function(void *, GLint, const GLint *, GLint *)dwt_glXChooseFBConfig;
109 extern (C) void * * function(void *, GLint, GLint *)dwt_glXGetFBConfigs;
110 extern (C) char * function(void *, GLint, GLint)dwt_glXQueryServerString;
111 extern (C) char * function(void *, GLint)dwt_glXGetClientString;
112 extern (C) char * function(void *, GLint)dwt_glXQueryExtensionsString;
113 extern (C) Bool function(void *, GLint *, GLint *)dwt_glXQueryVersion;
114 extern (C) Bool function(void *, GLint *, GLint *)dwt_glXQueryExtension;"
115 ));
116 
117 Symbol[] symbols;
118 static this () {
119     symbols = [
120         Symbol("glGetIntegerv", cast(void**)& dwt_glGetIntegerv),
121         Symbol("glViewport", cast(void**)& dwt_glViewport),
122         Symbol("glXSwapIntervalSGI",  cast(void**)& dwt_glXSwapIntervalSGI),
123         Symbol("glXGetProcAddressARB",  cast(void**)& dwt_glXGetProcAddressARB),
124         Symbol("glXMakeCurrent",  cast(void**)& dwt_glXMakeCurrent),
125         Symbol("glXCreateContext",  cast(void**)& dwt_glXCreateContext),
126         Symbol("glXDestroyGLXPixmap",  cast(void**)& dwt_glXDestroyGLXPixmap),
127         Symbol("glXCreateGLXPixmap",  cast(void**)& dwt_glXCreateGLXPixmap),
128         Symbol("glXChooseVisual",  cast(void**)& dwt_glXChooseVisual),
129         Symbol("glXGetConfig",  cast(void**)& dwt_glXGetConfig),
130         Symbol("glXUseXFont",  cast(void**)& dwt_glXUseXFont),
131         Symbol("glXSwapBuffers",  cast(void**)& dwt_glXSwapBuffers),
132         Symbol("glXWaitX",  cast(void**)& dwt_glXWaitX),
133         Symbol("glXWaitGL",  cast(void**)& dwt_glXWaitGL),
134         Symbol("glXGetSelectedEvent",  cast(void**)& dwt_glXGetSelectedEvent),
135         Symbol("glXSelectEvent",  cast(void**)& dwt_glXSelectEvent),
136         Symbol("glXQueryContext",  cast(void**)& dwt_glXQueryContext),
137         Symbol("glXGetCurrentDisplay",  cast(void**)& dwt_glXGetCurrentDisplay),
138         Symbol("glXGetCurrentReadDrawable",  cast(void**)& dwt_glXGetCurrentReadDrawable),
139         Symbol("glXGetCurrentDrawable",  cast(void**)& dwt_glXGetCurrentDrawable),
140         Symbol("glXGetCurrentContext",  cast(void**)& dwt_glXGetCurrentContext),
141         Symbol("glXCopyContext",  cast(void**)& dwt_glXCopyContext),
142         Symbol("glXMakeContextCurrent",  cast(void**)& dwt_glXMakeContextCurrent),
143         Symbol("glXDestroyContext",  cast(void**)& dwt_glXDestroyContext),
144         Symbol("glXIsDirect",  cast(void**)& dwt_glXIsDirect),
145         Symbol("glXCreateNewContext",  cast(void**)& dwt_glXCreateNewContext),
146         Symbol("glXQueryDrawable",  cast(void**)& dwt_glXQueryDrawable),
147         Symbol("glXDestroyPbuffer",  cast(void**)& dwt_glXDestroyPbuffer),
148         Symbol("glXCreatePbuffer",  cast(void**)& dwt_glXCreatePbuffer),
149         Symbol("glXDestroyPixmap",  cast(void**)& dwt_glXDestroyPixmap),
150         Symbol("glXCreatePixmap",  cast(void**)& dwt_glXCreatePixmap),
151         Symbol("glXDestroyWindow",  cast(void**)& dwt_glXDestroyWindow),
152         Symbol("glXCreateWindow",  cast(void**)& dwt_glXCreateWindow),
153         Symbol("glXGetVisualFromFBConfig",  cast(void**)& dwt_glXGetVisualFromFBConfig),
154         Symbol("glXGetFBConfigAttrib",  cast(void**)& dwt_glXGetFBConfigAttrib),
155         Symbol("glXChooseFBConfig",  cast(void**)& dwt_glXChooseFBConfig),
156         Symbol("glXGetFBConfigs",  cast(void**)& dwt_glXGetFBConfigs),
157         Symbol("glXQueryServerString",  cast(void**)& dwt_glXQueryServerString),
158         Symbol("glXGetClientString",  cast(void**)& dwt_glXGetClientString),
159         Symbol("glXQueryExtensionsString",  cast(void**)& dwt_glXQueryExtensionsString),
160         Symbol("glXQueryVersion",  cast(void**)& dwt_glXQueryVersion),
161         Symbol("glXQueryExtension",  cast(void**)& dwt_glXQueryExtension)
162     ];
163 }
164 
165 } else { // version(DYNLINK)
166 extern (C) GLint glXSwapIntervalSGI(GLint);
167 extern (C) _BCD_func__2197 glXGetProcAddressARB(char *);
168 extern (C) Bool glXMakeCurrent(void *, GLXDrawable, void *);
169 extern (C) void * glXCreateContext(void *, XVisualInfo *, void *, Bool);
170 extern (C) void glXDestroyGLXPixmap(void *, GLXPixmap);
171 extern (C) GLXPixmap glXCreateGLXPixmap(void *, XVisualInfo *, Pixmap);
172 extern (C) XVisualInfo * glXChooseVisual(void *, GLint, GLint *);
173 extern (C) GLint glXGetConfig(void *, XVisualInfo *, GLint, GLint *);
174 extern (C) void glXUseXFont(Font, GLint, GLint, GLint);
175 extern (C) void glXSwapBuffers(void *, GLXDrawable);
176 extern (C) void glXWaitX();
177 extern (C) void glXWaitGL();
178 extern (C) void glXGetSelectedEvent(void *, GLXDrawable, GLulong *);
179 extern (C) void glXSelectEvent(void *, GLXDrawable, GLulong);
180 extern (C) GLint glXQueryContext(void *, void *, GLint, GLint *);
181 extern (C) void * glXGetCurrentDisplay();
182 extern (C) GLXDrawable glXGetCurrentReadDrawable();
183 extern (C) GLXDrawable glXGetCurrentDrawable();
184 extern (C) void * glXGetCurrentContext();
185 extern (C) void glXCopyContext(void *, void *, void *, GLulong);
186 extern (C) Bool glXMakeContextCurrent(void *, GLXDrawable, GLXDrawable, void *);
187 extern (C) void glXDestroyContext(void *, void *);
188 extern (C) Bool glXIsDirect(void *, void *);
189 extern (C) void * glXCreateNewContext(void *, void *, GLint, void *, Bool);
190 extern (C) void glXQueryDrawable(void *, GLXDrawable, GLint, GLuint *);
191 extern (C) void glXDestroyPbuffer(void *, GLXPbuffer);
192 extern (C) GLXPbuffer glXCreatePbuffer(void *, void *, const GLint *);
193 extern (C) void glXDestroyPixmap(void *, GLXPixmap);
194 extern (C) GLXPixmap glXCreatePixmap(void *, void *, Pixmap, const GLint *);
195 extern (C) void glXDestroyWindow(void *, GLXWindow);
196 extern (C) GLXWindow glXCreateWindow(void *, void *, Window, const GLint *);
197 extern (C) XVisualInfo * glXGetVisualFromFBConfig(void *, void *);
198 extern (C) GLint glXGetFBConfigAttrib(void *, void *, GLint, GLint *);
199 extern (C) void * * glXChooseFBConfig(void *, GLint, const GLint *, GLint *);
200 extern (C) void * * glXGetFBConfigs(void *, GLint, GLint *);
201 extern (C) char * glXQueryServerString(void *, GLint, GLint);
202 extern (C) char * glXGetClientString(void *, GLint);
203 extern (C) char * glXQueryExtensionsString(void *, GLint);
204 extern (C) Bool glXQueryVersion(void *, GLint *, GLint *);
205 extern (C) Bool glXQueryExtension(void *, GLint *, GLint *);
206 } // version(DYNLINK)
207