From 63eee14ddf37aaf1f0ada9478cf2cb318041e586 Mon Sep 17 00:00:00 2001 From: Gregory Pierce Date: Wed, 1 Jan 2003 23:05:26 +0000 Subject: [PATCH] Moved typedefs into extgl.h so that OpenGL symbols not multiply defined - removes 650 warnings. Removed all imports of agl.h and gl.h. Removed OpenGL.framework from the project --- src/native/common/extgl.h | 79 ++++++++++++++++++++++++++ src/native/macosx/RenderingContext.cpp | 33 +++++++---- src/native/macosx/RenderingContext.h | 3 +- 3 files changed, 102 insertions(+), 13 deletions(-) diff --git a/src/native/common/extgl.h b/src/native/common/extgl.h index 9fe812a2..88c24ef2 100644 --- a/src/native/common/extgl.h +++ b/src/native/common/extgl.h @@ -327,11 +327,90 @@ extern glXQueryExtensionsStringPROC glXQueryExtensionsString; #ifdef _OSX #include +#include +#include +#include + +typedef struct __AGLRendererInfoRec *AGLRendererInfo; +typedef struct __AGLPixelFormatRec *AGLPixelFormat; +typedef struct __AGLContextRec *AGLContext; + +typedef GDHandle AGLDevice; +typedef CGrafPtr AGLDrawable; OSStatus aglInitEntryPoints(void); void aglDellocEntryPoints (void); void * aglGetProcAddress (char * pszProc); +typedef AGLPixelFormat (APIENTRY * aglChoosePixelFormatEXTPROC)(const AGLDevice *gdevs, GLint ndev, const GLint *attribs); +typedef void (APIENTRY * aglDestroyPixelFormatEXTPROC)(AGLPixelFormat pix); +typedef AGLPixelFormat (APIENTRY * aglNextPixelFormatEXTPROC)(AGLPixelFormat pix); +typedef GLboolean (APIENTRY * aglDescribePixelFormatEXTPROC)(AGLPixelFormat pix, GLint attrib, GLint *value); +typedef AGLDevice * (APIENTRY * aglDevicesOfPixelFormatEXTPROC)(AGLPixelFormat pix, GLint *ndevs); +typedef AGLRendererInfo (APIENTRY * aglQueryRendererInfoEXTPROC)(const AGLDevice *gdevs, GLint ndev); +typedef void (APIENTRY * aglDestroyRendererInfoEXTPROC)(AGLRendererInfo rend); +typedef AGLRendererInfo (APIENTRY * aglNextRendererInfoEXTPROC)(AGLRendererInfo rend); +typedef GLboolean (APIENTRY * aglDescribeRendererEXTPROC)(AGLRendererInfo rend, GLint prop, GLint *value); +typedef AGLContext (APIENTRY * aglCreateContextEXTPROC)(AGLPixelFormat pix, AGLContext share); +typedef GLboolean (APIENTRY * aglDestroyContextEXTPROC)(AGLContext ctx); +typedef GLboolean (APIENTRY * aglCopyContextEXTPROC)(AGLContext src, AGLContext dst, GLuint mask); +typedef GLboolean (APIENTRY * aglUpdateContextEXTPROC)(AGLContext ctx); +typedef GLboolean (APIENTRY * aglSetCurrentContextEXTPROC)(AGLContext ctx); +typedef AGLContext (APIENTRY * aglGetCurrentContextEXTPROC)(void); +typedef GLboolean (APIENTRY * aglSetDrawableEXTPROC)(AGLContext ctx, AGLDrawable draw); +typedef GLboolean (APIENTRY * aglSetOffScreenEXTPROC)(AGLContext ctx, GLsizei width, GLsizei height, GLsizei rowbytes, GLvoid *baseaddr); +typedef GLboolean (APIENTRY * aglSetFullScreenEXTPROC)(AGLContext ctx, GLsizei width, GLsizei height, GLsizei freq, GLint device); +typedef AGLDrawable (APIENTRY * aglGetDrawableEXTPROC)(AGLContext ctx); +typedef GLboolean (APIENTRY * aglSetVirtualScreenEXTPROC)(AGLContext ctx, GLint screen); +typedef GLint (APIENTRY * aglGetVirtualScreenEXTPROC)(AGLContext ctx); +typedef void (APIENTRY * aglGetVersionEXTPROC)(GLint *major, GLint *minor); +typedef void (APIENTRY * aglSwapBuffersEXTPROC)(AGLContext ctx); +typedef GLboolean (APIENTRY * aglEnableEXTPROC)(AGLContext ctx, GLenum pname); +typedef GLboolean (APIENTRY * aglDisableEXTPROC)(AGLContext ctx, GLenum pname); +typedef GLboolean (APIENTRY * aglIsEnabledEXTPROC)(AGLContext ctx, GLenum pname); +typedef GLboolean (APIENTRY * aglSetIntegerEXTPROC)(AGLContext ctx, GLenum pname, const GLint *params); +typedef GLboolean (APIENTRY * aglGetIntegerEXTPROC)(AGLContext ctx, GLenum pname, GLint *params); +typedef GLboolean (APIENTRY * aglUseFontEXTPROC)(AGLContext ctx, GLint fontID, Style face, GLint size, GLint first, GLint count, GLint base); +typedef GLenum (APIENTRY * aglGetErrorEXTPROC)(void); +typedef const GLubyte * (APIENTRY * aglErrorStringEXTPROC)(GLenum code); +typedef void (APIENTRY * aglResetLibraryEXTPROC)(void); +typedef void (APIENTRY * aglSurfaceTextureEXTPROC) (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext); + +extern aglChoosePixelFormatEXTPROC aglChoosePixelFormat; +extern aglDestroyPixelFormatEXTPROC aglDestroyPixelFormat; +extern aglNextPixelFormatEXTPROC aglNextPixelFormat; +extern aglDescribePixelFormatEXTPROC aglDescribePixelFormat; +extern aglDevicesOfPixelFormatEXTPROC aglDevicesOfPixelFormat; +extern aglQueryRendererInfoEXTPROC aglQueryRendererInfo; +extern aglDestroyRendererInfoEXTPROC aglDestroyRendererInfo; +extern aglNextRendererInfoEXTPROC aglNextRendererInfo; +extern aglDescribeRendererEXTPROC aglDescribeRenderer; +extern aglCreateContextEXTPROC aglCreateContext; +extern aglDestroyContextEXTPROC aglDestroyContext; +extern aglCopyContextEXTPROC aglCopyContext; +extern aglUpdateContextEXTPROC aglUpdateContext; +extern aglSetCurrentContextEXTPROC aglSetCurrentContext; +extern aglGetCurrentContextEXTPROC aglGetCurrentContext; +extern aglSetDrawableEXTPROC aglSetDrawable; +extern aglSetOffScreenEXTPROC aglSetOffScreen; +extern aglSetFullScreenEXTPROC aglSetFullScreen; +extern aglGetDrawableEXTPROC aglGetDrawable; +extern aglSetVirtualScreenEXTPROC aglSetVirtualScreen; +extern aglGetVirtualScreenEXTPROC aglGetVirtualScreen; +extern aglGetVersionEXTPROC aglGetVersion; +extern aglSwapBuffersEXTPROC aglSwapBuffers; +extern aglEnableEXTPROC aglEnable; +extern aglDisableEXTPROC aglDisable; +extern aglIsEnabledEXTPROC aglIsEnabled; +extern aglSetIntegerEXTPROC aglSetInteger; +extern aglGetIntegerEXTPROC aglGetInteger; +extern aglUseFontEXTPROC aglUseFont; +extern aglGetErrorEXTPROC aglGetError; +extern aglErrorStringEXTPROC aglErrorString; +extern aglResetLibraryEXTPROC aglResetlibrary; +extern aglSurfaceTextureEXTPROC aglSurfaceTexture; + + #endif /* OSX */ /*************************************************************/ diff --git a/src/native/macosx/RenderingContext.cpp b/src/native/macosx/RenderingContext.cpp index 5cb77c76..6049b00c 100644 --- a/src/native/macosx/RenderingContext.cpp +++ b/src/native/macosx/RenderingContext.cpp @@ -69,10 +69,13 @@ void RenderingContext::destroyDisplay() { // cleanup the AGL context // + aglSetCurrentContext(NULL); + /* aglSetDrawable(aglContext, NULL); aglDestroyContext(aglContext); - + */ + // cleanup the window // DisposeWindow( windowPtr ); @@ -80,6 +83,7 @@ void RenderingContext::destroyDisplay() bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, int stencilBits ) { + /* AGLPixelFormat fmt; GLboolean ok; GLint attrib[] = { AGL_RGBA, AGL_NONE }; @@ -91,28 +95,32 @@ bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, in return false; } - /* Choose an rgb pixel format */ + // Choose an rgb pixel format + // fmt = aglChoosePixelFormat(NULL, 0, attrib); if(fmt == NULL) { return false; } - /* Create an AGL context */ + // Create an AGL context + // aglContext = aglCreateContext(fmt, NULL); if( aglContext == NULL) { return false; } - /* Attach the window to the context */ + // Attach the window to the context + // ok = aglSetDrawable(aglContext, GetWindowPort(windowPtr) ); if(!ok) { return false; } - /* Make the context the current context */ + // Make the context the current context + // ok = aglSetCurrentContext(aglContext); if(!ok) { @@ -125,7 +133,8 @@ bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, in return false; } - /* Pixel format is no longer needed */ + // Pixel format is no longer needed + // aglDestroyPixelFormat(fmt); #ifdef _DEBUG @@ -138,8 +147,8 @@ bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, in { printf("Available extensions:\n%s\n", p); } -#endif /* DEBUG */ - +#endif +*/ return true; } @@ -152,7 +161,7 @@ void RenderingContext::destroyGL() // destroy the context // - aglDestroyContext( aglContext ); + //aglDestroyContext( aglContext ); // close the gl extension context // @@ -163,21 +172,21 @@ void RenderingContext::swap() { // swap the rendering buffer // - aglSwapBuffers( aglContext ); + //aglSwapBuffers( aglContext ); } void RenderingContext::makeContextCurrent() { // make the current context the one we have stored // - aglSetCurrentContext( aglContext ); + //aglSetCurrentContext( aglContext ); } void RenderingContext::releaseContext() { // release the context // - aglSetCurrentContext( NULL ); + // aglSetCurrentContext( NULL ); } RenderingContext::~RenderingContext() diff --git a/src/native/macosx/RenderingContext.h b/src/native/macosx/RenderingContext.h index 4adc1b36..77ba00b5 100644 --- a/src/native/macosx/RenderingContext.h +++ b/src/native/macosx/RenderingContext.h @@ -42,9 +42,10 @@ #ifndef _RENDERING_CONTEXT_H #define _RENDERING_CONTEXT_H +#define _OSX #include "extgl.h" +//#include #include -#include class RenderingContext {