OpenFrames Wiki
Real-time interactive 3D graphics API for scientific simulations
Status: Beta
Brought to you by:
ravidavi
/*********************************** Copyright 2018 Ravishankar Mathur Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ***********************************/ #include <OpenFrames/FrameManager.hpp> #include <OpenFrames/Model.hpp> #include <OpenFrames/Sphere.hpp> #include <OpenFrames/WindowProxy.hpp> #include <osg/ArgumentParser> #include <osgDB/FileNameUtils> ///////////////////////////////////////////// // // Tutorial 1 - Drawing a reference frame. // ///////////////////////////////////////////// int main() { // Create the window interface. unsigned int x = 30, y = 30; unsigned int winWidth = 800, winHeight = 600; unsigned int numRows = 1, numCols = 1; osg::ref_ptr<OpenFrames::WindowProxy> myWindow = new OpenFrames::WindowProxy( x, y, winWidth, winHeight, numRows, numCols ); // Make a reference frame. OpenFrames::ReferenceFrame* myRoot = new OpenFrames::ReferenceFrame( "Root Frame" ); myRoot->setPosition( 0.0, 0.0, 0.0 ); // Make a frame manager for the scene. osg::ref_ptr<OpenFrames::FrameManager> myFrmMgr = new OpenFrames::FrameManager; myFrmMgr->setFrame( myRoot ); // Place the scene at a specified location. myWindow->setScene( myFrmMgr, 0, 0 ); // Set the window's name (optional). myWindow->setWindowName( "OpenFrames Tutorial 1" ); myWindow->startThread(); // Start window animation. myWindow->join(); // Wait for window animation to finish. return 0; }