查看: 1452|回复: 23

水牛模型scale放大16倍,怎么还是原先大小?

[复制链接]

该用户从未签到

发表于 2014-9-28 15:55:44 | 显示全部楼层 |阅读模式
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osg/geode>
#include <osg/LineWidth>
#include <osgUtil/Tessellator>
#include <osg/Stencil>
#include <osg//ComputeBoundsVisitor>
#include <osgapex/cleardrawable>
#include <osg/Depth>
#include <osg/MatrixTransform>

#pragma comment(lib,"OpenThreadsd.lib")
#pragma comment(lib,"osgd.lib")
#pragma comment(lib,"osgDBd.lib")
#pragma comment(lib,"osgAPExd.lib")
#pragma comment(lib,"osgGAd.lib")
#pragma comment(lib,"osgUtild.lib")
#pragma comment(lib,"osgTextd.lib")
#pragma comment(lib,"osgSimd.lib")
#pragma comment(lib,"osgViewerd.lib")

int _tmain(int argc, _TCHAR* argv[])
{
        osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
        osg::ref_ptr<osg::Group> g_Root = new osg::Group;
        osg::ref_ptr<osg::Node> pNode = osgDB::readNodeFile("cow.osg");
        osg::ref_ptr<osg::Group> g_depth = new osg::Group;
        osg::ref_ptr<osg::MatrixTransform> setMat = new osg::MatrixTransform;
        setMat->setMatrix(osg::Matrixd::scale(16,1,16));
        setMat->addChild(pNode);

        //g_Root->addChild(g_depth);
        g_Root->addChild(setMat);
        viewer->setSceneData(g_Root);
        viewer->run();
        return 0;
}

该用户从未签到

发表于 2014-10-18 22:02:59 | 显示全部楼层
点的位置在哪儿,你设置的tb homeposition又在哪儿,物体明明在前面,眼睛往后看能看到么。。。我建议还是看一下opengl,不懂eye center up 什么意思怎么搞,,

该用户从未签到

发表于 2014-9-28 17:02:49 | 显示全部楼层
你的牛变扁了么?如果扁了,就证明矩阵生效了,只是没有参照物,你才觉得它大小没变。

该用户从未签到

发表于 2014-9-29 09:31:13 | 显示全部楼层
这是你使用默认漫游器trackmanipulator的原因,这个漫游器会根据模型包围球的大小,来自动放缩观察距离,以至于场景看起来没有变化,放个参考物进去或者使用sethomeposition(M)解决

该用户从未签到

 楼主| 发表于 2014-9-30 17:49:54 | 显示全部楼层
buaahc 发表于 2014-9-29 09:31
这是你使用默认漫游器trackmanipulator的原因,这个漫游器会根据模型包围球的大小,来自动放缩观察距离,以 ...

放个参考物进去是什么意思呀?

该用户从未签到

发表于 2014-10-9 14:34:21 | 显示全部楼层
五十载 发表于 2014-9-30 17:49
放个参考物进去是什么意思呀?

你放一个不缩放的飞机到场景里面,不就会显示出水牛放大16倍么、、、

该用户从未签到

 楼主| 发表于 2014-10-10 16:12:38 | 显示全部楼层
buaahc 发表于 2014-10-9 14:34
你放一个不缩放的飞机到场景里面,不就会显示出水牛放大16倍么、、、

setHomePosition设置完 怎么小球没有呀????????????????

#include "stdafx.h"
#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/ShapeDrawable>
#include <osg/MatrixTransform>
#include <osgViewer/Viewer>  
#include <osgDB/ReadFile>  
#include <osgGA/TrackballManipulator>  
/*#include <osgOcean/OceanScene>  
#include <osgOcean/FFTOceanSurface> */
#include <osgViewer/ViewerEventHandlers>  
#include <osg/TextureCubeMap>  
#include <osg/MatrixTransform>
#pragma comment( lib, "osgd.lib")   
#pragma comment( lib, "osgViewerd.lib")   
#pragma comment( lib, "osgDBd.lib")   
#pragma comment( lib, "OpenThreadsd.lib")   
#pragma comment( lib, "osgUtild.lib")  
#pragma comment( lib, "osgGAd.lib")
#pragma comment( lib, "osgTextd.lib")
#pragma comment( lib, "osgSimd.lib")



int main(int argc,char** argv)
{
        osgViewer::Viewer view;
        osg::Group* root = new osg::Group();
        osg::ShapeDrawable* sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0,5,10),1.1));
        sphere->setColor(osg::Vec4(1,0,0,1));
        osg::Geode* sphereGeo = new osg::Geode;
        sphereGeo->addDrawable(sphere);
        osg::ref_ptr<osg::MatrixTransform> tranf =new osg::MatrixTransform();
        tranf->setMatrix(osg::Matrix::scale(2,2,2));
        tranf->addChild(sphereGeo);
        root->addChild(tranf);

        osgGA::TrackballManipulator *tb = new osgGA::TrackballManipulator;  
        tb->setHomePosition(osg::Vec3d(0,0,20),osg::Vec3d(0,20,40),osg::Z_AXIS);  
        view.setCameraManipulator(tb);  
        view.addEventHandler(new osgViewer::StatsHandler);  
        view.setSceneData(root);
        view.realize();
        view.run();
        return 0;
}

该用户从未签到

发表于 2014-10-10 17:15:41 | 显示全部楼层
....homeposition不能随便胡乱设置啊,你要根据自己的需求设置正确的eye center up ,明显你程序中设置的eye center up 已经在小球所在位置(0,5,10)之上

该用户从未签到

 楼主| 发表于 2014-10-10 22:24:58 | 显示全部楼层
buaahc 发表于 2014-10-10 17:15
....homeposition不能随便胡乱设置啊,你要根据自己的需求设置正确的eye center up ,明显你程序中设置的ey ...

大哥  tb->setHomePosition(osg::Vec3d(0,5,10),osg::Vec3d(0,0,0),osg::Z_AXIS);  这么设置错了 怎么还没有呀?

该用户从未签到

 楼主| 发表于 2014-10-10 22:27:52 | 显示全部楼层
本帖最后由 五十载 于 2014-10-11 11:52 编辑
buaahc 发表于 2014-10-10 17:15
....homeposition不能随便胡乱设置啊,你要根据自己的需求设置正确的eye center up ,明显你程序中设置的ey ...


老师的名字是。。。

该用户从未签到

发表于 2014-10-11 09:44:33 | 显示全部楼层
我觉得你可能没搞明白那三个参数的含义。。。尤其是up不能随便设定,还有你把眼睛设定在小球所在的位置。。。你把手指使劲往眼睛上凑,你试一试还能看见么,呵呵
试一下tb->setHomePosition(osg::Vec3d(0,0,10),osg::Vec3d(0,5,10),osg::Z_AXIS);
osg群现在已不是一个讨论问题的地方,我早已屏蔽之

该用户从未签到

 楼主| 发表于 2014-10-11 11:55:47 | 显示全部楼层
本帖最后由 五十载 于 2014-10-12 14:51 编辑
buaahc 发表于 2014-10-11 09:44
我觉得你可能没搞明白那三个参数的含义。。。尤其是up不能随便设定,还有你把眼睛设定在小球所在的位置。。 ...


老师非常感谢,

该用户从未签到

 楼主| 发表于 2014-10-12 14:50:51 | 显示全部楼层
buaahc 发表于 2014-10-11 09:44
我觉得你可能没搞明白那三个参数的含义。。。尤其是up不能随便设定,还有你把眼睛设定在小球所在的位置。。 ...

还是没有看见呀。。。。。。。。。。。。。。。。。。

#include <osgViewer/Viewer>
#include <osgDB/ReadFile>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/ShapeDrawable>
#include <osg/MatrixTransform>
#include <osgViewer/Viewer>  
#include <osgDB/ReadFile>  
#include <osgGA/TrackballManipulator>  
/*#include <osgOcean/OceanScene>  
#include <osgOcean/FFTOceanSurface> */
#include <osgViewer/ViewerEventHandlers>  
#include <osg/TextureCubeMap>  
#include <osg/MatrixTransform>
#pragma comment( lib, "osgd.lib")   
#pragma comment( lib, "osgViewerd.lib")   
#pragma comment( lib, "osgDBd.lib")   
#pragma comment( lib, "OpenThreadsd.lib")   
#pragma comment( lib, "osgUtild.lib")  
#pragma comment( lib, "osgGAd.lib")
#pragma comment( lib, "osgTextd.lib")
#pragma comment( lib, "osgSimd.lib")



