mirror of https://github.com/CGAL/cgal
52 lines
965 B
C++
52 lines
965 B
C++
#include "Viewer.h"
|
|
#include "Scene.h"
|
|
|
|
Viewer::Viewer(QWidget* parent)
|
|
: QGLViewer(parent),
|
|
m_pScene(NULL)
|
|
{
|
|
setBackgroundColor(::Qt::white);
|
|
}
|
|
|
|
void Viewer::setScene(Scene* pScene)
|
|
{
|
|
this->m_pScene = pScene;
|
|
}
|
|
|
|
void Viewer::draw()
|
|
{
|
|
QGLViewer::draw();
|
|
if(m_pScene == 0)
|
|
return;
|
|
|
|
::glLineWidth(1.0f);
|
|
::glPointSize(10.f);
|
|
::glEnable(GL_POLYGON_OFFSET_FILL);
|
|
::glPolygonOffset(1.0f,1.0f);
|
|
::glClearColor(1.0f,1.0f,1.0f,0.0f);
|
|
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
|
|
|
if(true)
|
|
{
|
|
::glEnable(GL_BLEND);
|
|
::glEnable(GL_LINE_SMOOTH);
|
|
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
|
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
}
|
|
else
|
|
{
|
|
::glDisable(GL_BLEND);
|
|
::glDisable(GL_LINE_SMOOTH);
|
|
::glDisable(GL_POLYGON_SMOOTH_HINT);
|
|
::glBlendFunc(GL_ONE, GL_ZERO);
|
|
::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
|
}
|
|
m_pScene->draw();
|
|
}
|
|
|
|
void Viewer::initializeGL()
|
|
{
|
|
QGLViewer::initializeGL();
|
|
}
|
|
|