Clone of mesa.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /* $Id: osmesa.h,v 1.5 2000/03/28 16:59:39 rjfrank Exp $ */
  2. /*
  3. * Mesa 3-D graphics library
  4. * Version: 3.3
  5. *
  6. * Copyright (C) 1999-2000 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. * Mesa Off-Screen rendering interface.
  27. *
  28. * This is an operating system and window system independent interface to
  29. * Mesa which allows one to render images into a client-supplied buffer in
  30. * main memory. Such images may manipulated or saved in whatever way the
  31. * client wants.
  32. *
  33. * These are the API functions:
  34. * OSMesaCreateContext - create a new Off-Screen Mesa rendering context
  35. * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer
  36. * and make the specified context the current one.
  37. * OSMesaDestroyContext - destroy an OSMesaContext
  38. * OSMesaGetCurrentContext - return thread's current context ID
  39. * OSMesaPixelStore - controls how pixels are stored in image buffer
  40. * OSMesaGetIntegerv - return OSMesa state parameters
  41. *
  42. *
  43. * The limits on the width and height of an image buffer are MAX_WIDTH and
  44. * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024.
  45. * You can increase them as needed but beware that many temporary arrays in
  46. * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT.
  47. */
  48. #ifndef OSMESA_H
  49. #define OSMESA_H
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53. #include "GL/gl.h"
  54. #define OSMESA_MAJOR_VERSION 3
  55. #define OSMESA_MINOR_VERSION 3
  56. /*
  57. * Values for the format parameter of OSMesaCreateContext()
  58. * New in version 2.0.
  59. */
  60. #define OSMESA_COLOR_INDEX GL_COLOR_INDEX
  61. #define OSMESA_RGBA GL_RGBA
  62. #define OSMESA_BGRA 0x1
  63. #define OSMESA_ARGB 0x2
  64. #define OSMESA_RGB GL_RGB
  65. #define OSMESA_BGR 0x4
  66. /*
  67. * OSMesaPixelStore() parameters:
  68. * New in version 2.0.
  69. */
  70. #define OSMESA_ROW_LENGTH 0x10
  71. #define OSMESA_Y_UP 0x11
  72. /*
  73. * Accepted by OSMesaGetIntegerv:
  74. */
  75. #define OSMESA_WIDTH 0x20
  76. #define OSMESA_HEIGHT 0x21
  77. #define OSMESA_FORMAT 0x22
  78. #define OSMESA_TYPE 0x23
  79. typedef struct osmesa_context *OSMesaContext;
  80. #if defined(__BEOS__) || defined(__QUICKDRAW__)
  81. #pragma export on
  82. #endif
  83. /*
  84. * Create an Off-Screen Mesa rendering context. The only attribute needed is
  85. * an RGBA vs Color-Index mode flag.
  86. *
  87. * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA,
  88. * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR.
  89. * sharelist - specifies another OSMesaContext with which to share
  90. * display lists. NULL indicates no sharing.
  91. * Return: an OSMesaContext or 0 if error
  92. */
  93. GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format,
  94. OSMesaContext sharelist );
  95. /*
  96. * Destroy an Off-Screen Mesa rendering context.
  97. *
  98. * Input: ctx - the context to destroy
  99. */
  100. GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
  101. /*
  102. * Bind an OSMesaContext to an image buffer. The image buffer is just a
  103. * block of memory which the client provides. Its size must be at least
  104. * as large as width*height*sizeof(type). Its address should be a multiple
  105. * of 4 if using RGBA mode.
  106. *
  107. * Image data is stored in the order of glDrawPixels: row-major order
  108. * with the lower-left image pixel stored in the first array position
  109. * (ie. bottom-to-top).
  110. *
  111. * Since the only type initially supported is GL_UNSIGNED_BYTE, if the
  112. * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
  113. * value. If the context is in color indexed mode, each pixel will be
  114. * stored as a 1-byte value.
  115. *
  116. * If the context's viewport hasn't been initialized yet, it will now be
  117. * initialized to (0,0,width,height).
  118. *
  119. * Input: ctx - the rendering context
  120. * buffer - the image buffer memory
  121. * type - data type for pixel components, only GL_UNSIGNED_BYTE
  122. * supported now
  123. * width, height - size of image buffer in pixels, at least 1
  124. * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx,
  125. * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
  126. * width>internal limit or height>internal limit.
  127. */
  128. GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
  129. void *buffer, GLenum type,
  130. GLsizei width, GLsizei height );
  131. /*
  132. * Return the current Off-Screen Mesa rendering context handle.
  133. */
  134. GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void );
  135. /*
  136. * Set pixel store/packing parameters for the current context.
  137. * This is similar to glPixelStore.
  138. * Input: pname - OSMESA_ROW_LENGTH
  139. * specify actual pixels per row in image buffer
  140. * 0 = same as image width (default)
  141. * OSMESA_Y_UP
  142. * zero = Y coordinates increase downward
  143. * non-zero = Y coordinates increase upward (default)
  144. * value - the value for the parameter pname
  145. *
  146. * New in version 2.0.
  147. */
  148. GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
  149. /*
  150. * Return an integer value like glGetIntegerv.
  151. * Input: pname -
  152. * OSMESA_WIDTH return current image width
  153. * OSMESA_HEIGHT return current image height
  154. * OSMESA_FORMAT return image format
  155. * OSMESA_TYPE return color component data type
  156. * OSMESA_ROW_LENGTH return row length in pixels
  157. * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
  158. * value - pointer to integer in which to return result.
  159. */
  160. GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value );
  161. /*
  162. * Return the depth buffer associated with an OSMesa context.
  163. * Input: c - the OSMesa context
  164. * Output: width, height - size of buffer in pixels
  165. * bytesPerValue - bytes per depth value (2 or 4)
  166. * buffer - pointer to depth buffer values
  167. * Return: GL_TRUE or GL_FALSE to indicate success or failure.
  168. *
  169. * New in Mesa 2.4.
  170. */
  171. GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c,
  172. GLint *width, GLint *height,
  173. GLint *bytesPerValue,
  174. void **buffer );
  175. /*
  176. * Return the color buffer associated with an OSMesa context.
  177. * Input: c - the OSMesa context
  178. * Output: width, height - size of buffer in pixels
  179. * format - buffer format (OSMESA_FORMAT)
  180. * buffer - pointer to depth buffer values
  181. * Return: GL_TRUE or GL_FALSE to indicate success or failure.
  182. *
  183. * New in Mesa 3.3.
  184. */
  185. GLAPI GLboolean GLAPIENTRY OSMesaGetColorBuffer( OSMesaContext c,
  186. GLint *width, GLint *height,
  187. GLint *format,
  188. void **buffer );
  189. #if defined(__BEOS__) || defined(__QUICKDRAW__)
  190. #pragma export off
  191. #endif
  192. #ifdef __cplusplus
  193. }
  194. #endif
  195. #endif