Open Inventor练习-SoWin中SoWinExaminerViewer显示三维场景
2011-10-13 15:28
375 查看
#define COIN_DLL #define SOWIN_DLL // 加载COIN库文件 #ifdef _DEBUG #pragma comment(lib, "SoWin1d.lib") #pragma comment(lib, "Coin3d.lib") #else #pragma comment(lib, "SoWin1.lib") #pragma comment(lib, "Coin3.lib") #endif // 添加COIN头文件-Window操作显示库和节点库 #include <Inventor/Win/SoWin.h> #include <Inventor/Win/viewers/SoWinExaminerViewer.h> #include <Inventor/nodes/SoBaseColor.h> #include <Inventor/nodes/SoCone.h> #include <Inventor/nodes/SoSeparator.h> int main(int argc, char ** argv) { // Initializes SoQt library (and implicitly also the Coin and Qt // libraries). Returns a top-level / shell Qt window to use. HWND mainwin = SoWin::init(argc, argv, argv[0]); // Make a dead simple scene graph by using the Coin library, only // containing a single yellow cone under the scenegraph root. SoSeparator * root = new SoSeparator; root->ref(); SoBaseColor * col = new SoBaseColor; col->rgb = SbColor(1, 1, 0); root->addChild(col); root->addChild(new SoCone); // Use one of the convenient SoQt viewer classes. SoWinExaminerViewer * eviewer = new SoWinExaminerViewer(mainwin); eviewer->setSceneGraph(root); eviewer->show(); // Pop up the main window. SoWin::show(mainwin); // Loop until exit. SoWin::mainLoop(); // Clean up resources. delete eviewer; root->unref(); return 0; }SoBaseColor是Open Inventor的颜色节点,与SoMaterial一样可以对三维场景中的问题进行颜色控制,rgb变量就是对需要设定的颜色进行RGB颜色值设定,他是一个SoMFColor变量,可以多值设定,这里设定颜色位***,用来控制下面的圆锥节点。
SoWinExaminerViewer是用来显示场景的,它派生与SoWinViewer,用来对Windows窗口的句柄控制,进而控制OpenGL在窗体上的三维显示。
输出结果如下。
相关文章推荐
- Open Inventor练习-SoWin中SoWinRenderArea显示三维场景
- Open Inventor练习-SoSelection三维场景中查找功能
- Open Inventor练习-iv文件读写显示1
- Open Inventor练习-iv文件读写显示2
- UE4创建3D场景中的UI方法及在UI上面显示三维物体
- Open Inventor练习-iv文件读写显示3
- 无背景三维互动场景显示及应用
- Open Inventor练习-三维物体选择操作
- 如何显示大场景海量三维模型?
- [GDAL]在三维场景中显示DEM
- Open Inventor练习-iv文件读写显示4
- Open Inventor练习-SoSelection节点下三维物体选择功能
- 在显示opengl三维场景的屏幕上也就是windows窗体上画线
- 一、STK三维场景的组成要素及其作用
- Unity3D技术之加载游戏场景并显示进度条实现详解
- 三维场景如何嵌入到PPT中展示?
- Unity3D游戏开发之在3D场景中选择物体并显示轮廓效果
- Open Inventor练习-纹理(SoTexture2)
- 【技术贴】ArcGIS Runtime for Xamarin 使用SPK构建逼真的三维场景
- RabbitMQ使用场景练习:发布/订阅(三)