From 64d68e7894abf80fb296ed3a51c924e39b42dee8 Mon Sep 17 00:00:00 2001 From: Gregory Pierce Date: Mon, 30 Dec 2002 07:07:40 +0000 Subject: [PATCH] Changes to allow more than just Windows and UNIX build targets. Adds in the _X11 define for the Unix boys and will include the _OSX define to handle stuff for OSX. --- src/native/common/extgl.c | 62 ++++++++------------- src/native/common/extgl.h | 114 ++++++-------------------------------- 2 files changed, 42 insertions(+), 134 deletions(-) diff --git a/src/native/common/extgl.c b/src/native/common/extgl.c index 4cfc1aa0..650cb2b3 100644 --- a/src/native/common/extgl.c +++ b/src/native/common/extgl.c @@ -43,16 +43,10 @@ THE POSSIBILITY OF SUCH DAMAGE. #pragma warn -8065 #endif /* __BORLANDC__ */ -#ifndef _WIN32 +#ifdef _X11 -/*wglGetProcAddressPROC wglGetProcAddress = NULL; - -#else -*/ -/* GLX functions */ #include - glXGetFBConfigsPROC glXGetFBConfigs = NULL; glXChooseFBConfigPROC glXChooseFBConfig = NULL; glXGetFBConfigAttribPROC glXGetFBConfigAttrib = NULL; @@ -71,15 +65,7 @@ glXGetCurrentDisplayPROC glXGetCurrentDisplay = NULL; glXQueryContextPROC glXQueryContext = NULL; glXSelectEventPROC glXSelectEvent = NULL; glXGetSelectedEventPROC glXGetSelectedEvent = NULL; - -/*glXGetContextIDEXTPROC glXGetContextIDEXT = NULL; -glXGetCurrentDrawableEXTPROC glXGetCurrentDrawableEXT = NULL; -glXImportContextEXTPROC glXImportContextEXT = NULL; -glXFreeContextEXTPROC glXFreeContextEXT = NULL; -glXQueryContextInfoEXTPROC glXQueryContextInfoEXT = NULL; -*/ glXGetProcAddressARBPROC glXGetProcAddressARB = NULL; - glXChooseVisualPROC glXChooseVisual = NULL; glXCopyContextPROC glXCopyContext = NULL; glXCreateContextPROC glXCreateContext = NULL; @@ -783,10 +769,12 @@ glVertexArrayRangeNVPROC glVertexArrayRangeNV = NULL; #ifdef _WIN32 wglAllocateMemoryNVPROC wglAllocateMemoryNV = NULL; wglFreeMemoryNVPROC wglFreeMemoryNV = NULL; -#else +#endif /* WIN32 */ + +#ifdef _X11 glXAllocateMemoryNVPROC glXAllocateMemoryNV = NULL; glXFreeMemoryNVPROC glXFreeMemoryNV = NULL; -#endif /* WIN32 */ +#endif /* X11 */ #endif /* GL_NV_vertex_array_range */ @@ -1251,10 +1239,6 @@ glBlendFuncSeparateINGRPROC glBlendFuncSeparateINGR = NULL; #endif /* GL_EXT_blend_func_separate */ #ifdef GL_VERSION_1_4 -/*#ifndef GL_VERSION_1_2 -glBlendColorPROC glBlendColor = NULL; -glBlendEquationPROC glBlendEquation = NULL; -#endif *//* GL_VERSION_1_2 */ glFogCoordfPROC glFogCoordf = NULL; glFogCoordfvPROC glFogCoordfv = NULL; glFogCoorddPROC glFogCoordd = NULL; @@ -1346,7 +1330,9 @@ struct ExtensionTypes SupportedExtensions; /* deprecated, please do not use */ #ifdef _WIN32 HMODULE lib_gl_handle = NULL; HMODULE lib_glu_handle = NULL; -#else +#endif + +#ifdef _X11 void * lib_gl_handle = NULL; void * lib_glu_handle = NULL; #endif @@ -1368,7 +1354,9 @@ void *extgl_GetProcAddress(char *name) } } return t; -#else +#endif + +#ifdef _X11 void *t = (void*)glXGetProcAddressARB((const GLubyte*)name); if (t == NULL) { @@ -1562,7 +1550,7 @@ int QueryExtension(const GLubyte*extensions, const char *name) return 0; } -#ifndef _WIN32 +#ifdef _X11 /** returns true if the extention is available */ int GLXQueryExtension(Display *disp, int screen, const char *name) { @@ -2214,10 +2202,11 @@ void extgl_InitNVVertexArrayRange() #ifdef _WIN32 wglAllocateMemoryNV = (wglAllocateMemoryNVPROC) extgl_GetProcAddress("wglAllocateMemoryNV"); wglFreeMemoryNV = (wglFreeMemoryNVPROC) extgl_GetProcAddress("wglFreeMemoryNV"); -#else +#endif /* WIN32 */ +#ifdef _X11 glXAllocateMemoryNV = (glXAllocateMemoryNVPROC) extgl_GetProcAddress("glXAllocateMemoryNV"); glXFreeMemoryNV = (glXFreeMemoryNVPROC) extgl_GetProcAddress("glXFreeMemoryNV"); -#endif /* WIN32 */ +#endif /* X11 */ #endif } @@ -2415,7 +2404,7 @@ int extgl_InitEXTNurbsTesselator(void) return 0; } -#ifndef _WIN32 +#ifdef _X11 int extgl_InitGLX13(void) { if (extgl_Extensions.glx.GLX13 == 0) @@ -2443,12 +2432,6 @@ int extgl_InitGLX13(void) int extgl_InitGLX12(void) { -/* glXGetContextIDEXT = (glXGetContextIDEXTPROC) extgl_GetProcAddress("glXGetContextIDEXT"); - glXGetCurrentDrawableEXT = (glXGetCurrentDrawableEXTPROC) extgl_GetProcAddress("glXGetCurrentDrawableEXT"); - glXImportContextEXT = (glXImportContextEXTPROC) extgl_GetProcAddress("glXImportContextEXT"); - glXFreeContextEXT = (glXFreeContextEXTPROC) extgl_GetProcAddress("glXFreeContextEXT"); - glXQueryContextInfoEXT = (glXQueryContextInfoEXTPROC) extgl_GetProcAddress("glXQueryContextInfoEXT"); -*/ glXChooseVisual = (glXChooseVisualPROC) extgl_GetProcAddress("glXChooseVisual"); glXCopyContext = (glXCopyContextPROC) extgl_GetProcAddress("glXCopyContext"); glXCreateContext = (glXCreateContextPROC) extgl_GetProcAddress("glXCreateContext"); @@ -2472,7 +2455,7 @@ int extgl_InitGLX12(void) return extgl_error; } -#ifndef _WIN32 +#ifdef _X11 void extgl_InitGLXSupportedExtensions(Display *disp, int screen) { extgl_Extensions.glx.EXT_visual_info = GLXQueryExtension(disp, screen, "GLX_EXT_visual_info"); @@ -3220,7 +3203,7 @@ int extgl_Initialize() return extgl_error; } -#ifndef _WIN32 +#ifdef _X11 int extgl_Open(Display *disp, int screen) { lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); @@ -3234,7 +3217,9 @@ int extgl_Open(Display *disp, int screen) return 1; return 0; } -#else +#endif + +#ifdef _WIN32 int extgl_Open(void) { @@ -3250,10 +3235,11 @@ int extgl_Open(void) void extgl_Close(void) { -#ifndef _WIN32 +#ifdef _X11 dlclose(lib_glu_handle); dlclose(lib_gl_handle); -#else +#endif +#ifdef _WIN32 FreeLibrary(lib_gl_handle); FreeLibrary(lib_glu_handle); #endif diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h index ac21ec7b..e50583d2 100644 --- a/src/native/common/extgl.h +++ b/src/native/common/extgl.h @@ -169,59 +169,7 @@ WGL_NV_render_texture_rectangle #if defined(_WIN32) && !defined(APIENTRY) #define WIN32_LEAN_AND_MEAN 1 #include -/* -typedef int BOOL; -typedef void *PVOID; -typedef float FLOAT; -typedef void VOID; -typedef unsigned int UINT; -typedef unsigned long DWORD; -typedef unsigned char BYTE; -typedef unsigned short WORD; -#ifdef STRICT -typedef void *HANDLE; -#define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name -#else -typedef PVOID HANDLE; -#define DECLARE_HANDLE(name) typedef HANDLE name -#endif -typedef HANDLE *PHANDLE; - -DECLARE_HANDLE(HDC); -DECLARE_HANDLE(HGLRC); -DECLARE_HANDLE(HWND); - -typedef struct tagPIXELFORMATDESCRIPTOR -{ - WORD nSize; - WORD nVersion; - DWORD dwFlags; - BYTE iPixelType; - BYTE cColorBits; - BYTE cRedBits; - BYTE cRedShift; - BYTE cGreenBits; - BYTE cGreenShift; - BYTE cBlueBits; - BYTE cBlueShift; - BYTE cAlphaBits; - BYTE cAlphaShift; - BYTE cAccumBits; - BYTE cAccumRedBits; - BYTE cAccumGreenBits; - BYTE cAccumBlueBits; - BYTE cAccumAlphaBits; - BYTE cDepthBits; - BYTE cStencilBits; - BYTE cAuxBuffers; - BYTE iLayerType; - BYTE bReserved; - DWORD dwLayerMask; - DWORD dwVisibleMask; - DWORD dwDamageMask; -} PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, FAR *LPPIXELFORMATDESCRIPTOR; -*/ #endif #define __glext_h_ @@ -265,14 +213,8 @@ typedef double GLdouble; typedef double GLclampd; typedef void GLvoid; -#ifndef _WIN32 +#ifdef _X11 -/*typedef void (* (APIENTRY * wglGetProcAddressPROC) (const GLubyte *procName))(void); - -extern wglGetProcAddressPROC wglGetProcAddress; - -#else -*/ #include #include @@ -354,12 +296,6 @@ extern glXQueryContextPROC glXQueryContext; extern glXSelectEventPROC glXSelectEvent; extern glXGetSelectedEventPROC glXGetSelectedEvent; -/*extern glXGetContextIDEXTPROC glXGetContextIDEXT; -extern glXGetCurrentDrawableEXTPROC glXGetCurrentDrawableEXT; -extern glXImportContextEXTPROC glXImportContextEXT; -extern glXFreeContextEXTPROC glXFreeContextEXT; -extern glXQueryContextInfoEXTPROC glXQueryContextInfoEXT; -*/ extern glXGetProcAddressARBPROC glXGetProcAddressARB; extern glXChooseVisualPROC glXChooseVisual; @@ -382,6 +318,7 @@ extern glXWaitXPROC glXWaitX; extern glXGetClientStringPROC glXGetClientString; extern glXQueryServerStringPROC glXQueryServerString; extern glXQueryExtensionsStringPROC glXQueryExtensionsString; + #endif /*************************************************************/ @@ -2349,20 +2286,6 @@ extern glSampleCoveragePROC glSampleCoverage; #ifndef GL_VERSION_1_4 #define GL_VERSION_1_4 -/*#ifndef GL_VERSION_1_2 -#define GL_BLEND_EQUATION 0x8009 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_BLEND_COLOR 0x8005 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#endif *//* GL_VERSION_1_2 */ - #define GL_GENERATE_MIPMAP 0x8191 #define GL_GENERATE_MIPMAP_HINT 0x8192 #define GL_DEPTH_COMPONENT16 0x81A5 @@ -2403,10 +2326,6 @@ extern glSampleCoveragePROC glSampleCoverage; #define GL_MAX_TEXTURE_LOD_BIAS 0x84FD #define GL_GL_MIRRORED_REPEAT 0x8370 -/*#ifndef GL_VERSION_1_2 -typedef void (APIENTRY * glBlendEquationPROC) (GLenum mode ); -typedef void (APIENTRY * glBlendColorPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); -#endif *//* GL_VERSION_1_2 */ typedef void (APIENTRY * glFogCoordfPROC) (GLfloat coord); typedef void (APIENTRY * glFogCoordfvPROC) (const GLfloat *coord); typedef void (APIENTRY * glFogCoorddPROC) (GLdouble coord); @@ -2451,11 +2370,6 @@ typedef void (APIENTRY * glWindowPos3fvPROC) (const GLfloat *p); typedef void (APIENTRY * glWindowPos3ivPROC) (const GLint *p); typedef void (APIENTRY * glWindowPos3svPROC) (const GLshort *p); -/*#ifndef GL_VERSION_1_2 -extern glBlendColorPROC glBlendColor; -extern glBlendEquationPROC glBlendEquation; -#endif *//* GL_VERSION_1_2 */ - extern glFogCoordfPROC glFogCoordf; extern glFogCoordfvPROC glFogCoordfv; extern glFogCoorddPROC glFogCoordd; @@ -2922,7 +2836,9 @@ typedef void (APIENTRY * wglFreeMemoryNVPROC) (void *pointer); extern wglAllocateMemoryNVPROC wglAllocateMemoryNV; extern wglFreeMemoryNVPROC wglFreeMemoryNV; -#else +#endif /* WIN32 */ + +#ifdef _X11 typedef void * (APIENTRY * glXAllocateMemoryNVPROC) (GLsizei size, GLfloat readFrequency, GLfloat writeFrequency, GLfloat priority); typedef void (APIENTRY * glXFreeMemoryNVPROC) (void *pointer); @@ -2930,7 +2846,7 @@ typedef void (APIENTRY * glXFreeMemoryNVPROC) (void *pointer); extern glXAllocateMemoryNVPROC glXAllocateMemoryNV; extern glXFreeMemoryNVPROC glXFreeMemoryNV; -#endif /* WIN32 */ +#endif /* X11 */ #endif /* GL_NV_vertex_array_range */ @@ -5541,7 +5457,9 @@ struct WGLExtensionTypes int NV_render_texture_rectangle; }; -#else /* No WIN32 */ +#endif /* WIN32 */ + +#ifdef _X11 struct GLXExtensionTypes { @@ -5551,7 +5469,7 @@ struct GLXExtensionTypes int EXT_visual_rating; }; -#endif /* WIN32 */ +#endif /* X11 */ struct GLUExtensionTypes { @@ -5565,9 +5483,10 @@ struct ExtensionTypes { #ifdef _WIN32 /* WGL extensions */ struct WGLExtensionTypes wgl; -#else /* no WIN32 */ - struct GLXExtensionTypes glx; #endif /* WIN32 */ +#ifdef _X11 + struct GLXExtensionTypes glx; +#endif /* X11 */ struct GLUExtensionTypes glu; int ARB_imaging; int ARB_depth_texture; @@ -5663,11 +5582,14 @@ extern struct ExtensionTypes SupportedExtensions; /* deprecated, please do not u /* initializes everything, call this right after the rc is created. the function returns 0 if successful */ int extgl_Initialize(); -#ifndef _WIN32 +#ifdef _X11 int extgl_Open(Display *disp, int screen); -#else +#endif + +#ifdef _WIN32 int extgl_Open(void); #endif + void extgl_Close(void); int glInitialize(); /* deprecated, please do not use */