added OSMesaCreateContextExt()
This commit is contained in:
parent
8ad306baf6
commit
2bf5d9470d
|
@ -1,8 +1,8 @@
|
||||||
/* $Id: osmesa.h,v 1.5 2000/03/28 16:59:39 rjfrank Exp $ */
|
/* $Id: osmesa.h,v 1.6 2000/09/08 16:41:38 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
* Version: 3.3
|
* Version: 3.5
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
|
||||||
*
|
*
|
||||||
|
@ -59,11 +59,11 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "GL/gl.h"
|
#include <GL/gl.h>
|
||||||
|
|
||||||
|
|
||||||
#define OSMESA_MAJOR_VERSION 3
|
#define OSMESA_MAJOR_VERSION 3
|
||||||
#define OSMESA_MINOR_VERSION 3
|
#define OSMESA_MINOR_VERSION 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,18 +114,31 @@ typedef struct osmesa_context *OSMesaContext;
|
||||||
* display lists. NULL indicates no sharing.
|
* display lists. NULL indicates no sharing.
|
||||||
* Return: an OSMesaContext or 0 if error
|
* Return: an OSMesaContext or 0 if error
|
||||||
*/
|
*/
|
||||||
GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format,
|
GLAPI OSMesaContext GLAPIENTRY
|
||||||
OSMesaContext sharelist );
|
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.
|
* Destroy an Off-Screen Mesa rendering context.
|
||||||
*
|
*
|
||||||
* Input: ctx - the context to destroy
|
* Input: ctx - the context to destroy
|
||||||
*/
|
*/
|
||||||
GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
|
GLAPI void GLAPIENTRY
|
||||||
|
OSMesaDestroyContext( OSMesaContext ctx );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,9 +169,9 @@ GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx );
|
||||||
* invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
|
* invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1,
|
||||||
* width>internal limit or height>internal limit.
|
* width>internal limit or height>internal limit.
|
||||||
*/
|
*/
|
||||||
GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
|
GLAPI GLboolean GLAPIENTRY
|
||||||
void *buffer, GLenum type,
|
OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type,
|
||||||
GLsizei width, GLsizei height );
|
GLsizei width, GLsizei height );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +179,8 @@ GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx,
|
||||||
/*
|
/*
|
||||||
* Return the current Off-Screen Mesa rendering context handle.
|
* Return the current Off-Screen Mesa rendering context handle.
|
||||||
*/
|
*/
|
||||||
GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void );
|
GLAPI OSMesaContext GLAPIENTRY
|
||||||
|
OSMesaGetCurrentContext( void );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,7 +197,8 @@ GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void );
|
||||||
*
|
*
|
||||||
* New in version 2.0.
|
* New in version 2.0.
|
||||||
*/
|
*/
|
||||||
GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
|
GLAPI void GLAPIENTRY
|
||||||
|
OSMesaPixelStore( GLint pname, GLint value );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,7 +213,8 @@ GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value );
|
||||||
* OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
|
* OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction
|
||||||
* value - pointer to integer in which to return result.
|
* value - pointer to integer in which to return result.
|
||||||
*/
|
*/
|
||||||
GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value );
|
GLAPI void GLAPIENTRY
|
||||||
|
OSMesaGetIntegerv( GLint pname, GLint *value );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -212,10 +228,10 @@ GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value );
|
||||||
*
|
*
|
||||||
* New in Mesa 2.4.
|
* New in Mesa 2.4.
|
||||||
*/
|
*/
|
||||||
GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c,
|
GLAPI GLboolean GLAPIENTRY
|
||||||
GLint *width, GLint *height,
|
OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height,
|
||||||
GLint *bytesPerValue,
|
GLint *bytesPerValue, void **buffer );
|
||||||
void **buffer );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -228,10 +244,10 @@ GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c,
|
||||||
*
|
*
|
||||||
* New in Mesa 3.3.
|
* New in Mesa 3.3.
|
||||||
*/
|
*/
|
||||||
GLAPI GLboolean GLAPIENTRY OSMesaGetColorBuffer( OSMesaContext c,
|
GLAPI GLboolean GLAPIENTRY
|
||||||
GLint *width, GLint *height,
|
OSMesaGetColorBuffer( OSMesaContext c, GLint *width, GLint *height,
|
||||||
GLint *format,
|
GLint *format, void **buffer );
|
||||||
void **buffer );
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__QUICKDRAW__)
|
#if defined(__BEOS__) || defined(__QUICKDRAW__)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: osmesa.c,v 1.19 2000/06/27 21:42:14 brianp Exp $ */
|
/* $Id: osmesa.c,v 1.20 2000/09/08 16:41:39 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
|
@ -99,11 +99,26 @@ static void osmesa_update_state( GLcontext *ctx );
|
||||||
*/
|
*/
|
||||||
OSMesaContext GLAPIENTRY
|
OSMesaContext GLAPIENTRY
|
||||||
OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
|
{
|
||||||
|
return OSMesaCreateContextExt(format, DEFAULT_SOFTWARE_DEPTH_BITS,
|
||||||
|
8, 16, sharelist);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* New in Mesa 3.5
|
||||||
|
*
|
||||||
|
* Create context and specify size of ancillary buffers.
|
||||||
|
*/
|
||||||
|
OSMesaContext GLAPIENTRY
|
||||||
|
OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
|
||||||
|
GLint accumBits, OSMesaContext sharelist )
|
||||||
{
|
{
|
||||||
OSMesaContext osmesa;
|
OSMesaContext osmesa;
|
||||||
GLint rshift, gshift, bshift, ashift;
|
GLint rshift, gshift, bshift, ashift;
|
||||||
GLint rind, gind, bind;
|
GLint rind, gind, bind;
|
||||||
GLint indexBits, alphaBits;
|
GLint indexBits, redBits, greenBits, blueBits, alphaBits;
|
||||||
GLboolean rgbmode;
|
GLboolean rgbmode;
|
||||||
GLboolean swalpha;
|
GLboolean swalpha;
|
||||||
GLuint i4 = 1;
|
GLuint i4 = 1;
|
||||||
|
@ -119,6 +134,9 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
}
|
}
|
||||||
else if (format==OSMESA_RGBA) {
|
else if (format==OSMESA_RGBA) {
|
||||||
indexBits = 0;
|
indexBits = 0;
|
||||||
|
redBits = 8;
|
||||||
|
greenBits = 8;
|
||||||
|
blueBits = 8;
|
||||||
alphaBits = 8;
|
alphaBits = 8;
|
||||||
if (little_endian) {
|
if (little_endian) {
|
||||||
rshift = 0;
|
rshift = 0;
|
||||||
|
@ -136,6 +154,9 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
}
|
}
|
||||||
else if (format==OSMESA_BGRA) {
|
else if (format==OSMESA_BGRA) {
|
||||||
indexBits = 0;
|
indexBits = 0;
|
||||||
|
redBits = 8;
|
||||||
|
greenBits = 8;
|
||||||
|
blueBits = 8;
|
||||||
alphaBits = 8;
|
alphaBits = 8;
|
||||||
if (little_endian) {
|
if (little_endian) {
|
||||||
ashift = 0;
|
ashift = 0;
|
||||||
|
@ -153,6 +174,9 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
}
|
}
|
||||||
else if (format==OSMESA_ARGB) {
|
else if (format==OSMESA_ARGB) {
|
||||||
indexBits = 0;
|
indexBits = 0;
|
||||||
|
redBits = 8;
|
||||||
|
greenBits = 8;
|
||||||
|
blueBits = 8;
|
||||||
alphaBits = 8;
|
alphaBits = 8;
|
||||||
if (little_endian) {
|
if (little_endian) {
|
||||||
bshift = 0;
|
bshift = 0;
|
||||||
|
@ -170,6 +194,9 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
}
|
}
|
||||||
else if (format==OSMESA_RGB) {
|
else if (format==OSMESA_RGB) {
|
||||||
indexBits = 0;
|
indexBits = 0;
|
||||||
|
redBits = 8;
|
||||||
|
greenBits = 8;
|
||||||
|
blueBits = 8;
|
||||||
alphaBits = 0;
|
alphaBits = 0;
|
||||||
bshift = 0;
|
bshift = 0;
|
||||||
gshift = 8;
|
gshift = 8;
|
||||||
|
@ -183,6 +210,9 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
}
|
}
|
||||||
else if (format==OSMESA_BGR) {
|
else if (format==OSMESA_BGR) {
|
||||||
indexBits = 0;
|
indexBits = 0;
|
||||||
|
redBits = 8;
|
||||||
|
greenBits = 8;
|
||||||
|
blueBits = 8;
|
||||||
alphaBits = 0;
|
alphaBits = 0;
|
||||||
bshift = 0;
|
bshift = 0;
|
||||||
gshift = 8;
|
gshift = 8;
|
||||||
|
@ -201,15 +231,22 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
|
|
||||||
osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context);
|
osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context);
|
||||||
if (osmesa) {
|
if (osmesa) {
|
||||||
osmesa->gl_visual = gl_create_visual( rgbmode,
|
osmesa->gl_visual = _mesa_create_visual( rgbmode,
|
||||||
swalpha, /* software alpha */
|
GL_FALSE, /* double buffer */
|
||||||
GL_FALSE, /* double buffer */
|
GL_FALSE, /* stereo */
|
||||||
GL_FALSE, /* stereo */
|
redBits,
|
||||||
DEFAULT_SOFTWARE_DEPTH_BITS,
|
greenBits,
|
||||||
STENCIL_BITS,
|
blueBits,
|
||||||
rgbmode ? ACCUM_BITS : 0,
|
alphaBits,
|
||||||
indexBits,
|
indexBits,
|
||||||
8, 8, 8, alphaBits );
|
depthBits,
|
||||||
|
stencilBits,
|
||||||
|
accumBits,
|
||||||
|
accumBits,
|
||||||
|
accumBits,
|
||||||
|
alphaBits ? accumBits : 0,
|
||||||
|
1 /* num samples */
|
||||||
|
);
|
||||||
if (!osmesa->gl_visual) {
|
if (!osmesa->gl_visual) {
|
||||||
FREE(osmesa);
|
FREE(osmesa);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -262,6 +299,7 @@ OSMesaCreateContext( GLenum format, OSMesaContext sharelist )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Destroy an Off-Screen Mesa rendering context.
|
* Destroy an Off-Screen Mesa rendering context.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue