- Timestamp:
- 01/05/07 16:30:49 (6 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osghangglide/osghangglide.cpp
r5907 r5908 123 123 124 124 bool customWindows = false; 125 while(arguments.read("-1")) customWindows = true; 126 while(arguments.read("-2")) customWindows = false; 125 while(arguments.read("-2")) customWindows = true; 127 126 128 127 if (customWindows) … … 135 134 } 136 135 137 unsigned int width, height;138 wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);139 140 width -= 500;141 height -= 500;142 143 136 osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; 144 traits->x = 500; 145 traits->y = 500; 146 traits->width = width; 147 traits->height = height; 148 #if 0 149 traits->windowDecoration = false; 150 #else 137 traits->x = 250; 138 traits->y = 200; 139 traits->width = 800; 140 traits->height = 600; 151 141 traits->windowDecoration = true; 152 #endif153 142 traits->doubleBuffer = true; 154 143 traits->sharedContext = 0; 155 144 156 145 osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); 157 158 osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get()); 159 if (gw) 146 if (gc.valid()) 160 147 { 161 osg::notify(osg::NOTICE)<<" GraphicsWindow has been created successfully."<<gw<<std::endl;162 163 gw->getEventQueue()->getCurrentEventState()->setWindowRectangle(0, 0, width, height );164 165 148 // need to ensure that the window is cleared make sure that the complete window is set the correct colour 166 149 // rather than just the parts of the window that are under the camera's viewports 167 g w->setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f));168 g w->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);150 gc->setClearColor(osg::Vec4f(0.2f,0.2f,0.6f,1.0f)); 151 gc->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 169 152 } 170 153 else … … 179 162 osg::ref_ptr<osg::Camera> camera = new osg::Camera; 180 163 camera->setGraphicsContext(gc.get()); 181 camera->setViewport(new osg::Viewport((i* width)/numCameras,(i*height)/numCameras, width/numCameras,height/numCameras));164 camera->setViewport(new osg::Viewport((i* traits->width)/numCameras,(i* traits->height)/numCameras, traits->width/numCameras, traits->height/numCameras)); 182 165 GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT; 183 166 camera->setDrawBuffer(buffer);
