Comment out GLX code for MacOS and (hopefully) add some MacOS AGL compattible code. More needs to be done though.

This commit is contained in:
ehofman
2005-02-01 10:35:43 +00:00
parent e5f82f53b9
commit 72f35dc914
2 changed files with 64 additions and 9 deletions

View File

@@ -122,6 +122,7 @@ RenderTexture::RenderTexture(const char *strMode)
_hPBuffer(NULL),
_hPreviousDC(0),
_hPreviousContext(0),
#elif defined( __APPLE__ )
#else
_pDisplay(NULL),
_hGLContext(NULL),
@@ -145,6 +146,7 @@ RenderTexture::RenderTexture(const char *strMode)
_pbufferAttribs.push_back(WGL_PBUFFER_LARGEST_ARB);
_pbufferAttribs.push_back(true);
#elif defined( __APPLE__ )
#else
_pbufferAttribs.push_back(GLX_RENDER_TYPE_SGIX);
_pbufferAttribs.push_back(GLX_RGBA_BIT_SGIX);
@@ -440,6 +442,7 @@ bool RenderTexture::Initialize(int width, int height,
fprintf(stderr, "\n");
#endif
#elif defined( __APPLE__ )
#else // !_WIN32
_pDisplay = glXGetCurrentDisplay();
GLXContext context = glXGetCurrentContext();
@@ -521,6 +524,7 @@ bool RenderTexture::Initialize(int width, int height,
_wglGetLastError();
return false;
}
#elif defined( __APPLE__ )
#else
_hPreviousContext = glXGetCurrentContext();
_hPreviousDrawable = glXGetCurrentDrawable();
@@ -545,6 +549,7 @@ bool RenderTexture::Initialize(int width, int height,
_wglGetLastError();
return false;
}
#elif defined( __APPLE__ )
#else
if (False == glXMakeCurrent(_pDisplay,
_hPreviousDrawable, _hPreviousContext))
@@ -596,6 +601,7 @@ bool RenderTexture::_Invalidate()
_hPBuffer = 0;
return true;
}
#elif defined( __APPLE__ )
#else
if ( _hPBuffer )
{
@@ -666,6 +672,7 @@ bool RenderTexture::Reset(const char *strMode, ...)
_pbufferAttribs.push_back(WGL_PBUFFER_LARGEST_ARB);
_pbufferAttribs.push_back(true);
#elif defined( __APPLE__ )
#else
_pbufferAttribs.push_back(GLX_RENDER_TYPE_SGIX);
_pbufferAttribs.push_back(GLX_RGBA_BIT_SGIX);
@@ -735,6 +742,7 @@ bool RenderTexture::Resize(int iWidth, int iHeight)
_hPBuffer = 0;
return true;
}
#elif defined( __APPLE__ )
#else
if ( _hPBuffer )
{
@@ -777,6 +785,7 @@ bool RenderTexture::BeginCapture()
_hPreviousContext = wglGetCurrentContext();
if (NULL == _hPreviousContext)
_wglGetLastError();
#elif defined( __APPLE__ )
#else
_hPreviousContext = glXGetCurrentContext();
_hPreviousDrawable = glXGetCurrentDrawable();
@@ -814,6 +823,7 @@ bool RenderTexture::EndCapture()
_wglGetLastError();
return false;
}
#elif defined( __APPLE__ )
#else
if (False == glXMakeCurrent(_pDisplay, _hPreviousDrawable,
_hPreviousContext))
@@ -883,6 +893,7 @@ bool RenderTexture::BeginCapture(RenderTexture* current)
_hPreviousContext = current->_hPreviousContext;
if (NULL == _hPreviousContext)
_wglGetLastError();
#elif defined( __APPLE__ )
#else
_hPreviousContext = current->_hPreviousContext;
_hPreviousDrawable = current->_hPreviousDrawable;
@@ -1066,17 +1077,22 @@ void RenderTexture::_ParseModeString(const char *modeString,
pfAttribs.push_back(bitVec[1]);
pfAttribs.push_back(WGL_BLUE_BITS_ARB);
pfAttribs.push_back(bitVec[2]);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
pfAttribs.push_back(AGL_GREEN_SIZE);
pfAttribs.push_back(bitVec[1]);
pfAttribs.push_back(AGL_BLUE_SIZE);
pfAttribs.push_back(bitVec[2]);
#else
# ifndef sgi
pfAttribs.push_back(GLX_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
pfAttribs.push_back(GLX_GREEN_SIZE);
pfAttribs.push_back(bitVec[1]);
pfAttribs.push_back(GLX_BLUE_SIZE);
pfAttribs.push_back(bitVec[2]);
# endif
#endif
_iNumComponents += 3;
_iNumComponents += 3;
continue;
}
else if (kv.first == "rgb")
@@ -1109,8 +1125,16 @@ void RenderTexture::_ParseModeString(const char *modeString,
pfAttribs.push_back(bitVec[2]);
pfAttribs.push_back(WGL_ALPHA_BITS_ARB);
pfAttribs.push_back(bitVec[3]);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
pfAttribs.push_back(AGL_GREEN_SIZE);
pfAttribs.push_back(bitVec[1]);
pfAttribs.push_back(AGL_BLUE_SIZE);
pfAttribs.push_back(bitVec[2]);
pfAttribs.push_back(AGL_ALPHA_SIZE);
pfAttribs.push_back(bitVec[3]);
#else
# ifndef sgi
pfAttribs.push_back(GLX_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
pfAttribs.push_back(GLX_GREEN_SIZE);
@@ -1119,9 +1143,8 @@ void RenderTexture::_ParseModeString(const char *modeString,
pfAttribs.push_back(bitVec[2]);
pfAttribs.push_back(GLX_ALPHA_SIZE);
pfAttribs.push_back(bitVec[3]);
# endif
#endif
_iNumComponents = 4;
_iNumComponents = 4;
continue;
}
else if (kv.first == "rgba")
@@ -1140,6 +1163,9 @@ void RenderTexture::_ParseModeString(const char *modeString,
#ifdef _WIN32
pfAttribs.push_back(WGL_RED_BITS_ARB);
pfAttribs.push_back(bitVec[0]);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
#else
pfAttribs.push_back(GLX_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
@@ -1170,6 +1196,11 @@ void RenderTexture::_ParseModeString(const char *modeString,
pfAttribs.push_back(bitVec[0]);
pfAttribs.push_back(WGL_GREEN_BITS_ARB);
pfAttribs.push_back(bitVec[1]);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
pfAttribs.push_back(AGL_GREEN_SIZE);
pfAttribs.push_back(bitVec[1]);
#else
pfAttribs.push_back(GLX_RED_SIZE);
pfAttribs.push_back(bitVec[0]);
@@ -1199,6 +1230,8 @@ void RenderTexture::_ParseModeString(const char *modeString,
bHasStencil = true;
#ifdef _WIN32
pfAttribs.push_back(WGL_STENCIL_BITS_ARB);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_STENCIL_SIZE);
#else
pfAttribs.push_back(GLX_STENCIL_SIZE);
#endif
@@ -1216,6 +1249,11 @@ void RenderTexture::_ParseModeString(const char *modeString,
pfAttribs.push_back(1);
pfAttribs.push_back(WGL_SAMPLES_ARB);
pfAttribs.push_back(strtol(kv.second.c_str(), 0, 10));
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_SAMPLE_BUFFERS_ARB);
pfAttribs.push_back(1);
pfAttribs.push_back(AGL_SAMPLES_ARB);
pfAttribs.push_back(strtol(kv.second.c_str(), 0, 10));
#else
pfAttribs.push_back(GL_SAMPLE_BUFFERS_ARB);
pfAttribs.push_back(1);
@@ -1231,6 +1269,9 @@ void RenderTexture::_ParseModeString(const char *modeString,
#ifdef _WIN32
pfAttribs.push_back(WGL_DOUBLE_BUFFER_ARB);
pfAttribs.push_back(true);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_DOUBLEBUFFER);
pfAttribs.push_back(True);
#else
pfAttribs.push_back(GL_DOUBLEBUFFER);
pfAttribs.push_back(True);
@@ -1242,6 +1283,8 @@ void RenderTexture::_ParseModeString(const char *modeString,
{
#ifdef _WIN32
pfAttribs.push_back(WGL_AUX_BUFFERS_ARB);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_AUX_BUFFERS);
#else
pfAttribs.push_back(GL_AUX_BUFFERS);
#endif
@@ -1349,6 +1392,8 @@ void RenderTexture::_ParseModeString(const char *modeString,
#ifdef _WIN32
pfAttribs.push_back(WGL_DEPTH_BITS_ARB);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_DEPTH_SIZE);
#else
pfAttribs.push_back(GLX_DEPTH_SIZE);
#endif
@@ -1359,6 +1404,9 @@ void RenderTexture::_ParseModeString(const char *modeString,
#ifdef _WIN32
pfAttribs.push_back(WGL_STENCIL_BITS_ARB);
pfAttribs.push_back(0);
#elif defined( __APPLE__ )
pfAttribs.push_back(AGL_STENCIL_SIZE);
pfAttribs.push_back(0);
#else
pfAttribs.push_back(GLX_STENCIL_SIZE);
pfAttribs.push_back(0);
@@ -1414,7 +1462,7 @@ void RenderTexture::_ParseModeString(const char *modeString,
#elif defined(DEBUG) || defined(_DEBUG)
printf("RenderTexture Error: Render to Texture not "
"supported in Linux\n");
"supported in Linux or MacOS\n");
#endif
}
@@ -1435,6 +1483,7 @@ void RenderTexture::_ParseModeString(const char *modeString,
pfAttribs.push_back(WGL_PIXEL_TYPE_ARB);
pfAttribs.push_back(WGL_TYPE_RGBA_FLOAT_ATI);
}
#elif defined( __APPLE__ )
#else
if (GL_NV_float_buffer)
{
@@ -1548,7 +1597,7 @@ void RenderTexture::_ParseModeString(const char *modeString,
#elif defined(DEBUG) || defined(_DEBUG)
fprintf(stderr,
"RenderTexture Error: Render to Texture not supported in "
"Linux\n");
"Linux or MacOS\ n");
#endif
}
@@ -1573,7 +1622,7 @@ void RenderTexture::_ParseModeString(const char *modeString,
}
#elif defined(DEBUG) || defined(_DEBUG)
printf("RenderTexture Error: Render to Texture not supported in "
"Linux\n");
"Linux or MacOS\n");
#endif
}
}
@@ -1720,6 +1769,7 @@ bool RenderTexture::_VerifyExtensions()
}
SetLastError(0);
}
#elif defined( __APPLE__ )
#else
if (!GLX_SGIX_pbuffer)
{
@@ -2042,6 +2092,7 @@ bool RenderTexture::_MakeCurrent()
_wglGetLastError();
return false;
}
#elif defined( __APPLE__ )
#else
if (false == glXMakeCurrent(_pDisplay, _hPBuffer, _hGLContext))
{
@@ -2093,6 +2144,7 @@ RenderTexture::RenderTexture(int width, int height,
_hPBuffer(NULL),
_hPreviousDC(0),
_hPreviousContext(0),
#elif defined( __APPLE__ )
#else
_pDisplay(NULL),
_hGLContext(NULL),
@@ -2209,6 +2261,7 @@ bool RenderTexture::Initialize(bool bShare /* = true */,
_pbufferAttribs.push_back(WGL_PBUFFER_LARGEST_ARB);
_pbufferAttribs.push_back(true);
#elif defined( __APPLE__ )
#else
_pixelFormatAttribs.push_back(GLX_RENDER_TYPE_SGIX);
_pixelFormatAttribs.push_back(GLX_RGBA_BIT_SGIX);

View File

@@ -337,6 +337,8 @@ protected: // data
HDC _hPreviousDC;
HGLRC _hPreviousContext;
#elif defined( __APPLE__ )
#else
Display *_pDisplay;
GLXContext _hGLContext;