Hi Roman, In order to draw OpenGL code in the scene graph, you need to derive a class from the osg::Drawable class. Overload the osg::Drawable::drawImplementation method and have it call the VolumeClouds::Render method. You'll have to add any instance of this class to an osg::Geode and insert that geode into the scene graph.
To execute the VolumeClouds::Update call at the correct time during traversal, you'll have to add an osg::NodeCallback to the geode or an osg::Drawable::UpdateCallback to the drawable. In either case, you'll probably have to derive from the callback class and overload a method to make the call to VolumeClouds::Update. Hope this helps, Justin -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Roman Grigoriev Sent: Monday, December 03, 2007 9:12 AM To: OpenSceneGraph Users Subject: [osg-users] OSG and OpenGL rendering Hi guys! I try to implement Mark Harris cool clouds in osg but nowI try to use his code that he wrote on pure GL. all functions worked but I haven't seen clouds in window. As you see clouds are not connected to root node but I don't know how to use it. Please help me. here is my code: in main() osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; traits->x = 0; traits->y = 0; traits->width = 1280; traits->height = 1024; traits->windowDecoration = false; traits->doubleBuffer = true; traits->sharedContext = 0; traits->sampleBuffers = true; traits->samples=8; osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); camera.get()->setGraphicsContext(gc.get()); camera.get()->setViewport(new osg::Viewport(0,0, traits->width, traits->height)); GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT; camera.get()->setDrawBuffer(buffer); camera.get()->setReadBuffer(buffer); viewer.addSlave(camera.get(), true); root = new osg::Group(); viewer.setSceneData(root); if (VolumeClouds.Create(30, CloudPlaneSize / 2, CloudPlaneHeight)) return 1; Vector3 sunvector,cameraposition; sunvector.x=1; sunvector.y=0; sunvector.z=0; cameraposition.x=0; cameraposition.y=0; cameraposition.z=0; while(!viewer.done()) { VolumeClouds.Update(sunvector * SkyRadius, cameraposition); VolumeClouds.Render(cameraposition, sunvector * SkyRadius); viewer.frame(); } _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org