|
楼主 |
发表于 2011-4-27 09:19:41
|
显示全部楼层
本帖最后由 binarylee 于 2011-4-27 09:34 编辑
安装Array的建议,我自己已经实现了,代码如下:
static void drawQuad()
{
glBegin(GL_TRIANGLE_STRIP);
glVertex4f(-1.0, -1.0, 0.0, 0.0);
glVertex4f(+1.0, -1.0, 1.0, 0.0);
glVertex4f(-1.0, +1.0, 0.0, 1.0);
glVertex4f(+1.0, +1.0, 1.0, 1.0);
glEnd();
}
class Quad : public osg:rawable
{
public:
Quad() {}
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Quad(const Quad& quad,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
osg::Drawable(quad,copyop) {}
META_Object(ocean,Quad)
virtual void drawImplementation(osg::RenderInfo&) const
{
drawQuad();
}
protected:
virtual ~Quad() {}
};
osg::ref_ptr<osg::Geode> createQuad()
{
osg::ref_ptr<osg::Geode> quadGeode = new osg::Geode;
quadGeode->addDrawable(new Quad);
return quadGeode;
} |
|