Changeset 10887 for OpenSceneGraph/trunk/src/osgViewer/PixelBufferCocoa.mm
- Timestamp:
- 12/10/09 18:52:40 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgViewer/PixelBufferCocoa.mm
r9879 r10887 18 18 void PixelBufferCocoa::init() 19 19 { 20 //std::cout << "PixelBufferCocoa :: init not implemented yet " << std::endl;21 22 _valid = _initialized = true;23 20 //std::cout << "PixelBufferCocoa :: init not implemented yet " << std::endl; 21 22 _valid = _initialized = true; 23 24 24 25 25 } … … 27 27 bool PixelBufferCocoa::realizeImplementation() 28 28 { 29 std::cout << "PixelBufferCocoa :: realizeImplementation not implemented yet " << std::endl;30 29 std::cout << "PixelBufferCocoa :: realizeImplementation not implemented yet " << std::endl; 30 31 31 NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; 32 33 NSOpenGLPixelFormatAttribute attr[32];32 33 NSOpenGLPixelFormatAttribute attr[32]; 34 34 int i = 0; 35 35 … … 66 66 NSOpenGLContext* sharedContext = NULL; 67 67 68 Graphics WindowCocoa* graphicsWindowCocoa = dynamic_cast<GraphicsWindowCocoa*>(_traits->sharedContext);69 if (graphics WindowCocoa)68 GraphicsHandleCocoa* graphicsHandleCocoa = dynamic_cast<GraphicsHandleCocoa*>(_traits->sharedContext); 69 if (graphicsHandleCocoa) 70 70 { 71 sharedContext = graphics WindowCocoa->getContext();71 sharedContext = graphicsHandleCocoa->getNSOpenGLContext(); 72 72 } 73 else 74 { 75 PixelBufferCocoa* pixelbuffer = dynamic_cast<PixelBufferCocoa*>(_traits->sharedContext); 76 if (pixelbuffer) { 77 sharedContext = pixelbuffer->getContext(); 78 } 79 } 80 81 NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ]; 73 74 75 NSOpenGLPixelFormat* pixelformat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr ]; 82 76 _context = [[NSOpenGLContext alloc] initWithFormat: pixelformat shareContext: sharedContext]; 83 77 NSOpenGLPixelBuffer* pbuffer = [[NSOpenGLPixelBuffer alloc] initWithTextureTarget: _traits->target textureInternalFormat: _traits->format textureMaxMipMapLevel: _traits->level pixelsWide: _traits->width pixelsHigh: _traits->height]; … … 94 88 void PixelBufferCocoa::closeImplementation() 95 89 { 96 _realized = false;90 _realized = false; 97 91 98 92 … … 104 98 bool PixelBufferCocoa::makeCurrentImplementation() 105 99 { 106 // osg::notify(osg::INFO) << "PixelBufferCocoa::makeCurrentImplementation" << std::endl;100 // osg::notify(osg::INFO) << "PixelBufferCocoa::makeCurrentImplementation" << std::endl; 107 101 108 102 [_context makeCurrentContext]; 109 return true;103 return true; 110 104 } 111 105 … … 114 108 bool PixelBufferCocoa::makeContextCurrentImplementation(osg::GraphicsContext* readContext) 115 109 { 116 return makeCurrentImplementation();110 return makeCurrentImplementation(); 117 111 } 118 112 … … 120 114 bool PixelBufferCocoa::releaseContextImplementation() 121 115 { 122 // osg::notify(osg::INFO) << "PixelBufferCocoa::releaseContextImplementation" << std::endl;116 // osg::notify(osg::INFO) << "PixelBufferCocoa::releaseContextImplementation" << std::endl; 123 117 124 118 [NSOpenGLContext clearCurrentContext]; … … 129 123 void PixelBufferCocoa::bindPBufferToTextureImplementation( GLenum buffer ) 130 124 { 131 std::cout << "PixelBufferCocoa :: bindPBufferToTextureImplementation not implemented yet " << std::endl;125 std::cout << "PixelBufferCocoa :: bindPBufferToTextureImplementation not implemented yet " << std::endl; 132 126 } 133 127 … … 135 129 void PixelBufferCocoa::swapBuffersImplementation() 136 130 { 137 osg::notify(osg::INFO) << "PixelBufferCocoa::swapBuffersImplementation" << std::endl;131 osg::notify(osg::INFO) << "PixelBufferCocoa::swapBuffersImplementation" << std::endl; 138 132 [_context flushBuffer]; 139 133 } 140 134 141 135 PixelBufferCocoa::~PixelBufferCocoa() 142 { 136 { 143 137 [_context release]; 144 138 }
