#ifndef __gl_core_h_
#define __gl_core_h_
#include <sys/types.h>
#ifdef CAPI
#undef CAPI
#endif
#define CAPI
#define GL_CORE_SGI 1
#define GL_CORE_MESA 2
#define GL_CORE_APPLE 4
typedef struct __GLcontextRec __GLcontext;
typedef struct __GLinterfaceRec __GLinterface;
typedef struct __GLcontextModesRec {
struct __GLcontextModesRec * next;
GLboolean rgbMode;
GLboolean floatMode;
GLboolean colorIndexMode;
GLuint doubleBufferMode;
GLuint stereoMode;
GLboolean haveAccumBuffer;
GLboolean haveDepthBuffer;
GLboolean haveStencilBuffer;
GLint redBits, greenBits, blueBits, alphaBits;
GLuint redMask, greenMask, blueMask, alphaMask;
GLint rgbBits;
GLint indexBits;
GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits;
GLint depthBits;
GLint stencilBits;
GLint numAuxBuffers;
GLint level;
GLint pixmapMode;
GLint visualID;
GLint visualType;
GLint visualRating;
GLint transparentPixel;
GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha;
GLint transparentIndex;
GLint sampleBuffers;
GLint samples;
GLint drawableType;
GLint renderType;
GLint xRenderable;
GLint fbconfigID;
GLint maxPbufferWidth;
GLint maxPbufferHeight;
GLint maxPbufferPixels;
GLint optimalPbufferWidth;
GLint optimalPbufferHeight;
GLint visualSelectGroup;
GLint swapMethod;
GLint screen;
GLint bindToTextureRgb;
GLint bindToTextureRgba;
GLint bindToMipmapTexture;
GLint bindToTextureTargets;
GLint yInverted;
} __GLcontextModes;
#define GLX_NONE 0x8000
#define GLX_SLOW_CONFIG 0x8001
#define GLX_TRUE_COLOR 0x8002
#define GLX_DIRECT_COLOR 0x8003
#define GLX_PSEUDO_COLOR 0x8004
#define GLX_STATIC_COLOR 0x8005
#define GLX_GRAY_SCALE 0x8006
#define GLX_STATIC_GRAY 0x8007
#define GLX_TRANSPARENT_RGB 0x8008
#define GLX_TRANSPARENT_INDEX 0x8009
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_SWAP_EXCHANGE_OML 0x8061
#define GLX_SWAP_COPY_OML 0x8062
#define GLX_SWAP_UNDEFINED_OML 0x8063
#define GLX_DONT_CARE 0xFFFFFFFF
#define GLX_RGBA_BIT 0x00000001
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_WINDOW_BIT 0x00000001
#define GLX_PIXMAP_BIT 0x00000002
#define GLX_PBUFFER_BIT 0x00000004
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
#define GLX_Y_INVERTED_EXT 0x20D4
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
typedef struct __GLdrawableRegionRec __GLdrawableRegion;
typedef struct __GLdrawableBufferRec __GLdrawableBuffer;
typedef struct __GLdrawablePrivateRec __GLdrawablePrivate;
typedef struct __GLregionRectRec {
GLint x0, y0;
GLint x1, y1;
} __GLregionRect;
struct __GLdrawableRegionRec {
GLint numRects;
__GLregionRect *rects;
__GLregionRect boundingRect;
};
#define __GL_FRONT_BUFFER_MASK 0x00000001
#define __GL_FRONT_LEFT_BUFFER_MASK 0x00000001
#define __GL_FRONT_RIGHT_BUFFER_MASK 0x00000002
#define __GL_BACK_BUFFER_MASK 0x00000004
#define __GL_BACK_LEFT_BUFFER_MASK 0x00000004
#define __GL_BACK_RIGHT_BUFFER_MASK 0x00000008
#define __GL_ACCUM_BUFFER_MASK 0x00000010
#define __GL_DEPTH_BUFFER_MASK 0x00000020
#define __GL_STENCIL_BUFFER_MASK 0x00000040
#define __GL_AUX_BUFFER_MASK(i) (0x0000080 << (i))
#define __GL_ALL_BUFFER_MASK 0xffffffff
#define __GL_BUFFER_FALLBACK 0x10
typedef void (*__GLbufFallbackInitFn)(__GLdrawableBuffer *buf,
__GLdrawablePrivate *glPriv, GLint bits);
typedef void (*__GLbufMainInitFn)(__GLdrawableBuffer *buf,
__GLdrawablePrivate *glPriv, GLint bits,
__GLbufFallbackInitFn back);
struct __GLdrawableBufferRec {
GLint width, height, depth;
void *base;
GLuint size;
GLuint elementSize;
GLuint elementSizeLog2;
GLint outerWidth;
GLint byteWidth;
void *handle;
GLboolean (*resize)(__GLdrawableBuffer *buf,
GLint x, GLint y, GLuint width, GLuint height,
__GLdrawablePrivate *glPriv, GLuint bufferMask);
void (*lock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
void (*unlock)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
void (*fill)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv,
GLuint val, GLint x, GLint y, GLint w, GLint h);
void (*free)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
void (*freePrivate)(__GLdrawableBuffer *buf, __GLdrawablePrivate *glPriv);
#ifdef __cplusplus
void *privatePtr;
#else
void *private;
#endif
void *other;
__GLbufMainInitFn mainInit;
__GLbufFallbackInitFn fallbackInit;
};
struct __GLdrawablePrivateRec {
__GLcontextModes *modes;
GLuint width, height;
GLint xOrigin, yOrigin;
#ifdef __GL_ALIGNED_BUFFERS
GLint xOffset, yOffset;
GLint xAlignment, yAlignment;
#endif
GLint yInverted;
GLuint accelBufferMask;
__GLdrawableBuffer frontBuffer;
__GLdrawableBuffer backBuffer;
__GLdrawableBuffer accumBuffer;
__GLdrawableBuffer depthBuffer;
__GLdrawableBuffer stencilBuffer;
#if defined(__GL_NUMBER_OF_AUX_BUFFERS) && (__GL_NUMBER_OF_AUX_BUFFERS > 0)
__GLdrawableBuffer *auxBuffer;
#endif
__GLdrawableRegion ownershipRegion;
void *lock;
#ifdef DEBUG
int lockRefCount;
int lockLine[10];
char *lockFile[10];
#endif
void *(*malloc)(size_t size);
void *(*calloc)(size_t numElem, size_t elemSize);
void *(*realloc)(void *oldAddr, size_t newSize);
void (*free)(void *addr);
GLboolean (*addSwapRect)(__GLdrawablePrivate *glPriv,
GLint x, GLint y, GLsizei width, GLsizei height);
void (*setClipRect)(__GLdrawablePrivate *glPriv,
GLint x, GLint y, GLsizei width, GLsizei height);
void (*updateClipRegion)(__GLdrawablePrivate *glPriv);
GLboolean (*resize)(__GLdrawablePrivate *glPriv);
void (*getDrawableSize)(__GLdrawablePrivate *glPriv,
GLint *x, GLint *y, GLuint *width, GLuint *height);
void (*lockDP)(__GLdrawablePrivate *glPriv, __GLcontext *gc);
void (*unlockDP)(__GLdrawablePrivate *glPriv);
#ifdef __cplusplus
void *privatePtr;
#else
void *private;
#endif
void (*freePrivate)(__GLdrawablePrivate *);
void *other;
};
#if defined(DEBUG)
#define __GL_LOCK_DP(glPriv,gc) \
(*(glPriv)->lockDP)(glPriv,gc); \
(glPriv)->lockLine[(glPriv)->lockRefCount] = __LINE__; \
(glPriv)->lockFile[(glPriv)->lockRefCount] = __FILE__; \
(glPriv)->lockRefCount++
#define __GL_UNLOCK_DP(glPriv) \
(glPriv)->lockRefCount--; \
(glPriv)->lockLine[(glPriv)->lockRefCount] = 0; \
(glPriv)->lockFile[(glPriv)->lockRefCount] = NULL; \
(*(glPriv)->unlockDP)(glPriv)
#else
#define __GL_LOCK_DP(glPriv,gc) (*(glPriv)->lockDP)(glPriv,gc)
#define __GL_UNLOCK_DP(glPriv) (*(glPriv)->unlockDP)(glPriv)
#endif
typedef struct __GLimportsRec {
void * (*malloc)(__GLcontext *gc, size_t size);
void *(*calloc)(__GLcontext *gc, size_t numElem, size_t elemSize);
void *(*realloc)(__GLcontext *gc, void *oldAddr, size_t newSize);
void (*free)(__GLcontext *gc, void *addr);
void (*warning)(__GLcontext *gc, char *fmt);
void (*fatal)(__GLcontext *gc, char *fmt);
char *(CAPI *getenv)(__GLcontext *gc, const char *var);
int (CAPI *atoi)(__GLcontext *gc, const char *str);
int (CAPI *sprintf)(__GLcontext *gc, char *str, const char *fmt, ...);
void *(CAPI *fopen)(__GLcontext *gc, const char *path, const char *mode);
int (CAPI *fclose)(__GLcontext *gc, void *stream);
int (CAPI *fprintf)(__GLcontext *gc, void *stream, const char *fmt, ...);
__GLdrawablePrivate *(*getDrawablePrivate)(__GLcontext *gc);
__GLdrawablePrivate *(*getReadablePrivate)(__GLcontext *gc);
void *other;
} __GLimports;
typedef struct __GLexportsRec {
GLboolean (*destroyContext)(__GLcontext *gc);
GLboolean (*loseCurrent)(__GLcontext *gc);
GLboolean (*makeCurrent)(__GLcontext *gc);
GLboolean (*shareContext)(__GLcontext *gc, __GLcontext *gcShare);
GLboolean (*copyContext)(__GLcontext *dst, const __GLcontext *src, GLuint mask);
GLboolean (*forceCurrent)(__GLcontext *gc);
GLboolean (*notifyResize)(__GLcontext *gc);
void (*notifyDestroy)(__GLcontext *gc);
void (*notifySwapBuffers)(__GLcontext *gc);
struct __GLdispatchStateRec* (*dispatchExec)(__GLcontext *gc);
void (*beginDispatchOverride)(__GLcontext *gc);
void (*endDispatchOverride)(__GLcontext *gc);
} __GLexports;
struct __GLinterfaceRec {
__GLimports imports;
__GLexports exports;
};
extern __GLcontext *__glCoreCreateContext(__GLimports *, __GLcontextModes *);
extern void __glCoreNopDispatch(void);
#endif