int main(int argc,char** argv)
{
        osgViewer::Viewer view;
        osg::Group* root = new osg::Group();
        osg::ShapeDrawable* sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0,5,10),1.1));
        sphere->setColor(osg::Vec4(1,0,0,1));
        osg::Geode* sphereGeo = new osg::Geode;
        sphereGeo->addDrawable(sphere);
        osg::ref_ptr<osg::MatrixTransform> tranf =new osg::MatrixTransform();
        tranf->setMatrix(osg::Matrix::scale(2,2,2));
        tranf->addChild(sphereGeo);
        root->addChild(tranf);

        osgGA::TrackballManipulator *tb = new osgGA::TrackballManipulator;  
        tb->setHomePosition(osg::Vec3d(0,0,10),osg::Vec3d(0,5,10),osg::Z_AXIS);   
        view.setCameraManipulator(tb);  
        view.addEventHandler(new osgViewer::StatsHandler);  
        view.setSceneData(root);
        view.realize();
        view.run();
        return 0;
}

该用户从未签到

发表于 2014-10-13 15:08:48 | 显示全部楼层
哦 是我没注意 你下面还有个缩放矩阵~       
tb->setHomePosition(osg::Vec3d(0,0,20),osg::Vec3d(0,10,20),osg::Z_AXIS);   

该用户从未签到

 楼主| 发表于 2014-10-13 19:37:28 | 显示全部楼层
buaahc 发表于 2014-10-13 15:08
哦 是我没注意 你下面还有个缩放矩阵~       
tb->setHomePosition(osg::Vec3d(0,0,20),osg::Vec3d(0,10,20),osg ...

怎么画点 没有呀老师。。。。。。

  1. #include <osgViewer/Viewer>
  2. #include <osgDB/ReadFile>
  3. #include <osg/geode>
  4. #include <osg/LineWidth>
  5. #include <osg/MatrixTransform>
  6. #pragma comment(lib,"OpenThreadsd.lib")
  7. #pragma comment(lib,"osgd.lib")
  8. #pragma comment(lib,"osgDBd.lib")
  9. #pragma comment(lib,"osgAPExd.lib")
  10. #pragma comment(lib,"osgGAd.lib")
  11. #pragma comment(lib,"osgUtild.lib")
  12. #pragma comment(lib,"osgTextd.lib")
  13. #pragma comment(lib,"osgSimd.lib")
  14. #pragma comment(lib,"osgViewerd.lib")



  15. int _tmain(int argc, _TCHAR* argv[])
  16. {
  17.         osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
  18.         osg::ref_ptr<osg::Group> g_Root = new osg::Group;
  19.         osg::ref_ptr<osg::Geode> pNode = new osg::Geode;
  20.         osg::ref_ptr<osg::Vec3Array> VertexV3a = new osg::Vec3Array;
  21.         osg::Geometry* PolygonGeometry = new osg::Geometry;
  22.         osg::StateSet* PolygonStateset = new osg::StateSet;

  23.         if(!pNode)
  24.                 return 0;
  25.         VertexV3a->push_back(osg::Vec3(-1.02168, -2.15188e-09, 0.885735));


  26.         // pass the created vertex array to the points geometry object.
  27.         PolygonGeometry->setVertexArray(VertexV3a);

  28.         osg::Vec4Array* colors = new osg::Vec4Array;
  29.         // add a white color, colors take the form r,g,b,a with 0.0 off, 1.0 full on.
  30.         colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));

  31.         // pass the color array to points geometry, note the binding to tell the geometry
  32.         // that only use one color for the whole object.
  33.         PolygonGeometry->setColorArray(colors);
  34.         PolygonGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);


  35.         // set the normal in the same way color.
  36.         osg::Vec3Array* normals = new osg::Vec3Array;
  37.         normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
  38.         PolygonGeometry->setNormalArray(normals);
  39.         PolygonGeometry->setNormalBinding(osg::Geometry::BIND_OVERALL);

  40.         PolygonGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,VertexV3a->size()));

  41.         pNode->addDrawable(PolygonGeometry);
  42.         osg::MatrixTransform* mt = new osg::MatrixTransform;
  43.         mt->setMatrix(osg::Matrixd::scale(3,3,3));
  44.         mt->addChild(pNode);
  45.         g_Root->addChild(mt);
  46.         viewer->setSceneData(g_Root);
  47.         viewer->run();
  48.         return 0;
  49. }
