From d8417f988a85f91d8f2a73106dbc8d4c10c67b98 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Wed, 20 Dec 2006 23:30:11 +0000 Subject: Added parameter validation for stereo bit in particular to fix problem with Java 3D QueryProperties demo; unclear, however, if that demo is returning correct results, as it always seems to report that stereo is available when it seems it isn't. Probably need to use new getChosenGLCapabilities() method to implement this more correctly in the Java 3D/JOGL pipeline. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1035 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/native/jogl/MacOSXWindowSystemInterface.m | 56 ++++++++++++--------------- 1 file changed, 25 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/native/jogl/MacOSXWindowSystemInterface.m b/src/native/jogl/MacOSXWindowSystemInterface.m index 5cf975c10..e7250b420 100644 --- a/src/native/jogl/MacOSXWindowSystemInterface.m +++ b/src/native/jogl/MacOSXWindowSystemInterface.m @@ -350,33 +350,26 @@ void getRendererInfo() #endif } -long validateParameter(NSOpenGLPixelFormatAttribute atttribute, long value) +long validateParameter(NSOpenGLPixelFormatAttribute attribute, long value) { - bool done = false; - int i; - for (i=0; iaccelerated != 0) { + switch (attribute) { + case NSOpenGLPFAStereo: + return renderer->stereo; + + case NSOpenGLPFAStencilSize: + return MIN(value, renderer->stencilSizeMAX); + + default: + break; + } + } + } - return value; + return value; } void* createPixelFormat(int* iattrs, int niattrs, int* ivalues) { @@ -411,7 +404,7 @@ void* createPixelFormat(int* iattrs, int niattrs, int* ivalues) { break; case NSOpenGLPFAStereo: - if (ivalues[i] != 0) { + if (ivalues[i] != 0 && (validateParameter(NSOpenGLPFAStereo, 0 /* dummy */) != 0)) { attribs[idx++] = NSOpenGLPFAStereo; } break; @@ -520,11 +513,12 @@ void* createContext(void* shareContext, initWithFormat: (NSOpenGLPixelFormat*) pixelFormat shareContext: (NSOpenGLContext*) shareContext]; - if (nsView != nil) - { - [nsContext setView:nsView]; - [nsView unlockFocus]; - } + if (nsContext != nil) { + if (nsView != nil) { + [nsContext setView:nsView]; + [nsView unlockFocus]; + } + } [pool release]; return nsContext; -- cgit v1.2.3