Commit fa14c26f authored by Sylvain Thery's avatar Sylvain Thery
Browse files

update QGLViewer usage in simple application

parent 2c6c911f
...@@ -195,14 +195,17 @@ public: ...@@ -195,14 +195,17 @@ public:
*/ */
void setParamObject(float width, float* pos) { m_qglWidget->setParamObject(width, pos); } void setParamObject(float width, float* pos) { m_qglWidget->setParamObject(width, pos); }
/**
* set BB min & max corner of object to draw
*/
void setObjectBB(float* bbmin, float* bbmax) { m_qglWidget->setObjectBB(bbmin, bbmax); }
/** /**
* @brief get pointer on QGLViewer widget for direct access * @brief get pointer on QGLViewer widget for direct access
* @return * @return
*/ */
QGLViewer* getQGLWidget() { return static_cast<QGLViewer*>(m_qglWidget); } QGLViewer* getQGLWidget() { return static_cast<QGLViewer*>(m_qglWidget); }
// void resetCenterOfRotation(float width, float* pos) { m_qglWidget->resetCenterOfRotation(width, pos); }
/** /**
* make the contex of glWidget current * make the contex of glWidget current
*/ */
......
...@@ -65,6 +65,7 @@ public: ...@@ -65,6 +65,7 @@ public:
QGLView(SimpleQGLV* ptr, QWidget *parent = 0); QGLView(SimpleQGLV* ptr, QWidget *parent = 0);
~QGLView(); ~QGLView();
void setObjectBB(float* bbmin, float* bbmax);
void setParamObject(float width, float* pos); void setParamObject(float width, float* pos);
void glMousePosition(int& x, int& y); void glMousePosition(int& x, int& y);
......
...@@ -57,8 +57,14 @@ void QGLView::setParamObject(float width, float* pos) ...@@ -57,8 +57,14 @@ void QGLView::setParamObject(float width, float* pos)
qglviewer::Vec bbMax(pos[0]+width/2.0f, pos[1]+width/2.0f, pos[2]+width/2.0f); qglviewer::Vec bbMax(pos[0]+width/2.0f, pos[1]+width/2.0f, pos[2]+width/2.0f);
camera()->setSceneBoundingBox(bbMin, bbMax); camera()->setSceneBoundingBox(bbMin, bbMax);
camera()->showEntireScene(); camera()->showEntireScene();
}
std::cout << "w p = "<< width << " / "<< pos[0]<< " , "<< pos[1]<< " , "<< pos[2]<< std::endl; void QGLView::setObjectBB(float* bbmin, float* bbmax)
{
qglviewer::Vec bbMin(bbmin[0], bbmin[1], bbmin[2]);
qglviewer::Vec bbMax(bbmax[0], bbmax[1], bbmax[2]);
camera()->setSceneBoundingBox(bbMin, bbMax);
camera()->showEntireScene();
} }
QSize QGLView::minimumSizeHint() const QSize QGLView::minimumSizeHint() const
...@@ -76,11 +82,6 @@ void QGLView::init() ...@@ -76,11 +82,6 @@ void QGLView::init()
glewInit(); glewInit();
if (m_sqgl) if (m_sqgl)
m_sqgl->cb_initGL(); m_sqgl->cb_initGL();
qglviewer::Vec bbMin(0.0,0.0,0.0);
qglviewer::Vec bbMax(2.0,2.0,2.0);
camera()->setSceneBoundingBox(bbMin, bbMax);
camera()->showEntireScene();
} }
void QGLView::preDraw() void QGLView::preDraw()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment