1 | /* $Id: osmesa.h,v 1.2 2000-05-23 20:41:28 jeroen Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Mesa 3-D graphics library
|
---|
5 | * Version: 3.3
|
---|
6 | *
|
---|
7 | * Copyright (C) 1999 Brian Paul All Rights Reserved.
|
---|
8 | *
|
---|
9 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
10 | * copy of this software and associated documentation files (the "Software"),
|
---|
11 | * to deal in the Software without restriction, including without limitation
|
---|
12 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
13 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following conditions:
|
---|
15 | *
|
---|
16 | * The above copyright notice and this permission notice shall be included
|
---|
17 | * in all copies or substantial portions of the Software.
|
---|
18 | *
|
---|
19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
---|
20 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
22 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
23 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
24 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
25 | */
|
---|
26 |
|
---|
27 |
|
---|
28 | /*
|
---|
29 | * $Log: osmesa.h,v $
|
---|
30 | * Revision 1.2 2000-05-23 20:41:28 jeroen
|
---|
31 | * *** empty log message ***
|
---|
32 | *
|
---|
33 | * Revision 1.1 2000/02/29 00:43:33 sandervl
|
---|
34 | * created
|
---|
35 | *
|
---|
36 | * Revision 1.1.1.1.2.1 1999/11/24 18:39:17 brianp
|
---|
37 | * bumped version to 3.1
|
---|
38 | *
|
---|
39 | * Revision 1.1.1.1 1999/08/19 00:55:40 jtg
|
---|
40 | * Imported sources
|
---|
41 | *
|
---|
42 | * Revision 1.4 1999/02/14 03:39:09 brianp
|
---|
43 | * new copyright
|
---|
44 | *
|
---|
45 | * Revision 1.3 1999/01/03 02:52:30 brianp
|
---|
46 | * now using GLAPI and GLAPIENTRY keywords (Ted Jump)
|
---|
47 | *
|
---|
48 | * Revision 1.2 1998/07/26 01:33:51 brianp
|
---|
49 | * added WINGDIAPI and APIENTRY keywords per Ted Jump
|
---|
50 | *
|
---|
51 | * Revision 1.1 1998/02/13 03:17:50 brianp
|
---|
52 | * Initial revision
|
---|
53 | *
|
---|
54 | */
|
---|
55 |
|
---|
56 |
|
---|
57 | /*
|
---|
58 | * Mesa Off-Screen rendering interface.
|
---|
59 | *
|
---|
60 | * This is an operating system and window system independent interface to
|
---|
61 | * Mesa which allows one to render images into a client-supplied buffer in
|
---|
62 | * main memory. Such images may manipulated or saved in whatever way the
|
---|
63 | * client wants.
|
---|
64 | *
|
---|
65 | * These are the API functions:
|
---|
66 | * OSMesaCreateContext - create a new Off-Screen Mesa rendering context
|
---|
67 | * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer
|
---|
68 | * and make the specified context the current one.
|
---|
69 | * OSMesaDestroyContext - destroy an OSMesaContext
|
---|
70 | * OSMesaGetCurrentContext - return thread's current context ID
|
---|
71 | * OSMesaPixelStore - controls how pixels are stored in image buffer
|
---|
72 | * OSMesaGetIntegerv - return OSMesa state parameters
|
---|
73 | *
|
---|
74 | *
|
---|
75 | * The limits on the width and height of an image buffer are MAX_WIDTH and
|
---|
76 | * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024.
|
---|
77 | * You can increase them as needed but beware that many temporary arrays in
|
---|
78 | * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT.
|
---|
79 | */
|
---|
80 |
|
---|
81 |
|
---|
82 |
|
---|
83 | #ifndef OSMESA_H
|
---|
84 | #define OSMESA_H
|
---|
85 |
|
---|
86 |
|
---|
87 |
|
---|
88 | #ifdef __cplusplus
|
---|
89 | extern "C" {
|
---|
90 | #endif
|
---|
91 |
|
---|
92 |
|
---|
93 | #include "GL/gl.h"
|
---|
94 |
|
---|
95 |
|
---|
96 |
|
---|
97 | #define OSMESA_MAJOR_VERSION 3
|
---|
98 | #define OSMESA_MINOR_VERSION 3
|
---|
99 |
|
---|
100 |
|
---|
101 |
|
---|
102 | /*
|
---|
103 | * Values for the format parameter of OSMesaCreateContext()
|
---|
104 | * New in version 2.0.
|
---|
105 | */
|
---|
106 | #define OSMESA_COLOR_INDEX GL_COLOR_INDEX
|
---|
107 | #define OSMESA_RGBA GL_RGBA
|
---|
108 | #define OSMESA_BGRA 0x1
|
---|
109 | #define OSMESA_ARGB 0x2
|
---|
110 | #define OSMESA_RGB GL_RGB
|
---|
111 | #define OSMESA_BGR 0x4
|
---|
112 |
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * OSMesaPixelStore() parameters:
|
---|
116 | * New in version 2.0.
|
---|
117 | */
|
---|
118 | #define OSMESA_ROW_LENGTH 0x10
|
---|
119 | #define OSMESA_Y_UP 0x11
|
---|
120 |
|
---|
121 |
|
---|
122 | /*
|
---|
123 | * Accepted by OSMesaGetIntegerv:
|
---|
124 | */
|
---|
125 | #define OSMESA_WIDTH 0x20
|
---|
126 | #define OSMESA_HEIGHT 0x21
|
---|
127 | #define OSMESA_FORMAT 0x22
|
---|
128 | #define OSMESA_TYPE 0x23
|
---|
129 |
|
---|
130 |
|
---|
131 |
|
---|
132 | /*
|
---|
133 | * Accepted by OSMesaGetBooleanv:
|
---|
134 | * New in version 3.3
|
---|
135 | */
|
---|
136 | /* This is based on the HP proposed extension */
|
---|
137 | #define OSMESA_OCCLUSION_TEST_RESULT_HP 0x30
|
---|
138 |
|
---|
139 |
|
---|
140 |
|
---|
141 | typedef struct osmesa_context *OSMesaContext;
|
---|
142 |
|
---|
143 |
|
---|
144 | #if defined(__BEOS__) || defined(__QUICKDRAW__)
|
---|
145 | #pragma export on
|
---|
146 | #endif
|
---|
147 |
|
---|
148 |
|
---|
149 | /*
|
---|
150 | * Create an Off-Screen Mesa rendering context. The only attribute needed is
|
---|
151 | * an RGBA vs Color-Index mode flag.
|
---|
152 | *
|
---|
153 | * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA,
|
---|
154 | * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR.
|
---|
155 | * sharelist - specifies another OSMesaContext with which to share
|
---|
156 | * display lists. NULL indicates no sharing.
|
---|
157 | * Return: an OSMesaContext or 0 if error
|
---|
158 | */
|
---|
159 | GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format,
|
---|
160 | OSMesaContext sharelist );
|
---|
161 |
|
---|
162 |
|
---|
163 |
|
---|
164 |
|
---|
165 | /*
|
---|
166 | * Destroy an Off-Screen Mesa rendering context.
|
---|
167 | *
|
---|
168 | * Input: ctx - the context to destroy
|
---|
169 | */
|
---|
170 | GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
|
---|
171 |
|
---|
172 |
|
---|
173 |
|
---|
174 | /*
|
---|
175 | * Bind an OSMesaContext to an image buffer. The image buffer is just a
|
---|
176 | * block of memory which the client provides. Its size must be at least
|
---|
177 | * as large as width*height*sizeof(type). Its address should be a multiple
|
---|
178 | * of 4 if using RGBA mode.
|
---|
179 | *
|
---|
180 | * Image data is stored in the order of glDrawPixels: row-major order
|
---|
181 | * with the lower-left image pixel stored in the first array position
|
---|
182 | * (ie. bottom-to-top).
|
---|
183 | *
|
---|
184 | * Since the only type initially supported is GL_UNSIGNED_BYTE, if the
|
---|
185 | * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
|
---|
186 | * value. If the context is in color indexed mode, each pixel will be
|
---|
187 | * stored as a 1-byte value.
|
---|
188 | *
|
---|
189 | * If the context's viewport hasn't been initialized yet, it will now be
|
---|
190 | * initialized to (0,0,width,height).
|
---|
191 | *
|
---|
192 | * Input: ctx - the rendering context
|
---|
193 | * buffer - the image buffer memory
|
---|
194 | * type - data type for pixel components, only GL_UNSIGNED_BYTE
|
---|
195 | * supported now
|
---|
196 | * width, height - size of image buffer in pixels, at least 1
|
---|
197 | * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx,
|
---|
198 | * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
|
---|
199 | * width>internal limit or height>internal limit.
|
---|
200 | */
|
---|
201 | GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
|
---|
202 | void *buffer, GLenum type,
|
---|
203 | GLsizei width, GLsizei height );
|
---|
204 |
|
---|
205 |
|
---|
206 |
|
---|
207 |
|
---|
208 | /*
|
---|
209 | * Return the current Off-Screen Mesa rendering context handle.
|
---|
210 | */
|
---|
211 | GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void );
|
---|
212 |
|
---|
213 |
|
---|
214 |
|
---|
215 | /*
|
---|
216 | * Set pixel store/packing parameters for the current context.
|
---|
217 | * This is similar to glPixelStore.
|
---|
218 | * Input: pname - OSMESA_ROW_LENGTH
|
---|
219 | * specify actual pixels per row in image buffer
|
---|
220 | * 0 = same as image width (default)
|
---|
221 | * OSMESA_Y_UP
|
---|
222 | * zero = Y coordinates increase downward
|
---|
223 | * non-zero = Y coordinates increase upward (default)
|
---|
224 | * value - the value for the parameter pname
|
---|
225 | *
|
---|
226 | * New in version 2.0.
|
---|
227 | */
|
---|
228 | GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
|
---|
229 |
|
---|
230 |
|
---|
231 |
|
---|
232 | /*
|
---|
233 | * Return context info. This is like glGetIntegerv.
|
---|
234 | * Input: pname -
|
---|
235 | * OSMESA_WIDTH return current image width
|
---|
236 | * OSMESA_HEIGHT return current image height
|
---|
237 | * OSMESA_FORMAT return image format
|
---|
238 | * OSMESA_TYPE return color component data type
|
---|
239 | * OSMESA_ROW_LENGTH return row length in pixels
|
---|
240 | * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
|
---|
241 | * value - pointer to integer in which to return result.
|
---|
242 | */
|
---|
243 | GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value );
|
---|
244 |
|
---|
245 |
|
---|
246 |
|
---|
247 | /*
|
---|
248 | * Return a boolean value like glGetBooleanv.
|
---|
249 | * Input: pname -
|
---|
250 | * OSMESA_OCCLUSION_TEST_RESULT_HP return current test result
|
---|
251 | * value - pointer to boolean in which to return result.
|
---|
252 | */
|
---|
253 | GLAPI void GLAPIENTRY OSMesaGetBooleanv( GLint pname, GLboolean *value );
|
---|
254 |
|
---|
255 |
|
---|
256 |
|
---|
257 | /*
|
---|
258 | * Return the depth buffer associated with an OSMesa context.
|
---|
259 | * Input: c - the OSMesa context
|
---|
260 | * Output: width, height - size of buffer in pixels
|
---|
261 | * bytesPerValue - bytes per depth value (2 or 4)
|
---|
262 | * buffer - pointer to depth buffer values
|
---|
263 | * Return: GL_TRUE or GL_FALSE to indicate success or failure.
|
---|
264 | *
|
---|
265 | * New in Mesa 2.4.
|
---|
266 | */
|
---|
267 | GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c,
|
---|
268 | GLint *width, GLint *height,
|
---|
269 | GLint *bytesPerValue, void **buffer );
|
---|
270 |
|
---|
271 |
|
---|
272 |
|
---|
273 |
|
---|
274 | #if defined(__BEOS__) || defined(__QUICKDRAW__)
|
---|
275 | #pragma export off
|
---|
276 | #endif
|
---|
277 |
|
---|
278 |
|
---|
279 | #ifdef __cplusplus
|
---|
280 | }
|
---|
281 | #endif
|
---|
282 |
|
---|
283 |
|
---|
284 | #endif
|
---|