Hi all.
I know this is a very childish question. I'm trying to draw a 2d-image over
3d-scene. My code looks like this:
osg::Geode* gd1 = new osg::Geode;
osg::Image* i1 = osgDB::readImageFile("data/waste.png");
if (i1)
{
//osg::createTexturedQuadGeometry(
osg::Geometry* g1 = osg::createTexturedQuadGeometry(osg::Vec3(
0.0f,0.0f,100.0f),osg::Vec3(-512.0f,0.0f,0.0f),osg::Vec3(0.0f ,0.0f,512.0f
));
osg::StateSet* s1 = g1->getOrCreateStateSet();
s1->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
s1->setTextureAttributeAndModes(0,new
osg::Texture2D(i1),osg::StateAttribute::ON);
gd1->addDrawable(g1);
}
osg::CameraNode* cam2 = new osg::CameraNode;
cam2->setColorMask(1.0,0.0,0.0,1.0);
cam2->setProjectionMatrixAsOrtho2D(0,1280,0,1024);
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
cam2->setViewMatrix(osg::Matrix::identity());
cam2->setClearMask(GL_DEPTH_BUFFER_BIT);
cam2->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
cam2->setViewMatrixAsLookAt(osg::Vec3(0.0f,-10.0f,10.0f),osg::Vec3(
0.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,10.0f));
cam2->addChild(gd1);
camera->addChild(cam2);
I can't get this work out. Please, can anybody tell me how to do this?
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/