コード例 #1
0
ファイル: g2o_qglviewer.cpp プロジェクト: Florenc/g2o
G2oQGLViewer::G2oQGLViewer(QWidget* parent, const QGLWidget* shareWidget, Qt::WFlags flags) :
  QGLViewer(parent, shareWidget, flags),
  graph(0), _drawActions(0), _drawList(0)
{
  setAxisIsDrawn(false);
  _drawActionParameters = new DrawAction::Parameters();
}
コード例 #2
0
ファイル: viewer.cpp プロジェクト: imclab/drishti
void
Viewer::drawBox()
{
  setAxisIsDrawn();
  
  glColor3d(0.5,0.5,0.5);

  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
  
  drawEnclosingCube(Vec(0,0,0),
		    Vec(m_height, m_width, m_depth));

  glColor3d(0.8,0.8,0.8);
  drawEnclosingCube(Vec(m_minHSlice, m_minWSlice, m_minDSlice),
		    Vec(m_maxHSlice, m_maxWSlice, m_maxDSlice));

  glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);

//  glBegin(GL_LINES);
//   glVertex3f(0, 0, 0);
//   glVertex3f(0, 0, m_depth);
//
//   glVertex3f(0, 0, m_depth);
//   glVertex3f(0, m_width, m_depth);
//
//   glVertex3f(0, m_width, m_depth);
//   glVertex3f(0, m_width, 0);
//
//   glVertex3f(0, m_width, 0);
//   glVertex3f(0, 0, 0);
//
//
//   glVertex3f(m_height, 0, 0);
//   glVertex3f(m_height, 0, m_depth);
//
//   glVertex3f(m_height, 0, m_depth);
//   glVertex3f(m_height, m_width, m_depth);
//
//   glVertex3f(m_height, m_width, m_depth);
//   glVertex3f(m_height, m_width, 0);
//
//   glVertex3f(m_height, m_width, 0);
//   glVertex3f(m_height, 0, 0);
//
//   glVertex3f(0, 0, 0);
//   glVertex3f(m_height, 0, 0);
//
//   glVertex3f(0, 0, m_depth);
//   glVertex3f(m_height, 0, m_depth);
//
//   glVertex3f(0, m_width, m_depth);
//   glVertex3f(m_height, m_width, m_depth);
//
//   glVertex3f(0, m_width, 0);
//   glVertex3f(m_height, m_width, 0);
//
//   glEnd();
}
コード例 #3
0
ファイル: QtGLView.cpp プロジェクト: manaze/WMIT
QtGLView::QtGLView(QWidget *parent) :
		QGLViewer(parent),
		drawLightSource(true)
{
	setStateFileName(QString::null);
	connect(&textureUpdater, SIGNAL(fileChanged(QString)), this, SLOT(textureChanged(QString)));

	setShortcut(DISPLAY_FPS, 0); // Disable stuff that won't work.
	setGridIsDrawn(true);
	setAxisIsDrawn(true);
}
コード例 #4
0
ファイル: wzmglwidget.cpp プロジェクト: C1annad/warzone2100
WZMOpenGLWidget::WZMOpenGLWidget(QWidget *parent)
		: QGLViewer(parent), psModel(NULL), teamIndex(0),
		selectedMesh(-1), animation(false), now(0)
{
	if (!QGLFormat::hasOpenGL())
	{
		qWarning("This system has no OpenGL support!");
		exit(EXIT_FAILURE);
	}
	timer.start();
	setAxisIsDrawn(true);
}
コード例 #5
0
  void ViewerWidget::postDraw(){

    // Reset model view matrix to world coordinates origin
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    camera()->loadModelViewMatrix();
    // TODO restore model loadProjectionMatrixStereo

    // Save OpenGL state
    glPushAttrib(GL_ALL_ATTRIB_BITS);

    glDisable(GL_COLOR_MATERIAL);
    qglColor(foregroundColor());

    if (gridIsDrawn()){
      glLineWidth(1.0);
      drawGrid(5.0, 10);
    }
    if (axisIsDrawn()){
      glLineWidth(2.0);
      drawAxis(1.0);
    }

    // Restore GL state
    glPopAttrib();
    glPopMatrix();

    m_drawAxis = axisIsDrawn();
    m_drawGrid = gridIsDrawn();
    setAxisIsDrawn(false);
    setGridIsDrawn(false);
    QGLViewer::postDraw();

    setAxisIsDrawn(m_drawAxis);
    setGridIsDrawn(m_drawGrid);
  }
