Clone of mesa.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

osmesa.h 7.7KB

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