FACT++  1.0
int BasicGlCamera::PixelAtPosition ( const QPoint &  pos)
protectedvirtual

Definition at line 810 of file BasicGlCamera.cc.

References buffer, drawCamera(), height, resizeGL(), and viewSize.

Referenced by QCameraWidget::GetObjectInfo(), QCameraWidget::mouseDoubleClickEvent(), RawDataViewer::mouseDoubleClickEvent(), QCameraWidget::mouseMoveEvent(), QCameraWidget::mousePressEvent(), and RawDataViewer::mousePressEvent().

811  {
812  const int MaxSize = 512;
813  GLuint buffer[MaxSize];
814  GLint viewport[4];
815 
816  makeCurrent();
817 
818  glGetIntegerv(GL_VIEWPORT, viewport);
819  glSelectBuffer(MaxSize, buffer);
820  glRenderMode(GL_SELECT);
821 
822  glInitNames();
823  glPushName(0);
824 
825  glMatrixMode(GL_PROJECTION);
826  glPushMatrix();
827  glLoadIdentity();
828  GLfloat windowRatio = GLfloat(width()) / GLfloat(height());
829  gluPickMatrix(GLdouble(cPos.x()), GLdouble(viewport[3] - cPos.y()),
830  1.0, 1.0, viewport);
831 
832  if (windowRatio < 1)
833  {
834  windowRatio = 1.0f/windowRatio;
835  gluOrtho2D(-viewSize, viewSize, -viewSize*windowRatio, viewSize*windowRatio);
836  }
837  else
838  {
839  gluOrtho2D(-viewSize*windowRatio, viewSize*windowRatio, -viewSize, viewSize);
840  }
841 
842  glMatrixMode(GL_MODELVIEW);
843  drawCamera(false);
844  glMatrixMode(GL_PROJECTION);
845  glPopMatrix();
846 
847  //for some reason that I cannot understand, the push/pop matrix doesn't do the trick here... bizarre
848  //ok, so re-do the resizeGL thing.
849  resizeGL(width(), height());
850 
851  if (!glRenderMode(GL_RENDER))
852  return -1;
853 
854  return buffer[3];
855  }
virtual void resizeGL(int width, int height)
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
float height
Definition: HeadersGPS.h:26
virtual void drawCamera(bool alsoWire)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: