X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=glimports.hpp;h=a24e20f139db217824e891542a88202a01240e0a;hb=9523768fe89d08e8e21922a973e0f8424459e9b9;hp=46c80693f9a4c6e13719059adfca1db6cb10f232;hpb=d3b805988ac88ce4602775bdb89261c356318693;p=apitrace diff --git a/glimports.hpp b/glimports.hpp index 46c8069..a24e20f 100644 --- a/glimports.hpp +++ b/glimports.hpp @@ -23,34 +23,52 @@ * **************************************************************************/ +/* + * Central place for all GL includes, and respective OS dependent headers. + */ + #ifndef _GLIMPORTS_HPP_ #define _GLIMPORTS_HPP_ -#ifdef WIN32 + +// Prevent including system's glext.h +#define __glext_h_ + + +#if defined(_WIN32) #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN 1 #endif #include +#include -#else /* !WIN32 */ +#elif defined(__APPLE__) -#include +#include -#endif /* !WIN32 */ +#else +#include #include -#include +#endif /* !_WIN32 */ + + +// Include our own glext.h +#undef __glext_h_ +#include "glext/glext.h" + #ifndef GL_TEXTURE_INDEX_SIZE_EXT #define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED #endif -#ifdef WIN32 -#include +#if defined(_WIN32) + +#include "glext/wglext.h" #define GLAPIENTRY __stdcall @@ -61,8 +79,9 @@ #define PFD_SUPPORT_COMPOSITION 0x00008000 #endif -#ifdef __MINGW32__ +#ifndef WGL_SWAPMULTIPLE_MAX +extern "C" typedef struct _WGLSWAP { HDC hdc; @@ -71,13 +90,36 @@ typedef struct _WGLSWAP #define WGL_SWAPMULTIPLE_MAX 16 -#endif /* __MINGW32__ */ +#endif /* !WGL_SWAPMULTIPLE_MAX */ + +#elif defined(__APPLE__) + +#include +#include +#include + +extern "C" { + +// From http://www.opensource.apple.com/source/gdb/gdb-954/libcheckpoint/cpcg.c +typedef void * CGSConnectionID; +typedef int CGSWindowID; +typedef int CGSSurfaceID; -#else /* !WIN32 */ +CGLError CGLSetSurface(CGLContextObj ctx, CGSConnectionID cid, CGSWindowID wid, CGSSurfaceID sid); +CGLError CGLGetSurface(CGLContextObj ctx, CGSConnectionID* cid, CGSWindowID* wid, CGSSurfaceID* sid); +CGLError CGLUpdateContext(CGLContextObj ctx); + +} + +#else #include -#include +#include "glext/glxext.h" + +/* Prevent collision with Trace::Bool */ +#undef Bool + +#endif -#endif /* !WIN32 */ #endif /* _GLIMPORTS_HPP_ */