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
This commit is contained in:
parent
f48be98ee9
commit
63eee14ddf
|
@ -327,11 +327,90 @@ extern glXQueryExtensionsStringPROC glXQueryExtensionsString;
|
||||||
|
|
||||||
#ifdef _OSX
|
#ifdef _OSX
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
|
#include <OpenGL/gliContext.h>
|
||||||
|
#include <OpenGL/gliDispatch.h>
|
||||||
|
#include <AGL/aglContext.h>
|
||||||
|
|
||||||
|
typedef struct __AGLRendererInfoRec *AGLRendererInfo;
|
||||||
|
typedef struct __AGLPixelFormatRec *AGLPixelFormat;
|
||||||
|
typedef struct __AGLContextRec *AGLContext;
|
||||||
|
|
||||||
|
typedef GDHandle AGLDevice;
|
||||||
|
typedef CGrafPtr AGLDrawable;
|
||||||
|
|
||||||
OSStatus aglInitEntryPoints(void);
|
OSStatus aglInitEntryPoints(void);
|
||||||
void aglDellocEntryPoints (void);
|
void aglDellocEntryPoints (void);
|
||||||
void * aglGetProcAddress (char * pszProc);
|
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 */
|
#endif /* OSX */
|
||||||
|
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
|
|
@ -69,9 +69,12 @@ void RenderingContext::destroyDisplay()
|
||||||
{
|
{
|
||||||
// cleanup the AGL context
|
// cleanup the AGL context
|
||||||
//
|
//
|
||||||
|
|
||||||
aglSetCurrentContext(NULL);
|
aglSetCurrentContext(NULL);
|
||||||
|
/*
|
||||||
aglSetDrawable(aglContext, NULL);
|
aglSetDrawable(aglContext, NULL);
|
||||||
aglDestroyContext(aglContext);
|
aglDestroyContext(aglContext);
|
||||||
|
*/
|
||||||
|
|
||||||
// cleanup the window
|
// cleanup the window
|
||||||
//
|
//
|
||||||
|
@ -80,6 +83,7 @@ void RenderingContext::destroyDisplay()
|
||||||
|
|
||||||
bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, int stencilBits )
|
bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, int stencilBits )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
AGLPixelFormat fmt;
|
AGLPixelFormat fmt;
|
||||||
GLboolean ok;
|
GLboolean ok;
|
||||||
GLint attrib[] = { AGL_RGBA, AGL_NONE };
|
GLint attrib[] = { AGL_RGBA, AGL_NONE };
|
||||||
|
@ -91,28 +95,32 @@ bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, in
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Choose an rgb pixel format */
|
// Choose an rgb pixel format
|
||||||
|
//
|
||||||
fmt = aglChoosePixelFormat(NULL, 0, attrib);
|
fmt = aglChoosePixelFormat(NULL, 0, attrib);
|
||||||
if(fmt == NULL)
|
if(fmt == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an AGL context */
|
// Create an AGL context
|
||||||
|
//
|
||||||
aglContext = aglCreateContext(fmt, NULL);
|
aglContext = aglCreateContext(fmt, NULL);
|
||||||
if( aglContext == NULL)
|
if( aglContext == NULL)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach the window to the context */
|
// Attach the window to the context
|
||||||
|
//
|
||||||
ok = aglSetDrawable(aglContext, GetWindowPort(windowPtr) );
|
ok = aglSetDrawable(aglContext, GetWindowPort(windowPtr) );
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make the context the current context */
|
// Make the context the current context
|
||||||
|
//
|
||||||
ok = aglSetCurrentContext(aglContext);
|
ok = aglSetCurrentContext(aglContext);
|
||||||
if(!ok)
|
if(!ok)
|
||||||
{
|
{
|
||||||
|
@ -125,7 +133,8 @@ bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, in
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pixel format is no longer needed */
|
// Pixel format is no longer needed
|
||||||
|
//
|
||||||
aglDestroyPixelFormat(fmt);
|
aglDestroyPixelFormat(fmt);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -138,8 +147,8 @@ bool RenderingContext::createGL( int colorBits, int alphaBits, int depthBits, in
|
||||||
{
|
{
|
||||||
printf("Available extensions:\n%s\n", p);
|
printf("Available extensions:\n%s\n", p);
|
||||||
}
|
}
|
||||||
#endif /* DEBUG */
|
#endif
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -152,7 +161,7 @@ void RenderingContext::destroyGL()
|
||||||
|
|
||||||
// destroy the context
|
// destroy the context
|
||||||
//
|
//
|
||||||
aglDestroyContext( aglContext );
|
//aglDestroyContext( aglContext );
|
||||||
|
|
||||||
// close the gl extension context
|
// close the gl extension context
|
||||||
//
|
//
|
||||||
|
@ -163,21 +172,21 @@ void RenderingContext::swap()
|
||||||
{
|
{
|
||||||
// swap the rendering buffer
|
// swap the rendering buffer
|
||||||
//
|
//
|
||||||
aglSwapBuffers( aglContext );
|
//aglSwapBuffers( aglContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingContext::makeContextCurrent()
|
void RenderingContext::makeContextCurrent()
|
||||||
{
|
{
|
||||||
// make the current context the one we have stored
|
// make the current context the one we have stored
|
||||||
//
|
//
|
||||||
aglSetCurrentContext( aglContext );
|
//aglSetCurrentContext( aglContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingContext::releaseContext()
|
void RenderingContext::releaseContext()
|
||||||
{
|
{
|
||||||
// release the context
|
// release the context
|
||||||
//
|
//
|
||||||
aglSetCurrentContext( NULL );
|
// aglSetCurrentContext( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderingContext::~RenderingContext()
|
RenderingContext::~RenderingContext()
|
||||||
|
|
|
@ -42,9 +42,10 @@
|
||||||
#ifndef _RENDERING_CONTEXT_H
|
#ifndef _RENDERING_CONTEXT_H
|
||||||
#define _RENDERING_CONTEXT_H
|
#define _RENDERING_CONTEXT_H
|
||||||
|
|
||||||
|
#define _OSX
|
||||||
#include "extgl.h"
|
#include "extgl.h"
|
||||||
|
//#include <OpenGL/glext.h>
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <AGL/agl.h>
|
|
||||||
|
|
||||||
class RenderingContext
|
class RenderingContext
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue