1. Use osgviewer: viewer to replace the original osgproducer: Viewer
2. Familiarize yourself with the design mode, such as the most common visitor design mode. Otherwise you cannot understand Program Not to mention, and cannot write programs.
3. For details about running the form mode, refer to example osgwindows. The focus is: OSG: ref_ptr < OSG: graphicscontext: traits > Traits = New OSG: graphicscontext: traits;
Traits -> X = 640 ;
Traits -> Y = 0 ;
Traits -> Width = 640 ;
Traits -> Height = 480 ;
Traits -> Windowdecoration = True ;
Traits -> Doublebuffer = True ;
Traits -> Sharedcontext = 0 ;
OSG: ref_ptr<OSG: graphicscontext>GC=OSG: graphicscontext: creategraphicscontext (traits.Get());
OSG: ref_ptr < OSG: Camera > Camera = New OSG: camera;
Camera -> Setgraphicscontext (GC. Get ());
Camera -> Setviewport ( New OSG: viewport ( 0 , 0 , Traits -> Width, traits -> Height ));
Glenum Buffer = Traits -> Doublebuffer ? Gl_back: gl_front;
Camera -> Setdrawbuffer (buffer );
Camera -> Setreadbuffer (buffer );
//Add this slave camra to the viewer, with a shift right of the projection matrix
Viewer. addslave (camera.Get(), OSG: matrixd: translate (-1.0,0.0,0.0), OSG: matrixd ());
Todo:
1.3ds import plug-in is not complete yet. You need to write it yourself.
2. Have a better understanding of the OSG mechanism.