main.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <boost/thread.hpp>
00003 #include <pangolin/pangolin.h>
00004 
00005 using namespace pangolin;
00006 using namespace std;
00007 
00008 #include <pangolin/display_internal.h>
00009 
00010 int main( int /*argc*/, char* argv[] )
00011 {
00012   // Create OpenGL window in single line thanks to GLUT
00013   pangolin::CreateGlutWindowAndBind("Main",640,480);
00014 
00015   // Issue specific OpenGl we might need, in this case for smooth lines
00016   glEnable (GL_BLEND);
00017   glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00018 
00019   // Data logger object
00020   DataLog log;
00021 
00022   // OpenGL 'view' of data. We might have many views of the same data.
00023   Plotter plotter(&log);
00024   plotter.SetBounds(0.0, 1.0, 0.0, 1.0);
00025   DisplayBase().AddDisplay(plotter);
00026 
00027   double t = 0;
00028 
00029   // Optionally add named labels
00030   vector<std::string> labels;
00031   labels.push_back(std::string("sin(t)"));
00032   labels.push_back(std::string("cos(t)"));
00033   labels.push_back(std::string("tan(t)"));
00034   labels.push_back(std::string("sin(t)+cos(t)"));
00035   log.SetLabels(labels);
00036 
00037   const double tinc = 0.01;
00038 
00039   // Default hooks for exiting (Esc) and fullscreen (tab).
00040   while( !pangolin::ShouldQuit() )
00041   {
00042     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
00043 
00044     log.Log(sin(t),cos(t),tan(t),sin(t)+cos(t));
00045     t += tinc;
00046 
00047     // Render graph, Swap frames and Process Events
00048     pangolin::FinishGlutFrame();
00049 
00050     boost::this_thread::sleep(boost::posix_time::milliseconds(10));
00051   }
00052 
00053   return 0;
00054 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


pangolin_wrapper
Author(s): Todor Stoyanov
autogenerated on Wed Feb 13 2013 14:03:25