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.

glx.h 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /* $Id: glx.h,v 1.3 1999/09/16 15:52:51 brianp 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.3 1999/09/16 15:52:51 brianp
  28. * added GLX_MESA_set_3dfx_mode. clean-up of glXGetProcAddress
  29. *
  30. * Revision 1.2 1999/09/11 11:33:45 brianp
  31. * added GLX_EXT_get_proc_address
  32. *
  33. * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
  34. * Imported sources
  35. *
  36. * Revision 3.3 1999/02/14 03:39:09 brianp
  37. * new copyright
  38. *
  39. * Revision 3.2 1998/06/18 03:44:00 brianp
  40. * replaced "uint" with "unsigned int"
  41. *
  42. * Revision 3.1 1998/06/01 00:00:17 brianp
  43. * added GLX_SGI_video_sync extension
  44. *
  45. * Revision 3.0 1998/02/20 05:06:01 brianp
  46. * initial rev
  47. *
  48. */
  49. #ifndef GLX_H
  50. #define GLX_H
  51. /*
  52. * A pseudo-GLX implementation to allow GLX-based OpenGL programs to
  53. * work with Mesa.
  54. *
  55. * Notes:
  56. * 1. If the visual passed to glXGetConfig was not one returned by
  57. * glXChooseVisual then the GLX_RGBA and GLX_DOUBLEBUFFER queries
  58. * will always return True and the GLX_DEPTH_SIZE query will always
  59. * return non-zero.
  60. * 2. The glXIsDirect() function always returns True.
  61. */
  62. #include <X11/Xlib.h>
  63. #include <X11/Xutil.h>
  64. #include "GL/gl.h"
  65. #ifdef MESA
  66. #include "GL/xmesa.h"
  67. #endif
  68. #if defined(USE_MGL_NAMESPACE)
  69. #include "glx_mangle.h"
  70. #endif
  71. #ifdef __cplusplus
  72. extern "C" {
  73. #endif
  74. #define GLX_VERSION_1_1 1
  75. /*
  76. * Tokens for glXChooseVisual and glXGetConfig:
  77. */
  78. enum _GLX_CONFIGS {
  79. GLX_USE_GL = 1,
  80. GLX_BUFFER_SIZE = 2,
  81. GLX_LEVEL = 3,
  82. GLX_RGBA = 4,
  83. GLX_DOUBLEBUFFER = 5,
  84. GLX_STEREO = 6,
  85. GLX_AUX_BUFFERS = 7,
  86. GLX_RED_SIZE = 8,
  87. GLX_GREEN_SIZE = 9,
  88. GLX_BLUE_SIZE = 10,
  89. GLX_ALPHA_SIZE = 11,
  90. GLX_DEPTH_SIZE = 12,
  91. GLX_STENCIL_SIZE = 13,
  92. GLX_ACCUM_RED_SIZE = 14,
  93. GLX_ACCUM_GREEN_SIZE = 15,
  94. GLX_ACCUM_BLUE_SIZE = 16,
  95. GLX_ACCUM_ALPHA_SIZE = 17,
  96. /* GLX_EXT_visual_info extension */
  97. GLX_X_VISUAL_TYPE_EXT = 0x22,
  98. GLX_TRANSPARENT_TYPE_EXT = 0x23,
  99. GLX_TRANSPARENT_INDEX_VALUE_EXT = 0x24,
  100. GLX_TRANSPARENT_RED_VALUE_EXT = 0x25,
  101. GLX_TRANSPARENT_GREEN_VALUE_EXT = 0x26,
  102. GLX_TRANSPARENT_BLUE_VALUE_EXT = 0x27,
  103. GLX_TRANSPARENT_ALPHA_VALUE_EXT = 0x28
  104. };
  105. /*
  106. * Error codes returned by glXGetConfig:
  107. */
  108. #define GLX_BAD_SCREEN 1
  109. #define GLX_BAD_ATTRIBUTE 2
  110. #define GLX_NO_EXTENSION 3
  111. #define GLX_BAD_VISUAL 4
  112. #define GLX_BAD_CONTEXT 5
  113. #define GLX_BAD_VALUE 6
  114. #define GLX_BAD_ENUM 7
  115. /*
  116. * GLX 1.1 and later:
  117. */
  118. #define GLX_VENDOR 1
  119. #define GLX_VERSION 2
  120. #define GLX_EXTENSIONS 3
  121. /*
  122. * GLX_visual_info extension
  123. */
  124. #define GLX_TRUE_COLOR_EXT 0x8002
  125. #define GLX_DIRECT_COLOR_EXT 0x8003
  126. #define GLX_PSEUDO_COLOR_EXT 0x8004
  127. #define GLX_STATIC_COLOR_EXT 0x8005
  128. #define GLX_GRAY_SCALE_EXT 0x8006
  129. #define GLX_STATIC_GRAY_EXT 0x8007
  130. #define GLX_NONE_EXT 0x8000
  131. #define GLX_TRANSPARENT_RGB_EXT 0x8008
  132. #define GLX_TRANSPARENT_INDEX_EXT 0x8009
  133. /*
  134. * Compile-time extension tests
  135. */
  136. #define GLX_EXT_visual_info 1
  137. #define GLX_EXT_get_proc_address 1
  138. #define GLX_MESA_pixmap_colormap 1
  139. #define GLX_MESA_release_buffers 1
  140. #define GLX_MESA_copy_sub_buffer 1
  141. #define GLX_MESA_set_3dfx_mode 1
  142. #define GLX_SGI_video_sync 1
  143. #ifdef MESA
  144. typedef XMesaContext GLXContext;
  145. typedef Pixmap GLXPixmap;
  146. typedef Drawable GLXDrawable;
  147. #else
  148. typedef void * GLXContext;
  149. typedef XID GLXPixmap;
  150. typedef XID GLXDrawable;
  151. #endif
  152. typedef XID GLXContextID;
  153. extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
  154. int *attribList );
  155. extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis,
  156. GLXContext shareList, Bool direct );
  157. extern void glXDestroyContext( Display *dpy, GLXContext ctx );
  158. extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable,
  159. GLXContext ctx);
  160. extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst,
  161. GLuint mask );
  162. extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable );
  163. extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual,
  164. Pixmap pixmap );
  165. extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap );
  166. extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event );
  167. extern Bool glXQueryVersion( Display *dpy, int *maj, int *min );
  168. extern Bool glXIsDirect( Display *dpy, GLXContext ctx );
  169. extern int glXGetConfig( Display *dpy, XVisualInfo *visual,
  170. int attrib, int *value );
  171. extern GLXContext glXGetCurrentContext( void );
  172. extern GLXDrawable glXGetCurrentDrawable( void );
  173. extern void glXWaitGL( void );
  174. extern void glXWaitX( void );
  175. extern void glXUseXFont( Font font, int first, int count, int list );
  176. /* GLX 1.1 and later */
  177. extern const char *glXQueryExtensionsString( Display *dpy, int screen );
  178. extern const char *glXQueryServerString( Display *dpy, int screen, int name );
  179. extern const char *glXGetClientString( Display *dpy, int name );
  180. /* GLX_EXT_get_proc_address */
  181. /* WARNING: this extension is not finalized yet! Do not release code
  182. * which uses this extension yet! It may change!
  183. */
  184. extern void (*glXGetProcAddressEXT(const GLubyte *procName))();
  185. /* GLX_MESA_pixmap_colormap */
  186. extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
  187. Pixmap pixmap, Colormap cmap );
  188. /* GLX_MESA_release_buffers */
  189. extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
  190. /* GLX_MESA_copy_sub_buffer */
  191. extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
  192. int x, int y, int width, int height );
  193. /* GLX_MESA_set_3dfx_mode */
  194. extern GLboolean glXSet3DfxModeMESA( GLint mode );
  195. /* GLX_SGI_video_sync */
  196. extern int glXGetVideoSyncSGI(unsigned int *count);
  197. extern int glXWaitVideoSyncSGI(int divisor, int remainder,
  198. unsigned int *count);
  199. #ifdef __cplusplus
  200. }
  201. #endif
  202. #endif