| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/GL/osmesa.h
Go to the documentation of this file.

    00001 /*
    00002  * Mesa 3-D graphics library
    00003  * Version:  6.5
    00004  *
    00005  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
    00006  *
    00007  * Permission is hereby granted, free of charge, to any person obtaining a
    00008  * copy of this software and associated documentation files (the "Software"),
    00009  * to deal in the Software without restriction, including without limitation
    00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00011  * and/or sell copies of the Software, and to permit persons to whom the
    00012  * Software is furnished to do so, subject to the following conditions:
    00013  *
    00014  * The above copyright notice and this permission notice shall be included
    00015  * in all copies or substantial portions of the Software.
    00016  *
    00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
    00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00023  */
    00024
    00025
    00026 /*
    00027  * Mesa Off-Screen rendering interface.
    00028  *
    00029  * This is an operating system and window system independent interface to
    00030  * Mesa which allows one to render images into a client-supplied buffer in
    00031  * main memory.  Such images may manipulated or saved in whatever way the
    00032  * client wants.
    00033  *
    00034  * These are the API functions:
    00035  *   OSMesaCreateContext - create a new Off-Screen Mesa rendering context
    00036  *   OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer
    00037  *                       and make the specified context the current one.
    00038  *   OSMesaDestroyContext - destroy an OSMesaContext
    00039  *   OSMesaGetCurrentContext - return thread's current context ID
    00040  *   OSMesaPixelStore - controls how pixels are stored in image buffer
    00041  *   OSMesaGetIntegerv - return OSMesa state parameters
    00042  *
    00043  *
    00044  * The limits on the width and height of an image buffer are MAX_WIDTH and
    00045  * MAX_HEIGHT as defined in Mesa/src/config.h.  Defaults are 1280 and 1024.
    00046  * You can increase them as needed but beware that many temporary arrays in
    00047  * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT.
    00048  */
    00049
    00050
    00051 #ifndef OSMESA_H
    00052 #define OSMESA_H
    00053
    00054
    00055 #ifdef __cplusplus
    00056 extern "C" {
    00057 #endif
    00058
    00059
    00060 #include <GL/gl.h>
    00061
    00062
    00063 #define OSMESA_MAJOR_VERSION 6
    00064 #define OSMESA_MINOR_VERSION 5
    00065 #define OSMESA_PATCH_VERSION 0
    00066
    00067
    00068
    00069 /*
    00070  * Values for the format parameter of OSMesaCreateContext()
    00071  * New in version 2.0.
    00072  */
    00073 #define OSMESA_COLOR_INDEX       GL_COLOR_INDEX
    00074 #define OSMESA_RGBA              GL_RGBA
    00075 #define OSMESA_BGRA              0x1
    00076 #define OSMESA_ARGB              0x2
    00077 #define OSMESA_RGB               GL_RGB
    00078 #define OSMESA_BGR               0x4
    00079 #define OSMESA_RGB_565                      0x5
    00080
    00081
    00082 /*
    00083  * OSMesaPixelStore() parameters:
    00084  * New in version 2.0.
    00085  */
    00086 #define OSMESA_ROW_LENGTH        0x10
    00087 #define OSMESA_Y_UP              0x11
    00088
    00089
    00090 /*
    00091  * Accepted by OSMesaGetIntegerv:
    00092  */
    00093 #define OSMESA_WIDTH             0x20
    00094 #define OSMESA_HEIGHT            0x21
    00095 #define OSMESA_FORMAT            0x22
    00096 #define OSMESA_TYPE              0x23
    00097 #define OSMESA_MAX_WIDTH         0x24  /* new in 4.0 */
    00098 #define OSMESA_MAX_HEIGHT        0x25  /* new in 4.0 */
    00099
    00100
    00101 typedef struct osmesa_context *OSMesaContext;
    00102
    00103
    00104 #if defined(__BEOS__) || defined(__QUICKDRAW__)
    00105 #pragma export on
    00106 #endif
    00107
    00108
    00109 /*
    00110  * Create an Off-Screen Mesa rendering context.  The only attribute needed is
    00111  * an RGBA vs Color-Index mode flag.
    00112  *
    00113  * Input:  format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA,
    00114  *                  OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR.
    00115  *         sharelist - specifies another OSMesaContext with which to share
    00116  *                     display lists.  NULL indicates no sharing.
    00117  * Return:  an OSMesaContext or 0 if error
    00118  */
    00119 GLAPI OSMesaContext GLAPIENTRY
    00120 OSMesaCreateContext( GLenum format, OSMesaContext sharelist );
    00121
    00122
    00123
    00124 /*
    00125  * Create an Off-Screen Mesa rendering context and specify desired
    00126  * size of depth buffer, stencil buffer and accumulation buffer.
    00127  * If you specify zero for depthBits, stencilBits, accumBits you
    00128  * can save some memory.
    00129  *
    00130  * New in Mesa 3.5
    00131  */
    00132 GLAPI OSMesaContext GLAPIENTRY
    00133 OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
    00134                         GLint accumBits, OSMesaContext sharelist);
    00135
    00136
    00137 /*
    00138  * Destroy an Off-Screen Mesa rendering context.
    00139  *
    00140  * Input:  ctx - the context to destroy
    00141  */
    00142 GLAPI void GLAPIENTRY
    00143 OSMesaDestroyContext( OSMesaContext ctx );
    00144
    00145
    00146
    00147 /*
    00148  * Bind an OSMesaContext to an image buffer.  The image buffer is just a
    00149  * block of memory which the client provides.  Its size must be at least
    00150  * as large as width*height*sizeof(type).  Its address should be a multiple
    00151  * of 4 if using RGBA mode.
    00152  *
    00153  * Image data is stored in the order of glDrawPixels:  row-major order
    00154  * with the lower-left image pixel stored in the first array position
    00155  * (ie. bottom-to-top).
    00156  *
    00157  * Since the only type initially supported is GL_UNSIGNED_BYTE, if the
    00158  * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA
    00159  * value.  If the context is in color indexed mode, each pixel will be
    00160  * stored as a 1-byte value.
    00161  *
    00162  * If the context's viewport hasn't been initialized yet, it will now be
    00163  * initialized to (0,0,width,height).
    00164  *
    00165  * Input:  ctx - the rendering context
    00166  *         buffer - the image buffer memory
    00167  *         type - data type for pixel components, only GL_UNSIGNED_BYTE
    00168  *                supported now
    00169  *         width, height - size of image buffer in pixels, at least 1
    00170  * Return:  GL_TRUE if success, GL_FALSE if error because of invalid ctx,
    00171  *          invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
    00172  *          width>internal limit or height>internal limit.
    00173  */
    00174 GLAPI GLboolean GLAPIENTRY
    00175 OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
    00176                    GLsizei width, GLsizei height );
    00177
    00178
    00179
    00180
    00181 /*
    00182  * Return the current Off-Screen Mesa rendering context handle.
    00183  */
    00184 GLAPI OSMesaContext GLAPIENTRY
    00185 OSMesaGetCurrentContext( void );
    00186
    00187
    00188
    00189 /*
    00190  * Set pixel store/packing parameters for the current context.
    00191  * This is similar to glPixelStore.
    00192  * Input:  pname - OSMESA_ROW_LENGTH
    00193  *                    specify actual pixels per row in image buffer
    00194  *                    0 = same as image width (default)
    00195  *                 OSMESA_Y_UP
    00196  *                    zero = Y coordinates increase downward
    00197  *                    non-zero = Y coordinates increase upward (default)
    00198  *         value - the value for the parameter pname
    00199  *
    00200  * New in version 2.0.
    00201  */
    00202 GLAPI void GLAPIENTRY
    00203 OSMesaPixelStore( GLint pname, GLint value );
    00204
    00205
    00206
    00207 /*
    00208  * Return an integer value like glGetIntegerv.
    00209  * Input:  pname -
    00210  *                 OSMESA_WIDTH  return current image width
    00211  *                 OSMESA_HEIGHT  return current image height
    00212  *                 OSMESA_FORMAT  return image format
    00213  *                 OSMESA_TYPE  return color component data type
    00214  *                 OSMESA_ROW_LENGTH return row length in pixels
    00215  *                 OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
    00216  *         value - pointer to integer in which to return result.
    00217  */
    00218 GLAPI void GLAPIENTRY
    00219 OSMesaGetIntegerv( GLint pname, GLint *value );
    00220
    00221
    00222
    00223 /*
    00224  * Return the depth buffer associated with an OSMesa context.
    00225  * Input:  c - the OSMesa context
    00226  * Output:  width, height - size of buffer in pixels
    00227  *          bytesPerValue - bytes per depth value (2 or 4)
    00228  *          buffer - pointer to depth buffer values
    00229  * Return:  GL_TRUE or GL_FALSE to indicate success or failure.
    00230  *
    00231  * New in Mesa 2.4.
    00232  */
    00233 GLAPI GLboolean GLAPIENTRY
    00234 OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
    00235                       GLint *bytesPerValue, void **buffer );
    00236
    00237
    00238
    00239 /*
    00240  * Return the color buffer associated with an OSMesa context.
    00241  * Input:  c - the OSMesa context
    00242  * Output:  width, height - size of buffer in pixels
    00243  *          format - buffer format (OSMESA_FORMAT)
    00244  *          buffer - pointer to depth buffer values
    00245  * Return:  GL_TRUE or GL_FALSE to indicate success or failure.
    00246  *
    00247  * New in Mesa 3.3.
    00248  */
    00249 GLAPI GLboolean GLAPIENTRY
    00250 OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height,
    00251                       GLint *format, void **buffer );
    00252
    00253
    00254
    00258 typedef void (*OSMESAproc)();
    00259
    00260
    00261 /*
    00262  * Return pointer to the named function.
    00263  * New in Mesa 4.1
    00264  * Return OSMESAproc in 6.3.
    00265  */
    00266 GLAPI OSMESAproc GLAPIENTRY
    00267 OSMesaGetProcAddress( const char *funcName );
    00268
    00269
    00270
    00275 GLAPI void GLAPIENTRY
    00276 OSMesaColorClamp(GLboolean enable);
    00277
    00278
    00279 #if defined(__BEOS__) || defined(__QUICKDRAW__)
    00280 #pragma export off
    00281 #endif
    00282
    00283
    00284 #ifdef __cplusplus
    00285 }
    00286 #endif
    00287
    00288
    00289 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines