123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- /*
- * Mesa 3-D graphics library
- * Version: 4.1
- *
- * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
- /*
- * Mesa Off-Screen rendering interface.
- *
- * This is an operating system and window system independent interface to
- * Mesa which allows one to render images into a client-supplied buffer in
- * main memory. Such images may manipulated or saved in whatever way the
- * client wants.
- *
- * These are the API functions:
- * OSMesaCreateContext - create a new Off-Screen Mesa rendering context
- * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer
- * and make the specified context the current one.
- * OSMesaDestroyContext - destroy an OSMesaContext
- * OSMesaGetCurrentContext - return thread's current context ID
- * OSMesaPixelStore - controls how pixels are stored in image buffer
- * OSMesaGetIntegerv - return OSMesa state parameters
- *
- *
- * The limits on the width and height of an image buffer are MAX_WIDTH and
- * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024.
- * You can increase them as needed but beware that many temporary arrays in
- * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT.
- */
-
-
- #ifndef OSMESA_H
- #define OSMESA_H
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
-
- #include <GL/gl.h>
-
-
- #define OSMESA_MAJOR_VERSION 4
- #define OSMESA_MINOR_VERSION 1
- #define OSMESA_PATCH_VERSION 0
-
-
-
- /*
- * Values for the format parameter of OSMesaCreateContext()
- * New in version 2.0.
- */
- #define OSMESA_COLOR_INDEX GL_COLOR_INDEX
- #define OSMESA_RGBA GL_RGBA
- #define OSMESA_BGRA 0x1
- #define OSMESA_ARGB 0x2
- #define OSMESA_RGB GL_RGB
- #define OSMESA_BGR 0x4
- #define OSMESA_RGB_565 0x5
-
-
- /*
- * OSMesaPixelStore() parameters:
- * New in version 2.0.
- */
- #define OSMESA_ROW_LENGTH 0x10
- #define OSMESA_Y_UP 0x11
-
-
- /*
- * Accepted by OSMesaGetIntegerv:
- */
- #define OSMESA_WIDTH 0x20
- #define OSMESA_HEIGHT 0x21
- #define OSMESA_FORMAT 0x22
- #define OSMESA_TYPE 0x23
- #define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */
- #define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */
-
-
- typedef struct osmesa_context *OSMesaContext;
-
-
- #if defined(__BEOS__) || defined(__QUICKDRAW__)
- #pragma export on
- #endif
-
-
- /*
- * Create an Off-Screen Mesa rendering context. The only attribute needed is
- * an RGBA vs Color-Index mode flag.
- *
- * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA,
- * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR.
- * sharelist - specifies another OSMesaContext with which to share
- * display lists. NULL indicates no sharing.
- * Return: an OSMesaContext or 0 if error
- */
- GLAPI OSMesaContext GLAPIENTRY
- OSMesaCreateContext( GLenum format, OSMesaContext sharelist );
-
-
-
- /*
- * Create an Off-Screen Mesa rendering context and specify desired
- * size of depth buffer, stencil buffer and accumulation buffer.
- * If you specify zero for depthBits, stencilBits, accumBits you
- * can save some memory.
- *
- * New in Mesa 3.5
- */
- GLAPI OSMesaContext GLAPIENTRY
- OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
- GLint accumBits, OSMesaContext sharelist);
-
-
- /*
- * Destroy an Off-Screen Mesa rendering context.
- *
- * Input: ctx - the context to destroy
- */
- GLAPI void GLAPIENTRY
- OSMesaDestroyContext( OSMesaContext ctx );
-
-
-
- /*
- * Bind an OSMesaContext to an image buffer. The image buffer is just a
- * block of memory which the client provides. Its size must be at least
- * as large as width*height*sizeof(type). Its address should be a multiple
- * of 4 if using RGBA mode.
- *
- * Image data is stored in the order of glDrawPixels: row-major order
- * with the lower-left image pixel stored in the first array position
- * (ie. bottom-to-top).
- *
- * Since the only type initially supported is GL_UNSIGNED_BYTE, if the
- * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
- * value. If the context is in color indexed mode, each pixel will be
- * stored as a 1-byte value.
- *
- * If the context's viewport hasn't been initialized yet, it will now be
- * initialized to (0,0,width,height).
- *
- * Input: ctx - the rendering context
- * buffer - the image buffer memory
- * type - data type for pixel components, only GL_UNSIGNED_BYTE
- * supported now
- * width, height - size of image buffer in pixels, at least 1
- * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx,
- * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
- * width>internal limit or height>internal limit.
- */
- GLAPI GLboolean GLAPIENTRY
- OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
- GLsizei width, GLsizei height );
-
-
-
-
- /*
- * Return the current Off-Screen Mesa rendering context handle.
- */
- GLAPI OSMesaContext GLAPIENTRY
- OSMesaGetCurrentContext( void );
-
-
-
- /*
- * Set pixel store/packing parameters for the current context.
- * This is similar to glPixelStore.
- * Input: pname - OSMESA_ROW_LENGTH
- * specify actual pixels per row in image buffer
- * 0 = same as image width (default)
- * OSMESA_Y_UP
- * zero = Y coordinates increase downward
- * non-zero = Y coordinates increase upward (default)
- * value - the value for the parameter pname
- *
- * New in version 2.0.
- */
- GLAPI void GLAPIENTRY
- OSMesaPixelStore( GLint pname, GLint value );
-
-
-
- /*
- * Return an integer value like glGetIntegerv.
- * Input: pname -
- * OSMESA_WIDTH return current image width
- * OSMESA_HEIGHT return current image height
- * OSMESA_FORMAT return image format
- * OSMESA_TYPE return color component data type
- * OSMESA_ROW_LENGTH return row length in pixels
- * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
- * value - pointer to integer in which to return result.
- */
- GLAPI void GLAPIENTRY
- OSMesaGetIntegerv( GLint pname, GLint *value );
-
-
-
- /*
- * Return the depth buffer associated with an OSMesa context.
- * Input: c - the OSMesa context
- * Output: width, height - size of buffer in pixels
- * bytesPerValue - bytes per depth value (2 or 4)
- * buffer - pointer to depth buffer values
- * Return: GL_TRUE or GL_FALSE to indicate success or failure.
- *
- * New in Mesa 2.4.
- */
- GLAPI GLboolean GLAPIENTRY
- OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
- GLint *bytesPerValue, void **buffer );
-
-
-
- /*
- * Return the color buffer associated with an OSMesa context.
- * Input: c - the OSMesa context
- * Output: width, height - size of buffer in pixels
- * format - buffer format (OSMESA_FORMAT)
- * buffer - pointer to depth buffer values
- * Return: GL_TRUE or GL_FALSE to indicate success or failure.
- *
- * New in Mesa 3.3.
- */
- GLAPI GLboolean GLAPIENTRY
- OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height,
- GLint *format, void **buffer );
-
-
-
- /*
- * Return pointer to the named function.
- *
- * New in Mesa 4.1
- */
- GLAPI void * GLAPIENTRY
- OSMesaGetProcAddress( const char *funcName );
-
-
- #if defined(__BEOS__) || defined(__QUICKDRAW__)
- #pragma export off
- #endif
-
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif
|