zoukankan      html  css  js  c++  java
  • osgViewer::Viewer::Windows

    osg自带窗口去掉边框

    #ifdef _WIN32
    #include <Windows.h>
    #endif // _WIN32
    #include<iostream>
    
    #include <osgViewer/Viewer>
    #include <osgViewer/ViewerEventHandlers> 
    #include <osgViewer/CompositeViewer> 
    #include <osgDB/ReadFile>
    #include <osg/Geode>
    #include <osg/Node>
    #include <osg/Geometry>
    #include <osgGA/TrackballManipulator>
    #include <osg/GraphicsContext>
    #include <osg/ShapeDrawable>
    #include <osg/Material>
    #include <osg/Image>
    #include <osg/Texture2D>
    #include <osg/TexEnv>
    #include <osg/TexGen>
    #include <osg/MatrixTransform>
    #include <osg/PositionAttitudeTransform>
    #include <osg/AnimationPath>
    #include <osg/Matrixd>
    
    #include <osgGA/GUIEventHandler>
    #include <osgGA/CameraManipulator>
    #include <osgGA/StandardManipulator>
    #include <osgGA/OrbitManipulator>
    #include <osgGA/TrackballManipulator>
    #include <osgUtil/IntersectionVisitor>
    #include <osgUtil/LineSegmentIntersector>
    
    int main()
    {
        osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
        osg::ref_ptr<osg::Node> node1;
        osg::GraphicsContext::WindowingSystemInterface *ws = osg::GraphicsContext::getWindowingSystemInterface();
        
        unsigned int height=0, width=0;
        osg::GraphicsContext::Traits traits;
        osg::GraphicsContext::ScreenIdentifier screenIdentifier1;
        
        if (ws)
        {
            ws->getScreenResolution(screenIdentifier1, width, height);
            std::cout << "ws is not null" << std::endl;
            std::cout << "resolution:  w:"<<width<<"  h:"<<height<<"  " << std::endl;
            std::cout << "border:"<<screenIdentifier1.displayNum << std::endl;
    
        }
        else
        {
            std::cout << "ws is null" << std::endl;
        }
    
        node1 = osgDB::readNodeFile("D:\参考手册\BIM\osg\build1.OSGB");
        viewer->setSceneData(node1.get());
        viewer->setUpViewInWindow(200, 200, 800, 500, 0);
        
        osgViewer::Viewer::Windows win1;
        osgViewer::Viewer::Windows::iterator iter1;
    
        viewer->getWindows(win1);
        if (!win1.empty())
        {
            for (iter1=win1.begin();iter1 != win1.end(); ++iter1)
            {
                (*iter1)->setWindowDecoration(false);
            }
        }
    
        return viewer->run();
    }

  • 相关阅读:
    开工--行胜于言
    操作系统之内存管理
    C陷阱与缺陷读书笔记(一)
    关于复杂度的一些基本的定义
    归并排序
    快速排序
    前序中序后序非递归遍历
    直接插入排序
    冒泡排序
    程序内存映像
  • 原文地址:https://www.cnblogs.com/herd/p/11095138.html
Copyright © 2011-2022 走看看