コード例 #6
0
ファイル: g2o_qglviewer.cpp プロジェクト: Florenc/g2o
void G2oQGLViewer::init()
{
  QGLViewer::init();

 //glDisable(GL_LIGHT0);
 //glDisable(GL_LIGHTING);

  setBackgroundColor(QColor::fromRgb(51, 51, 51));

  // some default settings i like
  glEnable(GL_LINE_SMOOTH);
  glEnable(GL_BLEND); 
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_NORMALIZE);
  //glEnable(GL_CULL_FACE);
  glShadeModel(GL_FLAT);
  //glShadeModel(GL_SMOOTH);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  setAxisIsDrawn();

  // don't save state
  setStateFileName(QString::null);

  // mouse bindings
  setMouseBinding(Qt::RightButton, CAMERA, ZOOM);
  setMouseBinding(Qt::MidButton, CAMERA, TRANSLATE);

  // keyboard shortcuts
  setShortcut(CAMERA_MODE, 0);
  setShortcut(EXIT_VIEWER, 0);
  //setShortcut(SAVE_SCREENSHOT, 0);

  // replace camera
  qglviewer::Camera* oldcam = camera();
  qglviewer::Camera* cam = new StandardCamera();
  setCamera(cam);
  cam->setPosition(qglviewer::Vec(0., 0., 75.));
  cam->setUpVector(qglviewer::Vec(0., 1., 0.));
  cam->lookAt(qglviewer::Vec(0., 0., 0.));
  delete oldcam;

  // getting a display list
  _drawList = glGenLists(1);
}
コード例 #7
0
ファイル: slam2d_viewer.cpp プロジェクト: GlebKrivovyaz/g2o
void Slam2DViewer::init()
{
  QGLViewer::init();

  // some default settings i like
  glEnable(GL_LINE_SMOOTH);
  glEnable(GL_BLEND); 
  glEnable(GL_DEPTH_TEST);
  glShadeModel(GL_SMOOTH);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

  setAxisIsDrawn();

  // don't save state
  setStateFileName(QString::null);

  // mouse bindings
#ifdef QGLVIEWER_DEPRECATED_MOUSEBINDING
  setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, ZOOM);
  setMouseBinding(Qt::NoModifier, Qt::MidButton, CAMERA, TRANSLATE);
#else
  setMouseBinding(Qt::RightButton, CAMERA, ZOOM);
  setMouseBinding(Qt::MidButton, CAMERA, TRANSLATE);
#endif

  // keyboard shortcuts
  setShortcut(CAMERA_MODE, 0);
  setShortcut(EXIT_VIEWER, 0);
  //setShortcut(SAVE_SCREENSHOT, 0);

  // replace camera
  qglviewer::Camera* oldcam = camera();
  qglviewer::Camera* cam = new StandardCamera();
  setCamera(cam);
  cam->setPosition(qglviewer::Vec(0., 0., 75.));
  cam->setUpVector(qglviewer::Vec(0., 1., 0.));
  cam->lookAt(qglviewer::Vec(0., 0., 0.));
  delete oldcam;
}
コード例 #8
0
ファイル: ahrs_viewer.cpp プロジェクト: walchko/ahrs
  virtual void init(){
		restoreStateFromFile();
		glDisable(GL_LIGHTING);
		setGridIsDrawn(false);
		//help(); 
		setAnimationPeriod(0); // fast as possible
		startAnimation();
		showEntireScene();
		
		// Make world axis visible
		setAxisIsDrawn(true);
		
		// Move camera according to viewer type (on X, Y or Z axis)
		camera()->setPosition(qglviewer::Vec(2.0,2.0,2.0));
		camera()->setUpVector(qglviewer::Vec(0.0,0.0,1.0));
		camera()->lookAt(sceneCenter());
		
		/*
		// Forbid rotation
		qglviewer::WorldConstraint* constraint = new qglviewer::WorldConstraint();
		constraint->setRotationConstraintType(qglviewer::AxisPlaneConstraint::FORBIDDEN);
		camera()->frame()->setConstraint(constraint);
		*/
	}
コード例 #9
0
int QGLViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGLWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: viewerInitialized(); break;
        case 1: drawNeeded(); break;
        case 2: drawFinished((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: animateNeeded(); break;
        case 4: helpRequired(); break;
        case 5: axisIsDrawnChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 6: gridIsDrawnChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 7: FPSIsDisplayedChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: textIsEnabledChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 9: cameraIsEditedChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 10: stereoChanged((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 11: pointSelected((*reinterpret_cast< const QMouseEvent*(*)>(_a[1]))); break;
        case 12: mouseGrabberChanged((*reinterpret_cast< qglviewer::MouseGrabber*(*)>(_a[1]))); break;
        case 13: setAxisIsDrawn((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 14: setAxisIsDrawn(); break;
        case 15: setGridIsDrawn((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 16: setGridIsDrawn(); break;
        case 17: setFPSIsDisplayed((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 18: setFPSIsDisplayed(); break;
        case 19: setTextIsEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 20: setTextIsEnabled(); break;
        case 21: setCameraIsEdited((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 22: setCameraIsEdited(); break;
        case 23: toggleAxisIsDrawn(); break;
        case 24: toggleGridIsDrawn(); break;
        case 25: toggleFPSIsDisplayed(); break;
        case 26: toggleTextIsEnabled(); break;
        case 27: toggleCameraIsEdited(); break;
        case 28: setBackgroundColor((*reinterpret_cast< const QColor(*)>(_a[1]))); break;
        case 29: setForegroundColor((*reinterpret_cast< const QColor(*)>(_a[1]))); break;
        case 30: setSceneRadius((*reinterpret_cast< float(*)>(_a[1]))); break;
        case 31: setSceneCenter((*reinterpret_cast< const qglviewer::Vec(*)>(_a[1]))); break;
        case 32: setSceneBoundingBox((*reinterpret_cast< const qglviewer::Vec(*)>(_a[1])),(*reinterpret_cast< const qglviewer::Vec(*)>(_a[2]))); break;
        case 33: showEntireScene(); break;
        case 34: setCamera((*reinterpret_cast< qglviewer::Camera*const(*)>(_a[1]))); break;
        case 35: setManipulatedFrame((*reinterpret_cast< qglviewer::ManipulatedFrame*(*)>(_a[1]))); break;
        case 36: setMouseGrabber((*reinterpret_cast< qglviewer::MouseGrabber*(*)>(_a[1]))); break;
        case 37: setFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 38: setFullScreen(); break;
        case 39: setStereoDisplay((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 40: setStereoDisplay(); break;
        case 41: toggleFullScreen(); break;
        case 42: toggleStereoDisplay(); break;
        case 43: toggleCameraMode(); break;
        case 44: saveSnapshot((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 45: saveSnapshot((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 46: saveSnapshot(); break;
        case 47: saveSnapshot((*reinterpret_cast< const QString(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 48: saveSnapshot((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 49: setSnapshotFileName((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 50: setSnapshotFormat((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 51: setSnapshotCounter((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 52: setSnapshotQuality((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 53: { bool _r = openSnapshotFormatDialog();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 54: snapshotToClipboard(); break;
        case 55: copyBufferToTexture((*reinterpret_cast< GLint(*)>(_a[1])),(*reinterpret_cast< GLenum(*)>(_a[2]))); break;
        case 56: copyBufferToTexture((*reinterpret_cast< GLint(*)>(_a[1]))); break;
        case 57: setAnimationPeriod((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 58: startAnimation(); break;
        case 59: stopAnimation(); break;
        case 60: animate(); break;
        case 61: toggleAnimation(); break;
        case 62: help(); break;
        case 63: aboutQGLViewer(); break;
        case 64: select((*reinterpret_cast< const QMouseEvent*(*)>(_a[1]))); break;
        case 65: select((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 66: setSelectBufferSize((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 67: setSelectRegionWidth((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 68: setSelectRegionHeight((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 69: setSelectedName((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 70: setShortcut((*reinterpret_cast< KeyboardAction(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 71: setKeyboardAccelerator((*reinterpret_cast< KeyboardAction(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 72: setKeyDescription((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 73: setKeyFrameKey((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 74: setPlayKeyFramePathStateKey((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 75: setPlayPathStateKey((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 76: setAddKeyFrameStateKey((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 77: setPathKey((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 78: setPathKey((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 79: setPlayPathKeyboardModifiers((*reinterpret_cast< QtKeyboardModifiers(*)>(_a[1]))); break;
        case 80: setAddKeyFrameKeyboardModifiers((*reinterpret_cast< QtKeyboardModifiers(*)>(_a[1]))); break;
        case 81: setMouseBinding((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< MouseHandler(*)>(_a[2])),(*reinterpret_cast< MouseAction(*)>(_a[3])),(*reinterpret_cast< bool(*)>(_a[4]))); break;
        case 82: setMouseBinding((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< MouseHandler(*)>(_a[2])),(*reinterpret_cast< MouseAction(*)>(_a[3]))); break;
        case 83: setWheelBinding((*reinterpret_cast< QtKeyboardModifiers(*)>(_a[1])),(*reinterpret_cast< MouseHandler(*)>(_a[2])),(*reinterpret_cast< MouseAction(*)>(_a[3])),(*reinterpret_cast< bool(*)>(_a[4]))); break;
        case 84: setWheelBinding((*reinterpret_cast< QtKeyboardModifiers(*)>(_a[1])),(*reinterpret_cast< MouseHandler(*)>(_a[2])),(*reinterpret_cast< MouseAction(*)>(_a[3]))); break;
        case 85: setHandlerKeyboardModifiers((*reinterpret_cast< MouseHandler(*)>(_a[1])),(*reinterpret_cast< QtKeyboardModifiers(*)>(_a[2]))); break;
        case 86: setHandlerStateKey((*reinterpret_cast< MouseHandler(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 87: setMouseStateKey((*reinterpret_cast< MouseHandler(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 88: initFromDOMElement((*reinterpret_cast< const QDomElement(*)>(_a[1]))); break;
        case 89: saveStateToFile(); break;
        case 90: { bool _r = restoreStateFromFile();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 91: setStateFileName((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 92: saveToFile((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 93: saveToFile(); break;
        case 94: { bool _r = restoreFromFile((*reinterpret_cast< const QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 95: { bool _r = restoreFromFile();
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 96: resetVisualHints(); break;
        case 97: delayedFullScreen(); break;
        case 98: hideMessage(); break;
        default: ;
        }
        _id -= 99;
    }
    return _id;
}