• [原][osg]osg程序窗口化、显示网格、状态信息


        osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
        traits->x = 200;
        traits->y = 200;
        traits->width = 800;
        traits->height = 680;
        traits->windowDecoration = true;
        traits->doubleBuffer = true;
        traits->sharedContext = 0;
    
        osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
    
        osg::ref_ptr<osg::Camera> camera = new osg::Camera;
        camera->setGraphicsContext(gc.get());
        camera->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
        GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
        camera->setDrawBuffer(buffer);
        camera->setReadBuffer(buffer);
        viewer.addSlave(camera);

    显示osg状态:

    //显示网格
    #include <osgGA/StateSetManipulator>
    m_viewer->addEventHandler(new osgGA::StateSetManipulator(m_viewer->getCamera()->getOrCreateStateSet()));//显示网格
    //显示调试信息
    #include <osgViewer/ViewerEventHandlers>
    m_viewer->addEventHandler(new osgViewer::StatsHandler);//状态信息
  • 相关阅读:
    搭建openstack系统初始化(2)
    Kvm虚拟化安装与虚拟机创建
    KVM-克隆和快照管理
    P4197 Peaks
    P4768 [NOI2018]归程
    #6145. 「2017 山东三轮集训 Day7」Easy 动态点分治
    P4178 Tree
    P4149 [IOI2011]Race
    P3806 【模板】点分治1
    P4724 【模板】三维凸包
  • 原文地址:https://www.cnblogs.com/lyggqm/p/12502154.html
Copyright © 2020-2023  润新知