47   return a->DrawOrder() < b->DrawOrder();
 
   51   QGLWidget(QGLFormat(QGL::SampleBuffers), parent),
 
   52   has_pixel_buffers_(false),
 
   53   pixel_buffer_size_(0),
 
   54   pixel_buffer_index_(0),
 
   55   capture_frames_(false),
 
   57   fix_orientation_(false),
 
   59   enable_antialiasing_(true),
 
   60   mouse_button_(Qt::NoButton),
 
   61   mouse_pressed_(false),
 
   65   mouse_hovering_(false),
 
   85   setMouseTracking(
true);
 
   92   setFocusPolicy(Qt::StrongFocus);
 
  112     int32_t buffer_size = width() * height() * 4;
 
  123       glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, buffer_size, 0, GL_STREAM_READ_ARB);
 
  125       glBufferDataARB(GL_PIXEL_PACK_BUFFER_ARB, buffer_size, 0, GL_STREAM_READ_ARB);
 
  126       glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
 
  135   GLenum err = glewInit();
 
  138     ROS_ERROR(
"Error: %s\n", glewGetErrorString(err));
 
  143     std::string extensions = (
const char*)glGetString(GL_EXTENSIONS);
 
  144     has_pixel_buffers_ = extensions.find(
"GL_ARB_pixel_buffer_object") != std::string::npos;
 
  147   glClearColor(0.58
f, 0.56
f, 0.5
f, 1);
 
  150     glEnable(GL_MULTISAMPLE);
 
  151     glEnable(GL_POINT_SMOOTH);
 
  152     glEnable(GL_LINE_SMOOTH);
 
  153     glEnable(GL_POLYGON_SMOOTH);
 
  154     glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
 
  155     glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
 
  156     glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
 
  160     glDisable(GL_MULTISAMPLE);
 
  161     glDisable(GL_POINT_SMOOTH);
 
  162     glDisable(GL_LINE_SMOOTH);
 
  163     glDisable(GL_POLYGON_SMOOTH);
 
  173   glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 
  174   glDepthFunc(GL_NEVER);
 
  175   glDisable(GL_DEPTH_TEST);
 
  186   glPixelStorei(GL_PACK_ALIGNMENT, 4);
 
  196     glReadPixels(0, 0, width(), height(), GL_BGRA, GL_UNSIGNED_BYTE, 0);
 
  198     GLubyte* 
data = 
reinterpret_cast<GLubyte*
>(glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB));
 
  205       glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
 
  207     glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0);
 
  211     int32_t buffer_size = width() * height() * 4;
 
  215     glReadPixels(0, 0, width(), height(), GL_BGRA, GL_UNSIGNED_BYTE, &
capture_buffer_[0]);
 
  227   p.setRenderHints(QPainter::Antialiasing |
 
  228                    QPainter::TextAntialiasing |
 
  229                    QPainter::SmoothPixmapTransform |
 
  230                    QPainter::HighQualityAntialiasing,
 
  232   p.beginNativePainting();
 
  236   glMatrixMode(GL_MODELVIEW);
 
  241   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
  259   std::list<MapvizPluginPtr>::iterator it;
 
  269     if ((*it)->SupportsPainting())
 
  271       p.endNativePainting();
 
  273       p.beginNativePainting();
 
  280   glMatrixMode(GL_MODELVIEW);
 
  282   p.endNativePainting();
 
  287   glMatrixMode(GL_TEXTURE);
 
  289   glMatrixMode(GL_PROJECTION);
 
  291   glMatrixMode(GL_MODELVIEW);
 
  293   glPushAttrib(GL_ALL_ATTRIB_BITS);
 
  299   glMatrixMode(GL_MODELVIEW);
 
  301   glMatrixMode(GL_PROJECTION);
 
  303   glMatrixMode(GL_TEXTURE);
 
  309   float numDegrees = e->delta() / -8;
 
  311   Zoom(numDegrees / 10.0);
 
  333   std::list<MapvizPluginPtr>::iterator it;
 
  342   bool invertible = 
true;
 
  343   return qtransform_.inverted(&invertible).map(point);
 
  369       case Qt::MiddleButton:
 
  376       case Qt::RightButton:
 
  380           Zoom(((
float)diff) / 10.0
f);
 
  392   double x = center_x + (e->x() - width() / 2.0) * 
view_scale_;
 
  393   double y = center_y + (height() / 2.0 - e->y()) * 
view_scale_;
 
  408   Q_EMIT 
Hover(0, 0, 0);
 
  414   std::list<MapvizPluginPtr>::iterator it;
 
  417     (*it)->SetTargetFrame(frame);
 
  445   format.setSwapInterval(1);
 
  448   this->setFormat(format);
 
  484   bool success = 
false;
 
  502     double roll, pitch, yaw;
 
  505     glRotatef(-yaw * 57.2957795, 0, 0, 1);
 
  566     glViewport(0, 0, width(), height());
 
  567     glMatrixMode(GL_PROJECTION);
 
  571     qtransform_ = QTransform::fromTranslate(width() / 2.0, height() / 2.0).
 
  599     ROS_ERROR(
"Invalid frame rate: %f", fps);