随笔- 191
文章- 0
评论- 35
阅读-
21万
随笔分类 - osg技术
探讨学习osg技术
编译osg的一个错误
摘要:C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets!提示找不到CMAKELIST.TXT,同时CMD.EXE退出主要原因是工程文件里面包含有CMAKELIST.TEXT文件,这个时候要么...
阅读全文
pushStateSet(const osg::StateSet* ss)建立渲染叶
摘要:inline void pushStateSet(const osg::StateSet* ss) { _currentStateGraph = _currentStateGraph->find_or_insert(ss);// if (_numberOfEncloseOverrideRenderBinDetails==0 && ss->useRenderBinDeta...
阅读全文
osg传递着色器变量
摘要:> I tried using a different attribute index from 0, and the colours are now showing up. I had come across the link earlier that you posted, but didn't realise that was how OpenGL worked (I tested i...
阅读全文
最长的一帧
摘要:最长的一帧王锐(array)这是一篇有关 OpenSceneGraph 源代码的拙劣教程,没有任何能赏心悦目的小例子,也不会贡献出什么企业级的绝密的商业代码,标题也只是个噱头(坏了,没人看了^_^)。本文写作的目的说来很简单,无非就是想要深入地了解一下,OSG 在一帧时间,也就是仿真循环的一个画面当中都做了什么。对 OSG 有所了解之后,我们也许可以很快地回答这个问题,正如下面的代码所示:whil...
阅读全文
glsl着色语言和osg的交互及模型矩阵的传递
摘要:void SceneView::updateUniforms(){ if (!_localStateSet) { _localStateSet = new osg::StateSet; } if (!_localStateSet) return; if ((_activeUniforms & FRAME_NUMBER_UNIFORM) && _frameStamp.val...
阅读全文
opengl及osg中的几种渲染方法
摘要:glDrawArrays 和 glDrawElements 的作用都是从一个数据数组中提取数据渲染基本图元。( render primitives from array data )注!如果要 glDrawArrays 和 glDrawElements 正确进行绘制的话,必须在之前 调用带有相应参数的 glEnableClientState 方法。 比如:/* Enable vertex arra...
阅读全文
分析drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous)
摘要:void RenderBin::drawImplementation(osg::RenderInfo& renderInfo,RenderLeaf*& previous){ osg::State& state = *renderInfo.getState(); // osg::notify(osg::NOTICE)<<"begin RenderBin::draw...
阅读全文
产生渲染叶
摘要:inline RenderLeaf* CullVisitor::createOrReuseRenderLeaf(osg::Drawable* drawable,osg::RefMatrix* projection,osg::RefMatrix* matrix, float depth){ // Skips any already reused renderleaf. while (_current...
阅读全文
osg求交,模型矩阵
摘要:Intersector* LineSegmentIntersector::clone(osgUtil::IntersectionVisitor& iv){ if (_coordinateFrame==MODEL && iv.getModelMatrix()==0) { osg::ref_ptr<LineSegmentIntersector> lsi = new ...
阅读全文
osg渲染属性和opengl的接口分析
摘要:inline void State::applyModeList(ModeMap& modeMap,const StateSet::ModeList& modeList)//对每一个渲染叶都调用一次{ StateSet::ModeList::const_iterator ds_mitr = modeList.begin(); ModeMap::iterator this_mitr=...
阅读全文
Opengl RC(Render context,渲染上下文)与像素格式
摘要:以下是一些整理后的资料.1.Windows操作系统对OpenGL的支持 具有Windows编程经验的人都知道,在Windows下用GDI作图必须通过设备上下文(DeviceContext简写DC)调用相应的函数;用OpenGL作图也是类似,OpenGL函数是通过"渲染上下文"(RenderingContext简写RC)完成三维图形的绘制。Windows下的窗口和设备上下文支持"位图格式"(PIXE...
阅读全文
moveStateGraph() 状态树属性的收集过程
摘要:StateGraph* prev_rg = previous->_parent; //上一个渲染叶的状态节点 StateGraph* prev_rg_parent = prev_rg->_parent; //上一个渲染叶所在的状态节点的父节点 StateGraph* rg = _parent; 当前叶子所在的状态节点 if (prev_rg_parent!=rg->_parent...
阅读全文
相机沿着场景旋转
摘要:class Test : public osgGA::AnimationPathManipulator{public:Test(osg::AnimationPath* path) : AnimationPathManipulator(path){}~Test(){}private:osg::Quat _rotation;osg::Vec3d _center;double _distance;dou...
阅读全文
得到相交的三角面片的三个顶点坐标
摘要:class PickEvent : public osgGA::GUIEventHandler{public:PickEvent(osg::Geometry* drawable) : _drawable(drawable){}~PickEvent(){}public:bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIAction...
阅读全文
使用osg::TriangleFunction仿函数求交
摘要:class PickEvent : public osgGA::GUIEventHandler{public:PickEvent(osg::Geometry* drawable) : _drawable(drawable){}~PickEvent(){}public:bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIAction...
阅读全文
osg选取
摘要:void PickHandler::pick(osgViewer::View*view, const osgGA::GUIEventAdapter&ea){ osgUtil::LineSegmentIntersector::Intersections intersections;//求集交互器 float x = ea.getX(); float y = ea.getY();//传入事件的...
阅读全文
关于坐标系,关于矩阵及线性相关和无关的关系
摘要:不上图了,太麻烦,直接用文字记录下来,以备日后查询坐标系M1由E旋转得到,而M2则由M1旋转而来,以此类推M3....M4则E中的坐标点M经过坐标系的旋转后的最终坐标是M1M2M3...M4 * M,M是向量而M1,M2,M3,M4是旋转矩阵ex = omM1x = om1M1是e经过旋转后的坐标M1M2刚把M2代表的向量转到M2中的坐标M1M2是坐标系的旋转,每一次旋转都在上一次旋转的基础之上第...
阅读全文
osg找不到插件的解决办法
摘要:使用osgDB::readNodeFile读取ive文件,提示出找不到插件,于是把bin/osgPlugin里面的动态库复制到system32下,还是找不到,后来才发现dll是debug版本,而解决方案文件是release版本,于是把解决方案改成debug,最终读取成功
阅读全文
关于NodeVisitor访问者模式
摘要:OSG通过对NodeVisitor的使用,实现了GOF的Visitor的模式.在Osg的实现中,这个模式实现了双派发.所以在Node中有一个虚方法为apply(NodeVisitor),而在NodeVisitor中有一个方法apply(Node&).这两个方法的调用是有区别的.我们应该总是调用Node::accept而别使用NodeVisitor::apply.因为只有调用前者才能享受到双...
阅读全文