Support sample buffers

This commit is contained in:
wmayer 2012-06-13 14:07:47 +02:00
parent 3259a16c29
commit de4e9a1d11
2 changed files with 27 additions and 0 deletions

View File

@ -26,6 +26,8 @@
# include <QClipboard>
# include <QEventLoop>
# include <QFileDialog>
# include <QGraphicsScene>
# include <QGraphicsView>
# include <QLabel>
# include <QStatusBar>
# include <QPointer>

View File

@ -32,6 +32,8 @@
# include <QDropEvent>
# include <QDragEnterEvent>
# include <QFileDialog>
# include <QGLFormat>
# include <QGLWidget>
# include <QPainter>
# include <QPrinter>
# include <QPrintDialog>
@ -299,6 +301,29 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M
else if (strcmp(Reason,"UseAntialiasing") == 0) {
_viewer->getGLRenderAction()->setSmoothing(rGrp.GetBool("UseAntialiasing",false));
}
else if (strcmp(Reason,"SampleBuffers") == 0) {
#if SOQT_MAJOR_VERSION > 1 || (SOQT_MAJOR_VERSION == 1 && SOQT_MINOR_VERSION >= 5)
_viewer->setSampleBuffers(rGrp.GetInt("SampleBuffers",4));
#else
// http://stackoverflow.com/questions/4207506/where-is-gl-multisample-defined
//int sb = rGrp.GetInt("SampleBuffers",4);
//QGLWidget* gl = static_cast<QGLWidget*>(_viewer->getGLWidget());
//QGLFormat fmt = gl->format();
//if (sb > 0) {
// fmt.setSampleBuffers(true);
// fmt.setSamples(sb);
// gl->setFormat(fmt);
// gl->makeCurrent();
// //glEnable(GL_MULTISAMPLE);
//}
//else {
// fmt.setSampleBuffers(false);
// gl->setFormat(fmt);
// gl->makeCurrent();
// //glDisable(GL_MULTISAMPLE);
//}
#endif
}
else if (strcmp(Reason,"ShowFPS") == 0) {
_viewer->setEnabledFPSCounter(rGrp.GetBool("ShowFPS",false));
}