Index: OpenSceneGraph/trunk/src/osgViewer/PixelBufferCocoa.mm
===================================================================
--- OpenSceneGraph/trunk/src/osgViewer/PixelBufferCocoa.mm (revision 9879)
+++ OpenSceneGraph/trunk/src/osgViewer/PixelBufferCocoa.mm (revision 10887)
@@ -18,8 +18,8 @@
 void PixelBufferCocoa::init()
 {
-	//std::cout << "PixelBufferCocoa :: init not implemented yet " << std::endl;
-	
-	_valid = _initialized = true;    
-	
+    //std::cout << "PixelBufferCocoa :: init not implemented yet " << std::endl;
+    
+    _valid = _initialized = true;    
+    
 
 }
@@ -27,9 +27,9 @@
 bool PixelBufferCocoa::realizeImplementation() 
 {
-	std::cout << "PixelBufferCocoa :: realizeImplementation not implemented yet " << std::endl;
-	
+    std::cout << "PixelBufferCocoa :: realizeImplementation not implemented yet " << std::endl;
+    
     NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
-    	 
-	NSOpenGLPixelFormatAttribute attr[32];
+         
+    NSOpenGLPixelFormatAttribute attr[32];
     int i = 0;
     
@@ -66,18 +66,12 @@
     NSOpenGLContext* sharedContext = NULL;
     
-    GraphicsWindowCocoa* graphicsWindowCocoa = dynamic_cast<GraphicsWindowCocoa*>(_traits->sharedContext);
-    if (graphicsWindowCocoa) 
+    GraphicsHandleCocoa* graphicsHandleCocoa = dynamic_cast<GraphicsHandleCocoa*>(_traits->sharedContext);
+    if (graphicsHandleCocoa) 
     {
-        sharedContext = graphicsWindowCocoa->getContext();
+        sharedContext = graphicsHandleCocoa->getNSOpenGLContext();
     }
-    else
-    {
-        PixelBufferCocoa* pixelbuffer = dynamic_cast<PixelBufferCocoa*>(_traits->sharedContext);
-        if (pixelbuffer) {
-            sharedContext = pixelbuffer->getContext();
-        }
-    }
-	
-	NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ];
+    
+    
+    NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ];
     _context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext];
     NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget: _traits->target textureInternalFormat: _traits->format textureMaxMipMapLevel: _traits->level pixelsWide: _traits->width pixelsHigh: _traits->height];
@@ -94,5 +88,5 @@
 void PixelBufferCocoa::closeImplementation()
 {
-	_realized = false;
+    _realized = false;
     
     
@@ -104,8 +98,8 @@
 bool PixelBufferCocoa::makeCurrentImplementation()
 {
-	// osg::notify(osg::INFO) << "PixelBufferCocoa::makeCurrentImplementation" << std::endl;
+    // osg::notify(osg::INFO) << "PixelBufferCocoa::makeCurrentImplementation" << std::endl;
     
     [_context makeCurrentContext];
-	return true;
+    return true;
 }
 
@@ -114,5 +108,5 @@
 bool PixelBufferCocoa::makeContextCurrentImplementation(osg::GraphicsContext* readContext)
 {
-	return makeCurrentImplementation();
+    return makeCurrentImplementation();
 }
 
@@ -120,5 +114,5 @@
 bool PixelBufferCocoa::releaseContextImplementation()
 {
-	// osg::notify(osg::INFO) << "PixelBufferCocoa::releaseContextImplementation" << std::endl;
+    // osg::notify(osg::INFO) << "PixelBufferCocoa::releaseContextImplementation" << std::endl;
     
     [NSOpenGLContext clearCurrentContext];
@@ -129,5 +123,5 @@
 void PixelBufferCocoa::bindPBufferToTextureImplementation( GLenum buffer )
 {
-	std::cout << "PixelBufferCocoa :: bindPBufferToTextureImplementation not implemented yet " << std::endl;
+    std::cout << "PixelBufferCocoa :: bindPBufferToTextureImplementation not implemented yet " << std::endl;
 }
 
@@ -135,10 +129,10 @@
 void PixelBufferCocoa::swapBuffersImplementation()
 {
-	osg::notify(osg::INFO) << "PixelBufferCocoa::swapBuffersImplementation" << std::endl;
+    osg::notify(osg::INFO) << "PixelBufferCocoa::swapBuffersImplementation" << std::endl;
     [_context flushBuffer];
 }
 
  PixelBufferCocoa::~PixelBufferCocoa()
- {	
+ {    
     [_context release];
  }