复制代码

该用户从未签到

发表于 2014-10-14 00:10:31 | 显示全部楼层
你的代码没有问题,但看不见正常,渲染点务必要设定属性point,定义其size大小,不然看不见,还有要关掉细节拣选viewer->getCamera()->setCullingMode(viewer->getCamera()->getCullingMode()&~osg::CullSettings::SMALL_FEATURE_CULLING);
再就是设定trackballmaipulator漫游器的homeposition(),这样我觉得应该差不多了

该用户从未签到

 楼主| 发表于 2014-10-14 21:20:14 | 显示全部楼层
buaahc 发表于 2014-10-14 00:10
你的代码没有问题,但看不见正常,渲染点务必要设定属性point,定义其size大小,不然看不见,还有要关掉细 ...

谢谢老师的无私问题呀。。问下setFunction的后俩个参数1,1是什么意思???
osg::Stencil stencil = new osg::Stencil;
stencil->setFunction(osg::Stencil::NOTEQUAL, 1, 1);

该用户从未签到

发表于 2014-10-16 16:40:39 | 显示全部楼层
这些东西都是理论问题,翻翻opengl的书就行了,先说第二个1是掩码(mask):掩码需要与模板缓冲区进行与(&)操作,只有结果为1时,才与参考值进行比较,第一个1就是参考值(ref)~

该用户从未签到

 楼主| 发表于 2014-10-18 16:40:00 | 显示全部楼层
本帖最后由 五十载 于 2014-10-18 16:42 编辑
buaahc 发表于 2014-10-16 16:40
这些东西都是理论问题,翻翻opengl的书就行了,先说第二个1是掩码(mask):掩码需要与模板缓冲区进行与(& ...


怎么不行啊??????麻烦老师帮我瞅瞅呀。。。已经设置了细节练选,点的大小,homeposition了

  1. #include <osgViewer/Viewer>
  2. #include <osgDB/ReadFile>
  3. #include <osg/geode>
  4. #include <osg/LineWidth>
  5. #include <osg/MatrixTransform>
  6. #include <osg/Point>
  7. #include <osgViewer/Viewer>
  8. #include <osgDB/ReadFile>
  9. #include <osg/Node>
  10. #include <osg/Geode>
  11. #include <osg/Geometry>
  12. #include <osg/ShapeDrawable>
  13. #include <osg/MatrixTransform>
  14. #include <osgViewer/Viewer>  
  15. #include <osgDB/ReadFile>  
  16. #include <osgGA/TrackballManipulator>  
  17. /*#include <osgOcean/OceanScene>  
  18. #include <osgOcean/FFTOceanSurface> */
  19. #include <osgViewer/ViewerEventHandlers>  
  20. #include <osg/TextureCubeMap>  
  21. #include <osg/MatrixTransform>

  22. #pragma comment(lib,"OpenThreadsd.lib")
  23. #pragma comment(lib,"osgd.lib")
  24. #pragma comment(lib,"osgDBd.lib")
  25. #pragma comment(lib,"osgAPExd.lib")
  26. #pragma comment(lib,"osgGAd.lib")
  27. #pragma comment(lib,"osgUtild.lib")
  28. #pragma comment(lib,"osgTextd.lib")
  29. #pragma comment(lib,"osgSimd.lib")
  30. #pragma comment(lib,"osgViewerd.lib")



  31. int _tmain(int argc, _TCHAR* argv[])
  32. {
  33.         osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
  34.         osg::ref_ptr<osg::Group> g_Root = new osg::Group;
  35.         osg::ref_ptr<osg::Geode> pNode = new osg::Geode;
  36.         osg::ref_ptr<osg::Vec3Array> VertexV3a = new osg::Vec3Array;
  37.         osg::Geometry* PolygonGeometry = new osg::Geometry;
  38.         osg::StateSet* PolygonStateset = new osg::StateSet;

  39.         if(!pNode)
  40.                 return 0;
  41.         VertexV3a->push_back(osg::Vec3(-1.02168, -2.15188, 0.885735));


  42.         // pass the created vertex array to the points geometry object.
  43.         PolygonGeometry->setVertexArray(VertexV3a);

  44.         osg::Vec4Array* colors = new osg::Vec4Array;
  45.         // add a white color, colors take the form r,g,b,a with 0.0 off, 1.0 full on.
  46.         colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));

  47.         // pass the color array to points geometry, note the binding to tell the geometry
  48.         // that only use one color for the whole object.
  49.         PolygonGeometry->setColorArray(colors);
  50.         PolygonGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);

  51.         osg::ref_ptr <osg::Point> ptSize = new osg::Point; //设置点的大小!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  52.         ptSize->setSize( 12.0) ;      
  53.         PolygonStateset->setAttributeAndModes(ptSize.get(),osg::StateAttribute::ON);   
  54.         // set the normal in the same way color.
  55.         osg::Vec3Array* normals = new osg::Vec3Array;
  56.         normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
  57.         PolygonGeometry->setNormalArray(normals);
  58.         PolygonGeometry->setNormalBinding(osg::Geometry::BIND_OVERALL);
  59.         PolygonGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,VertexV3a->size()));

  60.         osgGA::TrackballManipulator *tb = new osgGA::TrackballManipulator;   //设置中心点!!!!!!!!!!!!!!!
  61.         tb->setHomePosition(osg::Vec3d(0,0,-1),osg::Vec3d(0,-4,-1),osg::Z_AXIS);   
  62.         viewer->setCameraManipulator(tb);  
  63.         viewer->getCamera()->setCullingMode(viewer->getCamera()->getCullingMode()&~osg::CullSettings::SMALL_FEATURE_CULLING);//设置关掉细节拣选
  64.         pNode->addDrawable(PolygonGeometry);
  65.         osg::MatrixTransform* mt = new osg::MatrixTransform;
  66.         mt->setMatrix(osg::Matrixd::scale(3,3,3));
  67.         mt->addChild(pNode);
  68.         g_Root->addChild(mt);
  69.         viewer->setSceneData(g_Root);
  70.         viewer->run();
  71.         return 0;
  72. }
