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.org

Reply via email to