|
楼主 |
发表于 2010-10-20 10:03:00
|
显示全部楼层
感谢各位的辛苦帮忙,我按照qele的提示做了还是不行,下面我把整个代码贴出来大家帮忙分析下哈:
#include "stdafx.h"
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osg/Node>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Shape>
#include <osg/ShapeDrawable>
#include <osg/MatrixTransform>
#include <osg/Group>
#include <osgViewer/ViewerEventHandlers>
#include <iostream>
osg::ref_ptr<osg::Node> createBox();
osg::ref_ptr<osg::Node> createCone();
void _tmain()
{
osgViewer::Viewer viewer;
osg::ref_ptr<osg::Group> root = new osg::Group();
osg::ref_ptr<osg::Node> glider = osgDB::readNodeFile("glider.osg");
glider->asGroup()->addChild(createBox().get());
glider->asGroup()->addChild(createCone().get());
root->addChild(glider.get());
viewer.setSceneData(root);
viewer.addEventHandler(new MyEventHandler);
viewer.realize();
viewer.run();
}
运行到glider->asGroup....时:未处理的异常: 0xC0000005: 读取位置 0x00000000 时发生访问冲突 |
|