复制代码

该用户从未签到

 楼主| 发表于 2014-10-21 11:09:04 | 显示全部楼层
buaahc 发表于 2014-10-18 22:02
点的位置在哪儿,你设置的tb homeposition又在哪儿,物体明明在前面,眼睛往后看能看到么。。。我建议还是 ...

老师我这个设置osg::Vec3d(-1.3,-1.8,0.5)在物体osg::Vec3(-1.02168, -2.15188, 0.885735)前面吧。。。。
tb->setHomePosition(osg::Vec3d(-1.3,-1.8,0.5),osg::Vec3d(0,-1,-1),osg::Z_AXIS);   
        

该用户从未签到

发表于 2014-10-21 13:42:07 | 显示全部楼层
你直接osg::Vec3(-1.02168, -2.15188, 0.885735)设置给center不就行了么,eye(0.0,0.0,0.0),我看了一下你设置的point属性stateset没有设置给geometry啊,       
PolygonGeometry->setStateSet(PolygonStateset);

该用户从未签到

 楼主| 发表于 2014-10-26 12:52:07 | 显示全部楼层
buaahc 发表于 2014-10-21 13:42
你直接osg::Vec3(-1.02168, -2.15188, 0.885735)设置给center不就行了么,eye(0.0,0.0,0.0),我看了一下 ...

