diff options
author | Gerard Ziemski <[email protected]> | 2006-01-18 21:37:07 +0000 |
---|---|---|
committer | Gerard Ziemski <[email protected]> | 2006-01-18 21:37:07 +0000 |
commit | 4b573c7ecdf1798893355b011e18e4b72b1a315c (patch) | |
tree | bcef9fcdee03fa3121288de91abe805c56faa7e0 /src/native/jogl | |
parent | e390d88700b18d8748d64943c85fa3f6c921f11e (diff) |
add support for availability macros and use them to substitue values in case of nondefined ones
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@550 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/native/jogl')
-rw-r--r-- | src/native/jogl/MacOSXWindowSystemInterface.m | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/native/jogl/MacOSXWindowSystemInterface.m b/src/native/jogl/MacOSXWindowSystemInterface.m index e554379ec..e56eaa20c 100644 --- a/src/native/jogl/MacOSXWindowSystemInterface.m +++ b/src/native/jogl/MacOSXWindowSystemInterface.m @@ -1,3 +1,14 @@ +#include <AvailabilityMacros.h> + +#ifndef MAC_OS_X_VERSION_10_3 + #error building JOGL requires Mac OS X 10.3 or greater +#endif + +#ifndef MAC_OS_X_VERSION_10_4 + #define NSOpenGLPFAColorFloat kCGLPFAColorFloat + #define kCGLNoError 0 +#endif + #import <Cocoa/Cocoa.h> #import <OpenGL/gl.h> #import <OpenGL/CGLTypes.h> @@ -33,21 +44,21 @@ void getRendererInfo() CGLRendererInfoObj info; long numRenderers = 0; CGLError err = CGLQueryRendererInfo(CGDisplayIDToOpenGLDisplayMask(kCGDirectMainDisplay), &info, &numRenderers); - if (err == 0 /* kCGLNoError not available on 10.3 */) + if (err == kCGLNoError) { CGLDescribeRenderer(info, 0, kCGLRPRendererCount, &numRenderers); long j; for (j=0; j<numRenderers; j++) { - unsigned long accRenderer = 0; - CGLDescribeRenderer (info, j, kCGLRPAccelerated, &accRenderer); + long accRenderer = 0; + CGLDescribeRenderer(info, j, kCGLRPAccelerated, &accRenderer); if (accRenderer != 0) { // get the accelerated renderer ID CGLDescribeRenderer(info, j, kCGLRPRendererID, &accRenderID); // get the max color buffer depth - unsigned long colorModes = 0; + long colorModes = 0; CGLDescribeRenderer(info, j, kCGLRPColorModes, &colorModes); int i; for (i=0; i<bufferDepthsLength; i++) @@ -60,7 +71,7 @@ void getRendererInfo() } // get the max depth buffer depth - unsigned long depthModes = 0; + long depthModes = 0; CGLDescribeRenderer(info, j, kCGLRPDepthModes, &depthModes); for (i=0; i<bufferDepthsLength; i++) { @@ -72,7 +83,7 @@ void getRendererInfo() } // get the max accum buffer depth - unsigned long accumModes = 0; + long accumModes = 0; CGLDescribeRenderer(info, j, kCGLRPAccumModes, &accumModes); for (i=0; i<bufferDepthsLength; i++) { @@ -84,7 +95,7 @@ void getRendererInfo() } // get the max stencil buffer depth - unsigned long stencilModes = 0; + long stencilModes = 0; CGLDescribeRenderer(info, j, kCGLRPStencilModes, &stencilModes); for (i=0; i<bufferDepthsLength; i++) { @@ -178,10 +189,7 @@ void* createContext(void* shareContext, void* view, NSOpenGLPixelFormatAttribute attribs[256]; int idx = 0; if (pbuffer) attribs[idx++] = NSOpenGLPFAPixelBuffer; - // kCGLPFAColorFloat is equivalent to NSOpenGLPFAColorFloat, but the - // latter is only available on 10.4 and we need to compile under - // 10.3 - if (floatingPoint) attribs[idx++] = kCGLPFAColorFloat; + if (floatingPoint) attribs[idx++] = NSOpenGLPFAColorFloat; if (doubleBuffer) attribs[idx++] = NSOpenGLPFADoubleBuffer; if (stereo) attribs[idx++] = NSOpenGLPFAStereo; attribs[idx++] = NSOpenGLPFAColorSize; attribs[idx++] = colorSize; |