OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / ALPHALINUX5 / util / ALPHALINUX5 / include / GL / xmesa.h
1 /* $Id: xmesa.h,v 1.1.1.1 2002/02/01 06:35:43 tacyas Exp $ */
2
3 /*
4  * Mesa 3-D graphics library
5  * Version:  3.0
6  * Copyright (C) 1995-1998  Brian Paul
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */
22
23
24 /*
25  * $Log: xmesa.h,v $
26  * Revision 1.1.1.1  2002/02/01 06:35:43  tacyas
27  * Initail Import Into CVS
28  *
29  * Revision 1.1  1998/02/13 03:17:32  brianp
30  * Initial revision
31  *
32  */
33
34
35 /*
36  * Mesa/X11 interface.  This header file serves as the documentation for
37  * the Mesa/X11 interface functions.
38  *
39  * Note: this interface isn't intended for user programs.  It's primarily
40  * just for implementing the pseudo-GLX interface.
41  */
42
43
44 /* Sample Usage:
45
46 In addition to the usual X calls to select a visual, create a colormap
47 and create a window, you must do the following to use the X/Mesa interface:
48
49 1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo.
50
51 2. Call XMesaCreateContext() to create an X/Mesa rendering context, given
52    the XMesaVisual.
53
54 3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window
55    and XMesaVisual.
56
57 4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and
58    to make the context the current one.
59
60 5. Make gl* calls to render your graphics.
61
62 6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers.
63
64 7. Before the X window is destroyed, call XMesaDestroyBuffer().
65
66 8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext.
67
68 See the demos/xdemo.c and xmesa1.c files for examples.
69 */
70
71
72
73
74 #ifndef XMESA_H
75 #define XMESA_H
76
77
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81
82
83 #include <X11/Xlib.h>
84 #include <X11/Xutil.h>
85 #include "GL/gl.h"
86
87 #ifdef AMIWIN
88 #include <pragmas/xlib_pragmas.h>
89 extern struct Library *XLibBase;
90 #endif
91
92
93 #define XMESA_MAJOR_VERSION 3
94 #define XMESA_MINOR_VERSION 0
95
96
97
98 /*
99  * Values passed to XMesaGetString:
100  */
101 #define XMESA_VERSION 1
102 #define XMESA_EXTENSIONS 2
103
104
105 /*
106  * Values passed to XMesaSetFXmode:
107  */
108 #define XMESA_FX_WINDOW       1
109 #define XMESA_FX_FULLSCREEN   2
110
111
112
113 typedef struct xmesa_context *XMesaContext;
114
115 typedef struct xmesa_visual *XMesaVisual;
116
117 typedef struct xmesa_buffer *XMesaBuffer;
118
119
120
121
122 /*
123  * Create a new X/Mesa visual.
124  * Input:  display - X11 display
125  *         visinfo - an XVisualInfo pointer
126  *         rgb_flag - GL_TRUE = RGB mode,
127  *                    GL_FALSE = color index mode
128  *         alpha_flag - alpha buffer requested?
129  *         db_flag - GL_TRUE = double-buffered,
130  *                   GL_FALSE = single buffered
131  *         stereo_flag - stereo visual?
132  *         depth_size - requested bits/depth values, or zero
133  *         stencil_size - requested bits/stencil values, or zero
134  *         accum_size - requested bits/component values, or zero
135  *         ximage_flag - GL_TRUE = use an XImage for back buffer,
136  *                       GL_FALSE = use an off-screen pixmap for back buffer
137  * Return;  a new XMesaVisual or 0 if error.
138  */
139 extern XMesaVisual XMesaCreateVisual( Display *display,
140                                       XVisualInfo *visinfo,
141                                       GLboolean rgb_flag,
142                                       GLboolean alpha_flag,
143                                       GLboolean db_flag,
144                                       GLboolean stereo_flag,
145                                       GLboolean ximage_flag,
146                                       GLint depth_size,
147                                       GLint stencil_size,
148                                       GLint accum_size,
149                                       GLint level );
150
151 /*
152  * Destroy an XMesaVisual, but not the associated XVisualInfo.
153  */
154 extern void XMesaDestroyVisual( XMesaVisual v );
155
156
157
158 /*
159  * Create a new XMesaContext for rendering into an X11 window.
160  *
161  * Input:  visual - an XMesaVisual
162  *         share_list - another XMesaContext with which to share display
163  *                      lists or NULL if no sharing is wanted.
164  * Return:  an XMesaContext or NULL if error.
165  */
166 extern XMesaContext XMesaCreateContext( XMesaVisual visual,
167                                         XMesaContext share_list );
168
169
170 /*
171  * Destroy a rendering context as returned by XMesaCreateContext()
172  */
173 extern void XMesaDestroyContext( XMesaContext c );
174
175
176 /*
177  * Create an XMesaBuffer from an X window.
178  */
179 extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, Window w );
180
181
182 /*
183  * Create an XMesaBuffer from an X pixmap.
184  */
185 extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v, Pixmap p,
186                                             Colormap c );
187
188
189 /*
190  * Destroy an XMesaBuffer, but not the corresponding window or pixmap.
191  */
192 extern void XMesaDestroyBuffer( XMesaBuffer b );
193
194
195 /*
196  * Return the XMesaBuffer handle which corresponds to an X drawable, if any.
197  *
198  * New in Mesa 2.3.
199  */
200 extern XMesaBuffer XMesaFindBuffer( Display *dpy, Drawable d );
201
202
203
204 /*
205  * Bind a buffer to a context and make the context the current one.
206  */
207 extern GLboolean XMesaMakeCurrent( XMesaContext c, XMesaBuffer b );
208
209
210 /*
211  * Return a handle to the current context.
212  */
213 extern XMesaContext XMesaGetCurrentContext( void );
214
215
216 /*
217  * Return handle to the current buffer.
218  */
219 extern XMesaBuffer XMesaGetCurrentBuffer( void );
220
221
222 /*
223  * Swap the front and back buffers for the given buffer.  No action is
224  * taken if the buffer is not double buffered.
225  */
226 extern void XMesaSwapBuffers( XMesaBuffer b );
227
228
229 /*
230  * Copy a sub-region of the back buffer to the front buffer.
231  *
232  * New in Mesa 2.6
233  */
234 extern void XMesaCopySubBuffer( XMesaBuffer b,
235                                 int x, int y, int width, int height );
236
237
238 /*
239  * Return a pointer to the the Pixmap or XImage being used as the back
240  * color buffer of an XMesaBuffer.  This function is a way to get "under
241  * the hood" of X/Mesa so one can manipulate the back buffer directly.
242  * Input:  b - the XMesaBuffer
243  * Output:  pixmap - pointer to back buffer's Pixmap, or 0
244  *          ximage - pointer to back buffer's XImage, or NULL
245  * Return:  GL_TRUE = context is double buffered
246  *          GL_FALSE = context is single buffered
247  */
248 extern GLboolean XMesaGetBackBuffer( XMesaBuffer b,
249                                      Pixmap *pixmap, XImage **ximage );
250
251
252
253 /*
254  * Return the depth buffer associated with an XMesaBuffer.
255  * Input:  b - the XMesa buffer handle
256  * Output:  width, height - size of buffer in pixels
257  *          bytesPerValue - bytes per depth value (2 or 4)
258  *          buffer - pointer to depth buffer values
259  * Return:  GL_TRUE or GL_FALSE to indicate success or failure.
260  *
261  * New in Mesa 2.4.
262  */
263 extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b,
264                                       GLint *width, GLint *height,
265                                       GLint *bytesPerValue, void **buffer );
266
267
268
269 /*
270  * Flush/sync a context
271  */
272 extern void XMesaFlush( XMesaContext c );
273
274
275
276 /*
277  * Get an X/Mesa-specific string.
278  * Input:  name - either XMESA_VERSION or XMESA_EXTENSIONS
279  */
280 extern const char *XMesaGetString( XMesaContext c, int name );
281
282
283
284 /*
285  * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free
286  * any memory used by that buffer.
287  *
288  * New in Mesa 2.3.
289  */
290 extern void XMesaGarbageCollect( void );
291
292
293
294 /*
295  * Return a dithered pixel value.
296  * Input:  c - XMesaContext
297  *         x, y - window coordinate
298  *         red, green, blue, alpha - color components in [0,1]
299  * Return:  pixel value
300  *
301  * New in Mesa 2.3.
302  */
303 extern unsigned long XMesaDitherColor( XMesaContext c, GLint x, GLint y,
304                                        GLfloat red, GLfloat green,
305                                        GLfloat blue, GLfloat alpha );
306
307
308
309 /*
310  * 3Dfx Glide driver only!
311  * Set 3Dfx/Glide full-screen or window rendering mode.
312  * Input:  mode - either XMESA_FX_WINDOW (window rendering mode) or
313  *                XMESA_FX_FULLSCREEN (full-screen rendering mode)
314  * Return:  GL_TRUE if success
315  *          GL_FALSE if invalid mode or if not using 3Dfx driver
316  *
317  * New in Mesa 2.6.
318  */
319 extern GLboolean XMesaSetFXmode( GLint mode );
320
321
322
323 #ifdef __cplusplus
324 }
325 #endif
326
327
328 #endif