i am working with visual studio
in the gui i have to execute by button event a function to display the terrain in the same window, i wrote the following code but the terrain is displayed in a new window !
please i need some help to display the terrain in the same window
I suggest you take a look at the OpenSceneGraph source examples. In particular, look at the osgviewerFLTK.cpp example. They show how to embed an osgviewer into an existing window controlled by another GUI, in this case, FLTK.
Keep in mind that doing this will make the osgviewer run single-threaded.
If you need to embed the osgviewer into something like Windows Forms, that is a bit more involved. The OpenSceneGraph 3.0 cookbook by Rui Wang shows how this is done. If you don't have access to this resource, I can post the example...
While I think your request is beyond the scope of the osgEarth forum and is more applicable for the OpenSceneGraph community, I will go ahead and post the code to embed an osgviewer inside Windows Forms...