home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 5 / MA_Cover_5.iso / ppc / mesa / include / gl / glx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-01-31  |  5.5 KB  |  242 lines

  1. /* $Id: glx.h,v 1.4 1997/08/19 02:34:08 brianp Exp $ */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  2.4
  6.  * Copyright (C) 1995-1997  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: glx.h,v $
  26.  * Revision 1.4  1997/08/19 02:34:08  brianp
  27.  * changed Window parameter to GLXDrawable in glXReleaseBuffersMESA()
  28.  *
  29.  * Revision 1.3  1997/02/03 19:15:42  brianp
  30.  * conditionally include glx_mangle.h
  31.  *
  32.  * Revision 1.2  1996/09/19 03:50:42  brianp
  33.  * added glXReleaseBuffersMESA(), GLX_MESA_release_buffers extension
  34.  *
  35.  * Revision 1.1  1996/09/13 01:26:41  brianp
  36.  * Initial revision
  37.  *
  38.  */
  39.  
  40.  
  41. #ifndef GLX_H
  42. #define GLX_H
  43.  
  44.  
  45. /*
  46.  * A pseudo-GLX implementation to allow GLX-based OpenGL programs to
  47.  * work with Mesa.
  48.  *
  49.  * Notes:
  50.  *   1. If the visual passed to glXGetConfig was not one returned by
  51.  *      glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
  52.  *      will always return True and the GLX_DEPTH_SIZE query will always
  53.  *      return non-zero.
  54.  *   2. The glXIsDirect() function always returns True.
  55.  */
  56.  
  57.  
  58.  
  59. #include <X11/Xlib.h>
  60. #include <X11/Xutil.h>
  61. #include "GL/gl.h"
  62. #ifdef MESA
  63. #include "GL/xmesa.h"
  64. #endif
  65.  
  66.  
  67. #if defined(USE_MGL_NAMESPACE)
  68. #include "glx_mangle.h"
  69. #endif
  70.  
  71.  
  72. #ifdef __cplusplus
  73. extern "C" {
  74. #endif
  75.  
  76.  
  77. #define GLX_VERSION_1_1        1
  78.  
  79.  
  80. /*
  81.  * Tokens for glXChooseVisual and glXGetConfig:
  82.  */
  83. enum _GLX_CONFIGS {
  84.     GLX_USE_GL        = 1,
  85.     GLX_BUFFER_SIZE        = 2,
  86.     GLX_LEVEL        = 3,
  87.     GLX_RGBA        = 4,
  88.     GLX_DOUBLEBUFFER    = 5, 
  89.     GLX_STEREO        = 6,
  90.     GLX_AUX_BUFFERS        = 7,
  91.     GLX_RED_SIZE        = 8,
  92.     GLX_GREEN_SIZE        = 9,
  93.     GLX_BLUE_SIZE        = 10,
  94.     GLX_ALPHA_SIZE        = 11,
  95.     GLX_DEPTH_SIZE        = 12,
  96.     GLX_STENCIL_SIZE    = 13,
  97.     GLX_ACCUM_RED_SIZE    = 14,
  98.     GLX_ACCUM_GREEN_SIZE    = 15,
  99.     GLX_ACCUM_BLUE_SIZE    = 16,
  100.     GLX_ACCUM_ALPHA_SIZE    = 17,
  101.  
  102.     /* GLX_EXT_visual_info extension */
  103.     GLX_X_VISUAL_TYPE_EXT        = 0x22,
  104.     GLX_TRANSPARENT_TYPE_EXT    = 0x23,
  105.     GLX_TRANSPARENT_INDEX_VALUE_EXT    = 0x24,
  106.     GLX_TRANSPARENT_RED_VALUE_EXT    = 0x25,
  107.     GLX_TRANSPARENT_GREEN_VALUE_EXT    = 0x26,
  108.     GLX_TRANSPARENT_BLUE_VALUE_EXT    = 0x27,
  109.     GLX_TRANSPARENT_ALPHA_VALUE_EXT    = 0x28
  110. };
  111.  
  112.  
  113. /*
  114.  * Error codes returned by glXGetConfig:
  115.  */
  116. #define GLX_BAD_SCREEN        1
  117. #define GLX_BAD_ATTRIBUTE    2
  118. #define GLX_NO_EXTENSION    3
  119. #define GLX_BAD_VISUAL        4
  120. #define GLX_BAD_CONTEXT        5
  121. #define GLX_BAD_VALUE           6
  122. #define GLX_BAD_ENUM        7
  123.  
  124.  
  125. /*
  126.  * GLX 1.1 and later:
  127.  */
  128. #define GLX_VENDOR        1
  129. #define GLX_VERSION        2
  130. #define GLX_EXTENSIONS         3
  131.  
  132.  
  133. /*
  134.  * GLX_visual_info extension
  135.  */
  136. #define GLX_TRUE_COLOR_EXT        0x8002
  137. #define GLX_DIRECT_COLOR_EXT        0x8003
  138. #define GLX_PSEUDO_COLOR_EXT        0x8004
  139. #define GLX_STATIC_COLOR_EXT        0x8005
  140. #define GLX_GRAY_SCALE_EXT        0x8006
  141. #define GLX_STATIC_GRAY_EXT        0x8007
  142. #define GLX_NONE_EXT            0x8000
  143. #define GLX_TRANSPARENT_RGB_EXT        0x8008
  144. #define GLX_TRANSPARENT_INDEX_EXT    0x8009
  145.  
  146.  
  147. /*
  148.  * Compile-time extension tests
  149.  */
  150. #ifdef MESA
  151. #define GLX_EXT_visual_info        1
  152. #define GLX_MESA_pixmap_colormap    1
  153. #define GLX_MESA_release_buffers    1
  154. #endif
  155.  
  156.  
  157.  
  158. #ifdef MESA
  159.    typedef XMesaContext GLXContext;
  160.    typedef Pixmap GLXPixmap;
  161.    typedef Drawable GLXDrawable;
  162. #else
  163.    typedef void * GLXContext;
  164.    typedef XID GLXPixmap;
  165.    typedef XID GLXDrawable;
  166. #endif
  167. typedef XID GLXContextID;
  168.  
  169.  
  170.  
  171. extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
  172.                      int *attribList );
  173.  
  174. extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
  175.                     GLXContext shareList, Bool direct );
  176.  
  177. extern void glXDestroyContext( Display *dpy, GLXContext ctx );
  178.  
  179. extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
  180.                 GLXContext ctx);
  181.  
  182. extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
  183.                 GLuint mask );
  184.  
  185. extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
  186.  
  187. extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
  188.                      Pixmap pixmap );
  189.  
  190. extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
  191.  
  192. extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
  193.  
  194. extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
  195.  
  196. extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
  197.  
  198. extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
  199.              int attrib, int *value );
  200.  
  201. extern GLXContext glXGetCurrentContext( void );
  202.  
  203. extern GLXDrawable glXGetCurrentDrawable( void );
  204.  
  205. extern void glXWaitGL( void );
  206.  
  207. extern void glXWaitX( void );
  208.  
  209. extern void glXUseXFont( Font font, int first, int count, int list );
  210.  
  211.  
  212.  
  213. /* GLX 1.1 and later */
  214. extern const char *glXQueryExtensionsString( Display *dpy, int screen );
  215.  
  216. extern const char *glXQueryServerString( Display *dpy, int screen, int name );
  217.  
  218. extern const char *glXGetClientString( Display *dpy, int name );
  219.  
  220.  
  221.  
  222. /*
  223.  * Mesa GLX Extensions
  224.  */
  225.  
  226. #ifdef GLX_MESA_pixmap_colormap
  227. extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
  228.                                          Pixmap pixmap, Colormap cmap );
  229. #endif
  230.  
  231. #ifdef GLX_MESA_release_buffers
  232. extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
  233. #endif
  234.  
  235.  
  236.  
  237. #ifdef __cplusplus
  238. }
  239. #endif
  240.  
  241. #endif
  242.