嘿嘿,老师现在是画上了,但是黑点太小了。。。。我salce 32 32 32怎么还不行呢?

  1. #include <osgViewer/Viewer>
  2. #include <osgDB/ReadFile>
  3. #include <osg/geode>
  4. #include <osg/LineWidth>
  5. #include <osg/MatrixTransform>
  6. #include <osg/Point>
  7. #include <osgViewer/Viewer>
  8. #include <osgDB/ReadFile>
  9. #include <osg/Node>
  10. #include <osg/Geode>
  11. #include <osg/Geometry>
  12. #include <osg/ShapeDrawable>
  13. #include <osg/MatrixTransform>
  14. #include <osgViewer/Viewer>  
  15. #include <osgDB/ReadFile>  
  16. #include <osgGA/TrackballManipulator>  
  17. /*#include <osgOcean/OceanScene>  
  18. #include <osgOcean/FFTOceanSurface> */
  19. #include <osgViewer/ViewerEventHandlers>  
  20. #include <osg/TextureCubeMap>  
  21. #include <osg/MatrixTransform>

  22. #pragma comment(lib,"OpenThreadsd.lib")
  23. #pragma comment(lib,"osgd.lib")
  24. #pragma comment(lib,"osgDBd.lib")
  25. #pragma comment(lib,"osgAPExd.lib")
  26. #pragma comment(lib,"osgGAd.lib")
  27. #pragma comment(lib,"osgUtild.lib")
  28. #pragma comment(lib,"osgTextd.lib")
  29. #pragma comment(lib,"osgSimd.lib")
  30. #pragma comment(lib,"osgViewerd.lib")



  31. int _tmain(int argc, _TCHAR* argv[])
  32. {
  33.         osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
  34.         osg::ref_ptr<osg::Group> g_Root = new osg::Group;
  35.         osg::ref_ptr<osg::Geode> pNode = new osg::Geode;
  36.         osg::ref_ptr<osg::Vec3Array> VertexV3a = new osg::Vec3Array;
  37.         osg::Geometry* PolygonGeometry = new osg::Geometry;
  38.         osg::StateSet* PolygonStateset = new osg::StateSet;
  39.                 PolygonGeometry->setStateSet(PolygonStateset);
  40.         if(!pNode)
  41.                 return 0;
  42.         VertexV3a->push_back(osg::Vec3(-1.02168, -2.15188, 0.885735));


  43.         // pass the created vertex array to the points geometry object.
  44.         PolygonGeometry->setVertexArray(VertexV3a);

  45.         osg::Vec4Array* colors = new osg::Vec4Array;
  46.         // add a white color, colors take the form r,g,b,a with 0.0 off, 1.0 full on.
  47.         colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));

  48.         // pass the color array to points geometry, note the binding to tell the geometry
  49.         // that only use one color for the whole object.
  50.         PolygonGeometry->setColorArray(colors);
  51.         PolygonGeometry->setColorBinding(osg::Geometry::BIND_OVERALL);

  52.                 osg::ref_ptr <osg::Point> ptSize = new osg::Point;
  53.         ptSize->setSize( 12.0) ;      
  54.         PolygonStateset->setAttributeAndModes(ptSize.get(),osg::StateAttribute::ON);   
  55.         // set the normal in the same way color.
  56.         osg::Vec3Array* normals = new osg::Vec3Array;
  57.         normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
  58.         PolygonGeometry->setNormalArray(normals);
  59.         PolygonGeometry->setNormalBinding(osg::Geometry::BIND_OVERALL);
  60.         PolygonGeometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,VertexV3a->size()));

  61.                 osgGA::TrackballManipulator *tb = new osgGA::TrackballManipulator;  
  62.         tb->setHomePosition(osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(-1.02168, -2.15188, 0.885735),osg::Z_AXIS);   
  63.         viewer->setCameraManipulator(tb);  

  64.         pNode->addDrawable(PolygonGeometry);
  65.         osg::MatrixTransform* mt = new osg::MatrixTransform;
  66.         mt->setMatrix(osg::Matrixd::scale(33,33,33));
  67.         mt->addChild(pNode);
  68.         g_Root->addChild(mt);
  69.         viewer->getCamera()->setCullingMode(viewer->getCamera()->getCullingMode()&~osg::CullSettings::SMALL_FEATURE_CULLING);
  70.                 viewer->setSceneData(g_Root);
  71.         viewer->run();
  72.         return 0;
  73. }
复制代码

该用户从未签到

发表于 2014-10-27 17:01:46 | 显示全部楼层
。。。点(point)不能使用matrixtransform进行操作,setsize

该用户从未签到

 楼主| 发表于 2014-11-2 17:58:50 | 显示全部楼层
本帖最后由 五十载 于 2014-11-6 11:23 编辑
buaahc 发表于 2014-10-27 17:01
。。。点(point)不能使用matrixtransform进行操作,setsize


老师不用gl_MultiTexCoord1,怎么在shader里获取纹理坐标呀。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表