Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /* $Id: glx.h,v 1.1 1999/08/19 00:55:40 jtg Exp $ */
  2. /*
  3. * Mesa 3-D graphics library
  4. * Version: 3.1
  5. *
  6. * Copyright (C) 1999 Brian Paul All Rights Reserved.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining a
  9. * copy of this software and associated documentation files (the "Software"),
  10. * to deal in the Software without restriction, including without limitation
  11. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  12. * and/or sell copies of the Software, and to permit persons to whom the
  13. * Software is furnished to do so, subject to the following conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be included
  16. * in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  21. * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  22. * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. */
  25. /*
  26. * $Log: glx.h,v $
  27. * Revision 1.1 1999/08/19 00:55:40 jtg
  28. * Initial revision
  29. *
  30. * Revision 3.3 1999/02/14 03:39:09 brianp
  31. * new copyright
  32. *
  33. * Revision 3.2 1998/06/18 03:44:00 brianp
  34. * replaced "uint" with "unsigned int"
  35. *
  36. * Revision 3.1 1998/06/01 00:00:17 brianp
  37. * added GLX_SGI_video_sync extension
  38. *
  39. * Revision 3.0 1998/02/20 05:06:01 brianp
  40. * initial rev
  41. *
  42. */
  43. #ifndef GLX_H
  44. #define GLX_H
  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. #include <X11/Xlib.h>
  57. #include <X11/Xutil.h>
  58. #include "GL/gl.h"
  59. #ifdef MESA
  60. #include "GL/xmesa.h"
  61. #endif
  62. #if defined(USE_MGL_NAMESPACE)
  63. #include "glx_mangle.h"
  64. #endif
  65. #ifdef __cplusplus
  66. extern "C" {
  67. #endif
  68. #define GLX_VERSION_1_1 1
  69. /*
  70. * Tokens for glXChooseVisual and glXGetConfig:
  71. */
  72. enum _GLX_CONFIGS {
  73. GLX_USE_GL = 1,
  74. GLX_BUFFER_SIZE = 2,
  75. GLX_LEVEL = 3,
  76. GLX_RGBA = 4,
  77. GLX_DOUBLEBUFFER = 5,
  78. GLX_STEREO = 6,
  79. GLX_AUX_BUFFERS = 7,
  80. GLX_RED_SIZE = 8,
  81. GLX_GREEN_SIZE = 9,
  82. GLX_BLUE_SIZE = 10,
  83. GLX_ALPHA_SIZE = 11,
  84. GLX_DEPTH_SIZE = 12,
  85. GLX_STENCIL_SIZE = 13,
  86. GLX_ACCUM_RED_SIZE = 14,
  87. GLX_ACCUM_GREEN_SIZE = 15,
  88. GLX_ACCUM_BLUE_SIZE = 16,
  89. GLX_ACCUM_ALPHA_SIZE = 17,
  90. /* GLX_EXT_visual_info extension */
  91. GLX_X_VISUAL_TYPE_EXT = 0x22,
  92. GLX_TRANSPARENT_TYPE_EXT = 0x23,
  93. GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24,
  94. GLX_TRANSPARENT_RED_VALUE_EXT = 0x25,
  95. GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26,
  96. GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27,
  97. GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28
  98. };
  99. /*
  100. * Error codes returned by glXGetConfig:
  101. */
  102. #define GLX_BAD_SCREEN 1
  103. #define GLX_BAD_ATTRIBUTE 2
  104. #define GLX_NO_EXTENSION 3
  105. #define GLX_BAD_VISUAL 4
  106. #define GLX_BAD_CONTEXT 5
  107. #define GLX_BAD_VALUE 6
  108. #define GLX_BAD_ENUM 7
  109. /*
  110. * GLX 1.1 and later:
  111. */
  112. #define GLX_VENDOR 1
  113. #define GLX_VERSION 2
  114. #define GLX_EXTENSIONS 3
  115. /*
  116. * GLX_visual_info extension
  117. */
  118. #define GLX_TRUE_COLOR_EXT 0x8002
  119. #define GLX_DIRECT_COLOR_EXT 0x8003
  120. #define GLX_PSEUDO_COLOR_EXT 0x8004
  121. #define GLX_STATIC_COLOR_EXT 0x8005
  122. #define GLX_GRAY_SCALE_EXT 0x8006
  123. #define GLX_STATIC_GRAY_EXT 0x8007
  124. #define GLX_NONE_EXT 0x8000
  125. #define GLX_TRANSPARENT_RGB_EXT 0x8008
  126. #define GLX_TRANSPARENT_INDEX_EXT 0x8009
  127. /*
  128. * Compile-time extension tests
  129. */
  130. #ifdef MESA
  131. #define GLX_EXT_visual_info 1
  132. #define GLX_MESA_pixmap_colormap 1
  133. #define GLX_MESA_release_buffers 1
  134. #define GLX_MESA_copy_sub_buffer 1
  135. #define GLX_SGI_video_sync 1
  136. #endif
  137. #ifdef MESA
  138. typedef XMesaContext GLXContext;
  139. typedef Pixmap GLXPixmap;
  140. typedef Drawable GLXDrawable;
  141. #else
  142. typedef void * GLXContext;
  143. typedef XID GLXPixmap;
  144. typedef XID GLXDrawable;
  145. #endif
  146. typedef XID GLXContextID;
  147. extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
  148. int *attribList );
  149. extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
  150. GLXContext shareList, Bool direct );
  151. extern void glXDestroyContext( Display *dpy, GLXContext ctx );
  152. extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
  153. GLXContext ctx);
  154. extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
  155. GLuint mask );
  156. extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
  157. extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
  158. Pixmap pixmap );
  159. extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
  160. extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
  161. extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
  162. extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
  163. extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
  164. int attrib, int *value );
  165. extern GLXContext glXGetCurrentContext( void );
  166. extern GLXDrawable glXGetCurrentDrawable( void );
  167. extern void glXWaitGL( void );
  168. extern void glXWaitX( void );
  169. extern void glXUseXFont( Font font, int first, int count, int list );
  170. /* GLX 1.1 and later */
  171. extern const char *glXQueryExtensionsString( Display *dpy, int screen );
  172. extern const char *glXQueryServerString( Display *dpy, int screen, int name );
  173. extern const char *glXGetClientString( Display *dpy, int name );
  174. /*
  175. * Mesa GLX Extensions
  176. */
  177. #ifdef GLX_MESA_pixmap_colormap
  178. extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
  179. Pixmap pixmap, Colormap cmap );
  180. #endif
  181. #ifdef GLX_MESA_release_buffers
  182. extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
  183. #endif
  184. #ifdef GLX_MESA_copy_sub_buffer
  185. extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
  186. int x, int y, int width, int height );
  187. #endif
  188. #ifdef GLX_SGI_video_sync
  189. extern int glXGetVideoSyncSGI(unsigned int *count);
  190. extern int glXWaitVideoSyncSGI(int divisor, int remainder,
  191. unsigned int *count);
  192. #endif
  193. #ifdef __cplusplus
  194. }
  195. #endif
  196. #endif