| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/GL/xmesa.h
Go to the documentation of this file.

    00001 /*
    00002  * Mesa 3-D graphics library
    00003  * Version:  4.1
    00004  *
    00005  * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
    00006  *
    00007  * Permission is hereby granted, free of charge, to any person obtaining a
    00008  * copy of this software and associated documentation files (the "Software"),
    00009  * to deal in the Software without restriction, including without limitation
    00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00011  * and/or sell copies of the Software, and to permit persons to whom the
    00012  * Software is furnished to do so, subject to the following conditions:
    00013  *
    00014  * The above copyright notice and this permission notice shall be included
    00015  * in all copies or substantial portions of the Software.
    00016  *
    00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00023  */
    00024
    00025
    00026 /*
    00027  * Mesa/X11 interface.  This header file serves as the documentation for
    00028  * the Mesa/X11 interface functions.
    00029  *
    00030  * Note: this interface isn't intended for user programs.  It's primarily
    00031  * just for implementing the pseudo-GLX interface.
    00032  */
    00033
    00034
    00035 /* Sample Usage:
    00036
    00037 In addition to the usual X calls to select a visual, create a colormap
    00038 and create a window, you must do the following to use the X/Mesa interface:
    00039
    00040 1. Call XMesaCreateVisual() to make an XMesaVisual from an XVisualInfo.
    00041
    00042 2. Call XMesaCreateContext() to create an X/Mesa rendering context, given
    00043    the XMesaVisual.
    00044
    00045 3. Call XMesaCreateWindowBuffer() to create an XMesaBuffer from an X window
    00046    and XMesaVisual.
    00047
    00048 4. Call XMesaMakeCurrent() to bind the XMesaBuffer to an XMesaContext and
    00049    to make the context the current one.
    00050
    00051 5. Make gl* calls to render your graphics.
    00052
    00053 6. Use XMesaSwapBuffers() when double buffering to swap front/back buffers.
    00054
    00055 7. Before the X window is destroyed, call XMesaDestroyBuffer().
    00056
    00057 8. Before exiting, call XMesaDestroyVisual and XMesaDestroyContext.
    00058
    00059 */
    00060
    00061
    00062
    00063
    00064 #ifndef XMESA_H
    00065 #define XMESA_H
    00066
    00067 #ifdef __VMS
    00068 #include <GL/vms_x_fix.h>
    00069 #endif
    00070
    00071 #ifdef __cplusplus
    00072 extern "C" {
    00073 #endif
    00074
    00075 #ifdef XFree86Server
    00076 #include "xmesa_xf86.h"
    00077 #else
    00078 #include <X11/Xlib.h>
    00079 #include <X11/Xutil.h>
    00080 #include "xmesa_x.h"
    00081 #endif
    00082 #include "GL/gl.h"
    00083
    00084 #ifdef AMIWIN
    00085 #include <pragmas/xlib_pragmas.h>
    00086 extern struct Library *XLibBase;
    00087 #endif
    00088
    00089
    00090 #define XMESA_MAJOR_VERSION 6
    00091 #define XMESA_MINOR_VERSION 3
    00092
    00093
    00094
    00095 /*
    00096  * Values passed to XMesaGetString:
    00097  */
    00098 #define XMESA_VERSION 1
    00099 #define XMESA_EXTENSIONS 2
    00100
    00101
    00102 /*
    00103  * Values passed to XMesaSetFXmode:
    00104  */
    00105 #define XMESA_FX_WINDOW       1
    00106 #define XMESA_FX_FULLSCREEN   2
    00107
    00108
    00109
    00110 typedef struct xmesa_context *XMesaContext;
    00111
    00112 typedef struct xmesa_visual *XMesaVisual;
    00113
    00114 typedef struct xmesa_buffer *XMesaBuffer;
    00115
    00116
    00117
    00118 /*
    00119  * Create a new X/Mesa visual.
    00120  * Input:  display - X11 display
    00121  *         visinfo - an XVisualInfo pointer
    00122  *         rgb_flag - GL_TRUE = RGB mode,
    00123  *                    GL_FALSE = color index mode
    00124  *         alpha_flag - alpha buffer requested?
    00125  *         db_flag - GL_TRUE = double-buffered,
    00126  *                   GL_FALSE = single buffered
    00127  *         stereo_flag - stereo visual?
    00128  *         ximage_flag - GL_TRUE = use an XImage for back buffer,
    00129  *                       GL_FALSE = use an off-screen pixmap for back buffer
    00130  *         depth_size - requested bits/depth values, or zero
    00131  *         stencil_size - requested bits/stencil values, or zero
    00132  *         accum_red_size - requested bits/red accum values, or zero
    00133  *         accum_green_size - requested bits/green accum values, or zero
    00134  *         accum_blue_size - requested bits/blue accum values, or zero
    00135  *         accum_alpha_size - requested bits/alpha accum values, or zero
    00136  *         num_samples - number of samples/pixel if multisampling, or zero
    00137  *         level - visual level, usually 0
    00138  *         visualCaveat - ala the GLX extension, usually GLX_NONE_EXT
    00139  * Return;  a new XMesaVisual or 0 if error.
    00140  */
    00141 extern XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
    00142                                       XMesaVisualInfo visinfo,
    00143                                       GLboolean rgb_flag,
    00144                                       GLboolean alpha_flag,
    00145                                       GLboolean db_flag,
    00146                                       GLboolean stereo_flag,
    00147                                       GLboolean ximage_flag,
    00148                                       GLint depth_size,
    00149                                       GLint stencil_size,
    00150                                       GLint accum_red_size,
    00151                                       GLint accum_green_size,
    00152                                       GLint accum_blue_size,
    00153                                       GLint accum_alpha_size,
    00154                                       GLint num_samples,
    00155                                       GLint level,
    00156                                       GLint visualCaveat );
    00157
    00158 /*
    00159  * Destroy an XMesaVisual, but not the associated XVisualInfo.
    00160  */
    00161 extern void XMesaDestroyVisual( XMesaVisual v );
    00162
    00163
    00164
    00165 /*
    00166  * Create a new XMesaContext for rendering into an X11 window.
    00167  *
    00168  * Input:  visual - an XMesaVisual
    00169  *         share_list - another XMesaContext with which to share display
    00170  *                      lists or NULL if no sharing is wanted.
    00171  * Return:  an XMesaContext or NULL if error.
    00172  */
    00173 extern XMesaContext XMesaCreateContext( XMesaVisual v,
    00174                                                        XMesaContext share_list );
    00175
    00176
    00177 /*
    00178  * Destroy a rendering context as returned by XMesaCreateContext()
    00179  */
    00180 extern void XMesaDestroyContext( XMesaContext c );
    00181
    00182
    00183 /*
    00184  * Create an XMesaBuffer from an X window.
    00185  */
    00186 extern XMesaBuffer XMesaCreateWindowBuffer( XMesaVisual v, XMesaWindow w );
    00187
    00188
    00189 /*
    00190  * Create an XMesaBuffer from an X pixmap.
    00191  */
    00192 extern XMesaBuffer XMesaCreatePixmapBuffer( XMesaVisual v,
    00193                                                            XMesaPixmap p,
    00194                                                            XMesaColormap cmap );
    00195
    00196
    00197 /*
    00198  * Destroy an XMesaBuffer, but not the corresponding window or pixmap.
    00199  */
    00200 extern void XMesaDestroyBuffer( XMesaBuffer b );
    00201
    00202
    00203 /*
    00204  * Return the XMesaBuffer handle which corresponds to an X drawable, if any.
    00205  *
    00206  * New in Mesa 2.3.
    00207  */
    00208 extern XMesaBuffer XMesaFindBuffer( XMesaDisplay *dpy,
    00209                                                 XMesaDrawable d );
    00210
    00211
    00212
    00213 /*
    00214  * Bind a buffer to a context and make the context the current one.
    00215  */
    00216 extern GLboolean XMesaMakeCurrent( XMesaContext c,
    00217                                                XMesaBuffer b );
    00218
    00219
    00220 /*
    00221  * Bind two buffers (read and draw) to a context and make the
    00222  * context the current one.
    00223  * New in Mesa 3.3
    00224  */
    00225 extern GLboolean XMesaMakeCurrent2( XMesaContext c,
    00226                                     XMesaBuffer drawBuffer,
    00227                                     XMesaBuffer readBuffer );
    00228
    00229
    00230 /*
    00231  * Unbind the current context from its buffer.
    00232  */
    00233 extern GLboolean XMesaUnbindContext( XMesaContext c );
    00234
    00235
    00236 /*
    00237  * Return a handle to the current context.
    00238  */
    00239 extern XMesaContext XMesaGetCurrentContext( void );
    00240
    00241
    00242 /*
    00243  * Return handle to the current (draw) buffer.
    00244  */
    00245 extern XMesaBuffer XMesaGetCurrentBuffer( void );
    00246
    00247
    00248 /*
    00249  * Return handle to the current read buffer.
    00250  * New in Mesa 3.3
    00251  */
    00252 extern XMesaBuffer XMesaGetCurrentReadBuffer( void );
    00253
    00254
    00255 /*
    00256  * Swap the front and back buffers for the given buffer.  No action is
    00257  * taken if the buffer is not double buffered.
    00258  */
    00259 extern void XMesaSwapBuffers( XMesaBuffer b );
    00260
    00261
    00262 /*
    00263  * Copy a sub-region of the back buffer to the front buffer.
    00264  *
    00265  * New in Mesa 2.6
    00266  */
    00267 extern void XMesaCopySubBuffer( XMesaBuffer b,
    00268                                             int x,
    00269                                             int y,
    00270                                             int width,
    00271                                             int height );
    00272
    00273
    00274 /*
    00275  * Return a pointer to the the Pixmap or XImage being used as the back
    00276  * color buffer of an XMesaBuffer.  This function is a way to get "under
    00277  * the hood" of X/Mesa so one can manipulate the back buffer directly.
    00278  * Input:  b - the XMesaBuffer
    00279  * Output:  pixmap - pointer to back buffer's Pixmap, or 0
    00280  *          ximage - pointer to back buffer's XImage, or NULL
    00281  * Return:  GL_TRUE = context is double buffered
    00282  *          GL_FALSE = context is single buffered
    00283  */
    00284 extern GLboolean XMesaGetBackBuffer( XMesaBuffer b,
    00285                                                  XMesaPixmap *pixmap,
    00286                                                  XMesaImage **ximage );
    00287
    00288
    00289
    00290 /*
    00291  * Return the depth buffer associated with an XMesaBuffer.
    00292  * Input:  b - the XMesa buffer handle
    00293  * Output:  width, height - size of buffer in pixels
    00294  *          bytesPerValue - bytes per depth value (2 or 4)
    00295  *          buffer - pointer to depth buffer values
    00296  * Return:  GL_TRUE or GL_FALSE to indicate success or failure.
    00297  *
    00298  * New in Mesa 2.4.
    00299  */
    00300 extern GLboolean XMesaGetDepthBuffer( XMesaBuffer b,
    00301                                                   GLint *width,
    00302                                                   GLint *height,
    00303                                                   GLint *bytesPerValue,
    00304                                                   void **buffer );
    00305
    00306
    00307
    00308 /*
    00309  * Flush/sync a context
    00310  */
    00311 extern void XMesaFlush( XMesaContext c );
    00312
    00313
    00314
    00315 /*
    00316  * Get an X/Mesa-specific string.
    00317  * Input:  name - either XMESA_VERSION or XMESA_EXTENSIONS
    00318  */
    00319 extern const char *XMesaGetString( XMesaContext c, int name );
    00320
    00321
    00322
    00323 /*
    00324  * Scan for XMesaBuffers whose window/pixmap has been destroyed, then free
    00325  * any memory used by that buffer.
    00326  *
    00327  * New in Mesa 2.3.
    00328  */
    00329 extern void XMesaGarbageCollect( void );
    00330
    00331
    00332
    00333 /*
    00334  * Return a dithered pixel value.
    00335  * Input:  c - XMesaContext
    00336  *         x, y - window coordinate
    00337  *         red, green, blue, alpha - color components in [0,1]
    00338  * Return:  pixel value
    00339  *
    00340  * New in Mesa 2.3.
    00341  */
    00342 extern unsigned long XMesaDitherColor( XMesaContext xmesa,
    00343                                                    GLint x,
    00344                                                    GLint y,
    00345                                                    GLfloat red,
    00346                                                    GLfloat green,
    00347                                                    GLfloat blue,
    00348                                                    GLfloat alpha );
    00349
    00350
    00351
    00352 /*
    00353  * 3Dfx Glide driver only!
    00354  * Set 3Dfx/Glide full-screen or window rendering mode.
    00355  * Input:  mode - either XMESA_FX_WINDOW (window rendering mode) or
    00356  *                XMESA_FX_FULLSCREEN (full-screen rendering mode)
    00357  * Return:  GL_TRUE if success
    00358  *          GL_FALSE if invalid mode or if not using 3Dfx driver
    00359  *
    00360  * New in Mesa 2.6.
    00361  */
    00362 extern GLboolean XMesaSetFXmode( GLint mode );
    00363
    00364
    00365
    00366 /*
    00367  * Reallocate the back/depth/stencil/accum/etc/ buffers associated with
    00368  * buffer <b> if its size has changed.
    00369  *
    00370  * New in Mesa 4.0.2
    00371  */
    00372 extern void XMesaResizeBuffers( XMesaBuffer b );
    00373
    00374
    00375
    00376 /*
    00377  * Create a pbuffer.
    00378  * New in Mesa 4.1
    00379  */
    00380 extern XMesaBuffer XMesaCreatePBuffer(XMesaVisual v, XMesaColormap cmap,
    00381                                       unsigned int width, unsigned int height);
    00382
    00383
    00384
    00385 #ifdef __cplusplus
    00386 }
    00387 #endif
    00388
    00389
    00390 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines