Changeset 11420 for OpenSceneGraph/trunk/examples/osgfpdepth/osgfpdepth.cpp
- Timestamp:
- 05/12/10 13:37:27 (3 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgfpdepth/osgfpdepth.cpp
r11367 r11420 405 405 textInverted->addDrawable(inverted); 406 406 textInverted->setNodeMask(~0u); 407 textProjection->addChild(textInverted );407 textProjection->addChild(textInverted.get()); 408 408 textProjection->getOrCreateStateSet()->setRenderBinDetails(11, "RenderBin"); 409 409 } … … 642 642 { 643 643 gc->resizedImplementation(x, y, width, height); 644 makeTexturesAndGeometry(width, height, _appState->sw );644 makeTexturesAndGeometry(width, height, _appState->sw.get()); 645 645 _appState->setStateFromConfig(validConfigs[_appState 646 646 ->currentConfig]); … … 694 694 } 695 695 696 DisplaySettings* ds = viewer.getDisplaySettings(); 697 if (!ds) 698 ds = DisplaySettings::instance(); 696 DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : DisplaySettings::instance().get(); 699 697 GraphicsContext::ScreenIdentifier si; 700 698 si.readDISPLAY(); … … 770 768 BufferConfigList depthConfigs; 771 769 vector<int> coverageConfigs; 772 getPossibleConfigs(gc , colorConfigs, depthConfigs, coverageConfigs);770 getPossibleConfigs(gc.get(), colorConfigs, depthConfigs, coverageConfigs); 773 771 int coverageSampleConfigs = (coverageConfigs.size() - 4) / 2; 774 772 cout << "color configs\nname\tbits\n"; … … 787 785 colorItr->bits, depthItr->bits); 788 786 FboData data; 789 if (createFBO(gc , config, data))787 if (createFBO(gc.get(), config, data)) 790 788 validConfigs.push_back(config); 791 destroyFBO(gc , data);789 destroyFBO(gc.get(), data); 792 790 if (coverageConfigs.size() > 0) 793 791 { … … 814 812 config.name = msText.str(); 815 813 816 if (createFBO(gc , config, data)) {814 if (createFBO(gc.get(), config, data)) { 817 815 validConfigs.push_back( config); 818 816 } 819 destroyFBO(gc , data);817 destroyFBO(gc.get(), data); 820 818 } 821 819 } … … 886 884 camera->attach(Camera::DEPTH_BUFFER, config.depthFormat); 887 885 else if (config.depthFormat == GL_DEPTH_COMPONENT24) 888 camera->attach(Camera::DEPTH_BUFFER, depthTexture24 );886 camera->attach(Camera::DEPTH_BUFFER, depthTexture24.get()); 889 887 else 890 camera->attach(Camera::DEPTH_BUFFER, depthTexture );888 camera->attach(Camera::DEPTH_BUFFER, depthTexture.get()); 891 889 } 892 890 … … 912 910 depthTexture = depthTexture24; 913 911 sw->removeChildren(0, sw->getNumChildren()); 914 sw->addChild(createTextureQuad(colorTexture ));915 sw->addChild(createTextureQuad(depthTexture ));916 sw->addChild(createTextureQuad(depthTexture24 ));912 sw->addChild(createTextureQuad(colorTexture.get())); 913 sw->addChild(createTextureQuad(depthTexture.get())); 914 sw->addChild(createTextureQuad(depthTexture24.get())); 917 915 sw->setSingleChildOn(0); 918 916 return sw; … … 966 964 optimizer.optimize(loadedModel.get()); 967 965 // creates texture to be rendered 968 Switch* sw = makeTexturesAndGeometry(width, height, appState->sw );966 Switch* sw = makeTexturesAndGeometry(width, height, appState->sw.get()); 969 967 ref_ptr<Camera> rttCamera = makeRttCamera(gc, width, height); 970 968 rttCamera->setRenderOrder(Camera::PRE_RENDER); 971 viewer.addSlave(rttCamera );969 viewer.addSlave(rttCamera.get()); 972 970 appState->camera = rttCamera; 973 971 // geometry and slave camera to display the result 974 972 Group* displayRoot = new Group; 975 973 displayRoot->addChild(sw); 976 displayRoot->addChild(appState->textProjection );974 displayRoot->addChild(appState->textProjection.get()); 977 975 StateSet* displaySS = displayRoot->getOrCreateStateSet(); 978 976 displaySS->setMode(GL_LIGHTING, StateAttribute::OFF); … … 991 989 texCamera->setProjectionResizePolicy(Camera::FIXED); 992 990 viewer.addSlave(texCamera, Matrixd(), Matrixd(), false); 993 viewer.addEventHandler(new ConfigHandler(appState ));991 viewer.addEventHandler(new ConfigHandler(appState.get())); 994 992 995 993 // add model to the viewer.
