VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/mesa-7.2/include/GL/miniglx.h@ 29743

Last change on this file since 29743 was 18881, checked in by vboxsync, 16 years ago

Additions/x11: exported Mesa headers to OSE

  • Property svn:eol-style set to native
File size: 12.0 KB
Line 
1/*
2 * Mesa 3-D graphics library
3 * Version: 6.1
4 *
5 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
26/**
27 * \file miniglx.h
28 * \brief Mini GLX interface functions.
29 * \author Brian Paul
30 *
31 * See comments miniglx.c for more information.
32 */
33
34#ifndef MINIGLX_H
35#define MINIGLX_H
36
37#include <GL/gl.h>
38#include <stdlib.h>
39
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45
46/**
47 * \name Replacement Xlib/GLX types
48 */
49/*@{*/
50/**
51 * \brief Boolean type.
52 *
53 * It can have the values #True or #False.
54 */
55#ifndef MINIGLX_NO_XTYPES
56typedef int Bool;
57#endif
58typedef int MINI_Bool;
59
60/**
61 * \brief Color map.
62 *
63 * Alias for private ::MiniGLXColormapRec structure.
64 */
65typedef struct MiniGLXColormapRec *MINI_Colormap;
66#ifndef MINIGLX_NO_XTYPES
67typedef struct MiniGLXColormapRec *Colormap;
68#endif
69
70/**
71 * \brief Window attributes.
72 */
73typedef struct MiniGLXSetWindowAttributesRec {
74 int background_pixel; /**< \brief background pixel */
75 int border_pixel; /**< \brief border pixel value */
76 MINI_Colormap colormap; /**< \brief color map to be associated with window */
77 int event_mask; /**< \brief set of events that should be saved */
78} XSetWindowAttributes;
79
80/**
81 * \brief Visual.
82 *
83 * Alias for the private ::MiniGLXVisualRec structure.
84 *
85 * \sa \ref datatypes.
86 */
87typedef struct MiniGLXVisualRec Visual;
88
89/**
90 * \brief Visual information.
91 *
92 * \sa \ref datatypes.
93 */
94#ifndef MINIGLX_NO_XTYPES
95typedef unsigned long VisualID;
96#endif
97typedef unsigned long MINI_VisualID;
98typedef struct MiniGLXXVisualInfoRec {
99 Visual *visual; /**< \brief pointer to the GLX Visual */
100 MINI_VisualID visualid; /**< \brief visual ID */
101 int screen; /**< \brief screen number */
102 int depth; /**< \brief bit depth */
103#if defined(__cplusplus) || defined(c_plusplus)
104 int c_class; /**< \brief class */
105#else
106 int class; /**< \brief class */
107#endif
108 int bits_per_rgb; /**< \brief total bits per pixel */
109} XVisualInfo;
110
111/**
112 * \brief GLX Frame Buffer Configuration (for pbuffers)
113 * \sa \ref datatypes.
114 */
115typedef struct MiniGLXFBConfigRec {
116 XVisualInfo *visInfo;
117} GLXFBConfig;
118
119
120/**
121 * \brief Display handle.
122 *
123 * Alias for the private ::MiniGLXDisplayRec structure.
124 *
125 * \sa \ref datatypes.
126 */
127#ifndef MINIGLX_NO_XTYPES
128typedef struct MiniGLXDisplayRec Display;
129#endif
130typedef struct MiniGLXDisplayRec MINI_Display;
131
132/**
133 * \brief Window handle.
134 *
135 * Alias for the private ::MiniGLXWindowRec structure.
136 *
137 * \sa \ref datatypes.
138 */
139#ifndef MINIGLX_NO_XTYPES
140typedef struct MiniGLXWindowRec *Window;
141#endif
142typedef struct MiniGLXWindowRec *MINI_Window;
143
144/**
145 * \brief Drawable.
146 *
147 * Alias for the private ::MiniGLXWindowRec structure.
148 *
149 * For Mini GLX only the full-screen window can be used as source and
150 * destination in graphics operations.
151 *
152 * \sa \ref datatypes.
153 */
154#ifndef MINIGLX_NO_XTYPES
155typedef struct MiniGLXWindowRec *Drawable;
156#endif
157typedef struct MiniGLXWindowRec *MINI_Drawable;
158
159/**
160 * \brief GLX drawable.
161 *
162 * Alias for the private ::MiniGLXWindowRec structure.
163 *
164 * Same as #Drawable.
165 *
166 * \sa \ref datatypes.
167 */
168typedef struct MiniGLXWindowRec *GLXDrawable;
169
170/**
171 * \brief GLX pbuffer.
172 *
173 * Alias for the private ::MiniGLXWindowRec structure.
174 *
175 * Same as #Drawable.
176 *
177 * \sa \ref datatypes.
178 */
179typedef struct MiniGLXWindowRec *GLXPbuffer;
180
181/**
182 * \brief GLX context.
183 *
184 * Alias for the private ::MiniGLXContext structure.
185 *
186 * \sa \ref datatypes.
187 */
188typedef struct MiniGLXContextRec *GLXContext;
189/*@}*/
190
191
192typedef struct {
193 int type;
194 unsigned long serial; /* # of last request processed by server */
195 MINI_Bool send_event; /* true if this came from a SendEvent request */
196 MINI_Display *display; /* Display the event was read from */
197 MINI_Window window;
198 int x, y;
199 int width, height;
200 int count; /* if non-zero, at least this many more */
201} XExposeEvent;
202
203typedef struct {
204 int type;
205 unsigned long serial; /* # of last request processed by server */
206 MINI_Bool send_event; /* true if this came from a SendEvent request */
207 MINI_Display *display; /* Display the event was read from */
208 MINI_Window parent; /* parent of the window */
209 MINI_Window window; /* window id of window created */
210 int x, y; /* window location */
211 int width, height; /* size of window */
212 int border_width; /* border width */
213 MINI_Bool override_redirect; /* creation should be overridden */
214} XCreateWindowEvent;
215
216typedef struct {
217 int type;
218 unsigned long serial; /* # of last request processed by server */
219 MINI_Bool send_event; /* true if this came from a SendEvent request */
220 MINI_Display *display; /* Display the event was read from */
221 MINI_Window event;
222 MINI_Window window;
223} XDestroyWindowEvent;
224
225typedef struct {
226 int type;
227 unsigned long serial; /* # of last request processed by server */
228 MINI_Bool send_event; /* true if this came from a SendEvent request */
229 MINI_Display *display; /* Display the event was read from */
230 MINI_Window event;
231 MINI_Window window;
232 MINI_Bool from_configure;
233} XUnmapEvent;
234
235typedef struct {
236 int type;
237 unsigned long serial; /* # of last request processed by server */
238 MINI_Bool send_event; /* true if this came from a SendEvent request */
239 MINI_Display *display; /* Display the event was read from */
240 MINI_Window event;
241 MINI_Window window;
242 MINI_Bool override_redirect; /* boolean, is override set... */
243} XMapEvent;
244
245
246typedef struct {
247 int type;
248 unsigned long serial; /* # of last request processed by server */
249 MINI_Bool send_event; /* true if this came from a SendEvent request */
250 MINI_Display *display; /* Display the event was read from */
251 MINI_Window parent;
252 MINI_Window window;
253} XMapRequestEvent;
254
255typedef union _XEvent {
256 int type; /* must not be changed; first element */
257 XExposeEvent xexpose;
258 XCreateWindowEvent xcreatewindow;
259 XDestroyWindowEvent xdestroywindow;
260 XUnmapEvent xunmap;
261 XMapEvent xmap;
262 XMapRequestEvent xmaprequest;
263 long pad[24];
264} XEvent;
265
266
267/**
268 * \name Xlib constants
269 */
270/*@{*/
271#define False 0
272#define True 1
273#define None 0
274#define AllocNone 0
275#define InputOutput 1
276#define ExposureMask (1L<<15)
277#define StructureNotifyMask (1L<<17)
278#define CWBackPixel (1L<<1)
279#define CWBorderPixel (1L<<3)
280#define CWEventMask (1L<<11)
281#define CWColormap (1L<<13)
282#define PseudoColor 3
283#define TrueColor 4
284#define VisualIDMask 0x1
285#define VisualScreenMask 0x2
286#define Expose 12
287#define CreateNotify 16
288#define DestroyNotify 17
289#define UnmapNotify 18
290#define MapNotify 19
291#define MapRequest 20
292
293/*@}*/
294
295/**
296 * \name Standard GLX tokens
297 */
298/*@{*/
299#define GLX_USE_GL 1
300#define GLX_BUFFER_SIZE 2
301#define GLX_LEVEL 3
302#define GLX_RGBA 4
303#define GLX_DOUBLEBUFFER 5
304#define GLX_STEREO 6
305#define GLX_AUX_BUFFERS 7
306#define GLX_RED_SIZE 8
307#define GLX_GREEN_SIZE 9
308#define GLX_BLUE_SIZE 10
309#define GLX_ALPHA_SIZE 11
310#define GLX_DEPTH_SIZE 12
311#define GLX_STENCIL_SIZE 13
312#define GLX_ACCUM_RED_SIZE 14
313#define GLX_ACCUM_GREEN_SIZE 15
314#define GLX_ACCUM_BLUE_SIZE 16
315#define GLX_ACCUM_ALPHA_SIZE 17
316#define GLX_BAD_ATTRIBUTE 1
317#define GLX_BAD_VISUAL 4
318/*@}*/
319
320
321/**
322 * \name Unique to Mini GLX
323 *
324 * At compile time, the Mini GLX interface version can be tested with the
325 * MINI_GLX_VERSION_1_x preprocessor tokens.
326 *
327 * \sa glXQueryVersion()
328 */
329/*@{*/
330/** \brief Defined if version 1.0 of Mini GLX is supported. */
331#define MINI_GLX_VERSION_1_0 1
332/** \brief Defined if version 1.1 of Mini GLX is supported. */
333#define MINI_GLX_VERSION_1_1 1
334/*@}*/
335
336
337/**
338 * \name Server-specific functions
339 */
340extern MINI_Display *
341__miniglx_StartServer( const char *display_name );
342
343extern int
344__miniglx_Select( MINI_Display *dpy, int maxfd,
345 fd_set *rfds, fd_set *wfds, fd_set *xfds,
346 struct timeval *tv );
347
348
349/**
350 * \name Simulated Xlib functions
351 */
352/*@{*/
353extern MINI_Display *
354XOpenDisplay( const char *dpy_name );
355
356
357extern void
358XCloseDisplay( MINI_Display *display );
359
360extern MINI_Window
361XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y,
362 unsigned int width, unsigned int height,
363 unsigned int border_width, int depth, unsigned int winclass,
364 Visual *visual, unsigned long valuemask,
365 XSetWindowAttributes *attributes );
366
367extern int
368XNextEvent(MINI_Display *display, XEvent *event_return);
369
370extern MINI_Bool
371XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return );
372
373/**
374 * \brief Return the root window.
375 *
376 * \param display the display handle. It is ignored by Mini GLX, but should be
377 * the value returned by XOpenDisplay().
378 * \param screen the screen number on the host server. It is ignored by Mini
379 * GLX but should be zero.
380 *
381 * \return the root window. Always zero on Mini GLX.
382 */
383#define RootWindow(display, screen) 0
384#define DefaultScreen(dpy) 0
385
386extern void
387XDestroyWindow( MINI_Display *display, MINI_Window w );
388
389extern void
390XMapWindow( MINI_Display *display, MINI_Window w );
391
392/* Should clients have access to this?
393 */
394extern void
395XUnmapWindow( MINI_Display *display, MINI_Window w );
396
397extern MINI_Colormap
398XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc );
399
400extern void
401XFreeColormap( MINI_Display *display, MINI_Colormap cmap );
402
403extern void
404XFree( void *data );
405
406extern XVisualInfo *
407XGetVisualInfo( MINI_Display *display, long vinfo_mask,
408 XVisualInfo *vinfo_template, int *nitems_return );
409/*@}*/
410
411
412
413/**
414 * \name GLX functions
415 */
416/*@{*/
417extern XVisualInfo*
418glXChooseVisual( MINI_Display *dpy, int screen, int *attribList );
419
420extern int
421glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value );
422
423extern GLXContext
424glXCreateContext( MINI_Display *dpy, XVisualInfo *vis,
425 GLXContext shareList, MINI_Bool direct );
426
427extern void
428glXDestroyContext( MINI_Display *dpy, GLXContext ctx );
429
430extern MINI_Bool
431glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx);
432
433extern void
434glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable );
435
436extern GLXContext
437glXGetCurrentContext( void );
438
439extern GLXDrawable
440glXGetCurrentDrawable( void );
441
442extern void
443(*glXGetProcAddress(const GLubyte *procname))( void );
444
445extern MINI_Bool
446glXQueryVersion( MINI_Display *dpy, int *major, int *minor );
447
448/* Added in MiniGLX 1.1 */
449extern GLXPbuffer
450glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList );
451
452extern void
453glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf );
454
455extern GLXFBConfig *
456glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList,
457 int *nitems );
458
459extern XVisualInfo *
460glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config );
461
462extern void *glXAllocateMemoryMESA(Display *dpy, int scrn,
463 size_t size, float readFreq,
464 float writeFreq, float priority);
465
466extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
467
468extern GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
469 const void *pointer );
470/*@}*/
471
472extern void
473__glXScrEnableExtension( void *, const char * name );
474
475/*@}*/
476
477
478#ifdef __cplusplus
479}
480#endif
481
482#endif /* MINIGLX_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette