Windows fix

- add an attribute at the application in the main() function
- add a custom context to the viewer
This commit is contained in:
Maxime Gimeno 2015-07-08 12:16:51 +02:00
parent e12b46d285
commit f76bb19734
28 changed files with 331 additions and 338 deletions

View File

@ -38,6 +38,7 @@ int main(int argc, char **argv)
app.setOrganizationDomain("inria.fr");
app.setOrganizationName("INRIA");
app.setApplicationName("AABB tree demo");
//for windows
app.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGALQt (Qt4 or Qt5).

View File

@ -1321,7 +1321,6 @@ void Scene::initGL(Viewer *viewer)
// qFatal("Could not obtain required OpenGL context version");
// exit(1);
//}
qDebug()<<"Context's major version ="<<viewer->context()->format().majorVersion();
if(!gl->initializeOpenGLFunctions())
{
qFatal("ERROR : OpenGL Functions not initialized. Check your OpenGL Verison (should be >=3.3)");

View File

@ -2,9 +2,10 @@
#include "Scene.h"
#include <QMouseEvent>
#include <QGLFunctions>
#include <CGAL/Qt/CreateOpenGLContext.h>
Viewer::Viewer(QWidget* parent)
: QGLViewer(createContext(),parent),
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent),
m_pScene(NULL),
m_custom_mouse(false)
{

View File

@ -3,10 +3,10 @@
#include <QGLViewer/qglviewer.h>
// forward declarations
class QWidget;
class Scene;
class Viewer : public QGLViewer{
Q_OBJECT
@ -18,26 +18,14 @@ public:
void draw();
void initializeGL();
void setScene(Scene* pScene);
QOpenGLContext *oglContext()const {return oglContext_;}
protected:
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
private:
static QGLContext* createContext()
{
QOpenGLContext *context = new QOpenGLContext();
QSurfaceFormat format;
format.setVersion(3,3);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
context->setFormat(format);
return QGLContext::fromOpenGLContext(context);
}
Scene* m_pScene;
bool m_custom_mouse;
QOpenGLContext *oglContext_;
}; // end class Viewer
#endif // VIEWER_H

View File

@ -13,6 +13,7 @@ int main(int argc, char** argv)
application.setOrganizationDomain("geometryfactory.com");
application.setOrganizationName("GeometryFactory");
application.setApplicationName("Alpha Shape Reconstruction");
//for Windows
application.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGALQt (Qt4 or Qt5).

View File

@ -2,8 +2,13 @@
#include <vector>
#include <CGAL/bounding_box.h>
#include <QGLViewer/vec.h>
#include "CGAL/Qt/CreateOpenGLContext.h"
Viewer::Viewer(QWidget* parent)
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
{
are_buffers_initialized = false;
}
void Viewer::compile_shaders()

View File

@ -9,7 +9,6 @@
#include <QOpenGLShaderProgram>
class Viewer : public QGLViewer, protected QOpenGLFunctions_3_3_Core{
Q_OBJECT
@ -18,11 +17,7 @@ class Viewer : public QGLViewer, protected QOpenGLFunctions_3_3_Core{
int nr_of_facets;
public:
Viewer(QWidget* parent)
: QGLViewer(createContext(),parent)
{
are_buffers_initialized = false;
}
Viewer(QWidget* parent);
~Viewer()
{
buffers[0].destroy();
@ -42,16 +37,6 @@ public:
void draw();
private:
static QGLContext* createContext()
{
QOpenGLContext *context = new QOpenGLContext();
QSurfaceFormat format;
format.setVersion(3,3);
format.setProfile(QSurfaceFormat::CompatibilityProfile);
context->setFormat(format);
return QGLContext::fromOpenGLContext(context);
}
bool are_buffers_initialized;
//Shaders elements
int poly_vertexLocation;

View File

@ -8,10 +8,12 @@ int main(int argc, char** argv)
// Instantiate the viewer.
Viewer viewer;
//for Windows
application.setAttribute(Qt::AA_UseDesktopOpenGL);
#if QT_VERSION < 0x040000
// Set the viewer as the application main widget.
application.setMainWidget(&viewer);
#else
viewer.setWindowTitle("Intersection points of randomly generated circles.");
#endif

View File

@ -3,7 +3,11 @@
#include <CGAL/squared_distance_3.h>
#include <CGAL/Exact_spherical_kernel_3.h>
#include <vector>
#include "CGAL/IO/Qt_widget_createContext.h"
Viewer::Viewer(QWidget* parent )
: QGLViewer(CGAL::createContext(),parent)
{
}
void Viewer::compile_shaders()
{

View File

@ -10,6 +10,8 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC;
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core
{
public:
Viewer(QWidget* parent = 0);
GLuint dl_nb;
protected :
virtual void draw();

View File

@ -36,6 +36,8 @@ int main(int argc, char** argv)
application.setOrganizationDomain("cgal.org");
application.setOrganizationName("CNRS and LIRIS' Establishments");
application.setApplicationName("3D Linear Cell Complex");
//for windows
application.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGALQt4 or libCGALQt5.
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE

View File

@ -30,6 +30,7 @@
#include <CGAL/Constrained_triangulation_plus_2.h>
#include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
#include <CGAL/internal/Operations_on_polyhedra/compute_normal.h>
#include <CGAL/Qt/CreateOpenGLContext.h>
#include <QDebug>
typedef typename LCC::Traits Traits;
@ -49,6 +50,17 @@ typedef CGAL::Constrained_Delaunay_triangulation_2<P_traits,
TDS,
Itag> CDTbase;
typedef CGAL::Constrained_triangulation_plus_2<CDTbase> CDT;
Viewer::Viewer(QWidget* parent)
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent), wireframe(false), flatShading(true),
edges(true), vertices(true), m_displayListCreated(false)
{
QGLFormat newFormat = this->format();
newFormat.setSampleBuffers(true);
newFormat.setSamples(16);
this->setFormat(newFormat);
are_buffers_initialized = false;
}
//Make sure all the facets are triangles
bool
Viewer::is_Triangulated()

View File

@ -29,7 +29,6 @@
#include <QOpenGLVertexArrayObject>
#include <QGLBuffer>
#include <QOpenGLShaderProgram>
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core
{
Q_OBJECT
@ -53,16 +52,7 @@ class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core
public:
Viewer(QWidget* parent)
: QGLViewer(parent), wireframe(false), flatShading(true),
edges(true), vertices(true), m_displayListCreated(false)
{
QGLFormat newFormat = this->format();
newFormat.setSampleBuffers(true);
newFormat.setSamples(16);
this->setFormat(newFormat);
are_buffers_initialized = false;
}
Viewer(QWidget* parent);
~Viewer()
{
buffers[0].destroy();

View File

@ -10,6 +10,8 @@ int main(int argc, char **argv)
app.setOrganizationDomain("geometryfactory.com");
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Mesh_3 demo");
//for windows
app.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGALQt ( Qt5).
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE

View File

@ -1,8 +1,9 @@
#include <CGAL_demo/Viewer.h>
#include <CGAL_demo/Scene_draw_interface.h>
#include <CGAL/Qt/CreateOpenGLContext.h>
Viewer::Viewer(QWidget* parent, bool antialiasing)
: QGLViewer(parent),
: QGLViewer(CGAL::Qt::createOpenGLContext(), parent),
scene(0),
antialiasing(antialiasing),
twosides(false),

View File

@ -38,6 +38,7 @@ if (CGAL_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5
# use the Qt MOC preprocessor on classes that derive from QObject
qt5_generate_moc( "Scene.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Scene.cpp" )
qt5_generate_moc( "MainWindow.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_MainWindow.cpp" )
qt5_generate_moc( "Viewer.h" "${CMAKE_CURRENT_BINARY_DIR}/moc_Viewer.cpp" )
if(DEFINED QT_QCOLLECTIONGENERATOR_EXECUTABLE)
else()
@ -55,11 +56,12 @@ if (CGAL_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5
# Make sure the compiler can find generated .moc files
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
include_directories( ${QT_INCLUDE_DIR} )
include_directories( ../../include )
include_directories( ../../include .)
# The executable itself
add_executable ( periodic_3_triangulation_3_demo
Scene.cpp moc_Scene.cpp
Viewer.cpp moc_Viewer.cpp
periodic_3_triangulation_3_demo.cpp
MainWindow.ui moc_MainWindow.cpp
${UI_FILES} ${RESOURCE_FILES} Periodic_3_triangulation_3.qhc)

View File

@ -6,11 +6,12 @@
#include <QProcess>
#include <QTextStream>
#if QT_VERSION >= 0x050000
#include <QMessageBox>
#endif
class MainWindow : public QMainWindow
{

View File

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
<property name="geometry" >
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,21 +10,21 @@
<height>750</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>CGAL Periodic Delaunay Triangulation</string>
</property>
<widget class="QWidget" name="centralWidget" >
<layout class="QVBoxLayout" name="verticalLayout" >
<widget class="QWidget" name="centralWidget">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGLViewer" name="viewer" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<widget class="Viewer" name="viewer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -32,562 +33,562 @@
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar" >
<property name="geometry" >
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>962</width>
<height>22</height>
<height>20</height>
</rect>
</property>
<widget class="QMenu" name="menuFile" >
<property name="title" >
<widget class="QMenu" name="menuFile">
<property name="title">
<string>&amp;File</string>
</property>
<addaction name="actionLoad_Points" />
<addaction name="separator" />
<addaction name="actionExit" />
<addaction name="actionLoad_Points"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuOptions" >
<property name="title" >
<widget class="QMenu" name="menuOptions">
<property name="title">
<string>&amp;Options</string>
</property>
<addaction name="actionWireframe" />
<addaction name="actionPlanar_triangulation" />
<addaction name="separator" />
<addaction name="actionDraw_1_sheeted_covering" />
<addaction name="actionDraw_bordering_cells_multiply" />
<addaction name="separator" />
<addaction name="actionDraw_segments" />
<addaction name="actionDraw_triangles" />
<addaction name="actionDraw_tetrahedra" />
<addaction name="separator" />
<addaction name="actionDraw_cube_square" />
<addaction name="separator" />
<addaction name="actionClip_along_the_cube_square" />
<addaction name="action2_color_clipping" />
<addaction name="separator" />
<addaction name="actionWireframe"/>
<addaction name="actionPlanar_triangulation"/>
<addaction name="separator"/>
<addaction name="actionDraw_1_sheeted_covering"/>
<addaction name="actionDraw_bordering_cells_multiply"/>
<addaction name="separator"/>
<addaction name="actionDraw_segments"/>
<addaction name="actionDraw_triangles"/>
<addaction name="actionDraw_tetrahedra"/>
<addaction name="separator"/>
<addaction name="actionDraw_cube_square"/>
<addaction name="separator"/>
<addaction name="actionClip_along_the_cube_square"/>
<addaction name="action2_color_clipping"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuInitialization" >
<property name="title" >
<widget class="QMenu" name="menuInitialization">
<property name="title">
<string>&amp;Initialization</string>
</property>
<addaction name="actionEmpty_scene" />
<addaction name="actionSingle_Point" />
<addaction name="actionRandom_Point_Set" />
<addaction name="actionRandom_Points_in_Plane" />
<addaction name="actionPoint_grid" />
<addaction name="actionEmpty_scene"/>
<addaction name="actionSingle_Point"/>
<addaction name="actionRandom_Point_Set"/>
<addaction name="actionRandom_Points_in_Plane"/>
<addaction name="actionPoint_grid"/>
</widget>
<widget class="QMenu" name="menuFeatures" >
<property name="title" >
<widget class="QMenu" name="menuFeatures">
<property name="title">
<string>&amp;Features</string>
</property>
<addaction name="actionPoint_location" />
<addaction name="actionConflict_region" />
<addaction name="actionPoint_location"/>
<addaction name="actionConflict_region"/>
</widget>
<widget class="QMenu" name="menuActions" >
<property name="title" >
<widget class="QMenu" name="menuActions">
<property name="title">
<string>&amp;Actions</string>
</property>
<addaction name="actionFlying_ball" />
<addaction name="actionPause" />
<addaction name="separator" />
<addaction name="actionInsert_point" />
<addaction name="actionInsert_random_point" />
<addaction name="separator" />
<addaction name="actionGrab_image" />
<addaction name="actionFlying_ball"/>
<addaction name="actionPause"/>
<addaction name="separator"/>
<addaction name="actionInsert_point"/>
<addaction name="actionInsert_random_point"/>
<addaction name="separator"/>
<addaction name="actionGrab_image"/>
</widget>
<widget class="QMenu" name="menuHelp" >
<property name="title" >
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Help</string>
</property>
<addaction name="actionDemo_Help" />
<addaction name="separator" />
<addaction name="actionAbout" />
<addaction name="actionAbout_CGAL" />
<addaction name="actionDemo_Help"/>
<addaction name="separator"/>
<addaction name="actionAbout"/>
<addaction name="actionAbout_CGAL"/>
</widget>
<addaction name="menuFile" />
<addaction name="menuInitialization" />
<addaction name="menuActions" />
<addaction name="menuFeatures" />
<addaction name="menuOptions" />
<addaction name="menuHelp" />
<addaction name="menuFile"/>
<addaction name="menuInitialization"/>
<addaction name="menuActions"/>
<addaction name="menuFeatures"/>
<addaction name="menuOptions"/>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusBar" />
<widget class="QToolBar" name="toolBar" >
<property name="windowTitle" >
<widget class="QStatusBar" name="statusBar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea" >
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionLoad_Points" />
<addaction name="actionGrab_image" />
<addaction name="separator" />
<addaction name="actionEmpty_scene" />
<addaction name="actionSingle_Point" />
<addaction name="actionRandom_Point_Set" />
<addaction name="actionRandom_Points_in_Plane" />
<addaction name="actionPoint_grid" />
<addaction name="separator" />
<addaction name="actionPause" />
<addaction name="actionFlying_ball" />
<addaction name="separator" />
<addaction name="actionInsert_point" />
<addaction name="actionInsert_random_point" />
<addaction name="separator" />
<addaction name="actionPoint_location" />
<addaction name="actionConflict_region" />
<addaction name="separator" />
<addaction name="actionWireframe" />
<addaction name="actionPlanar_triangulation" />
<addaction name="separator" />
<addaction name="actionDraw_1_sheeted_covering" />
<addaction name="actionDraw_bordering_cells_multiply" />
<addaction name="actionClip_along_the_cube_square" />
<addaction name="action2_color_clipping" />
<addaction name="actionLoad_Points"/>
<addaction name="actionGrab_image"/>
<addaction name="separator"/>
<addaction name="actionEmpty_scene"/>
<addaction name="actionSingle_Point"/>
<addaction name="actionRandom_Point_Set"/>
<addaction name="actionRandom_Points_in_Plane"/>
<addaction name="actionPoint_grid"/>
<addaction name="separator"/>
<addaction name="actionPause"/>
<addaction name="actionFlying_ball"/>
<addaction name="separator"/>
<addaction name="actionInsert_point"/>
<addaction name="actionInsert_random_point"/>
<addaction name="separator"/>
<addaction name="actionPoint_location"/>
<addaction name="actionConflict_region"/>
<addaction name="separator"/>
<addaction name="actionWireframe"/>
<addaction name="actionPlanar_triangulation"/>
<addaction name="separator"/>
<addaction name="actionDraw_1_sheeted_covering"/>
<addaction name="actionDraw_bordering_cells_multiply"/>
<addaction name="actionClip_along_the_cube_square"/>
<addaction name="action2_color_clipping"/>
</widget>
<action name="actionLoad_Points" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionLoad_Points">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/fileOpen.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/fileOpen.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Load Points</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+O</string>
</property>
</action>
<action name="actionExit" >
<property name="text" >
<action name="actionExit">
<property name="text">
<string>Exit</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+Q</string>
</property>
</action>
<action name="actionWireframe" >
<property name="checkable" >
<action name="actionWireframe">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/wireframe.png</normaloff>
<normalon>:/cgal/Periodic_3_triangulation_3/icons/wireframeOff.png</normalon>:/cgal/Periodic_3_triangulation_3/icons/wireframe.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Wireframe</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Switches wireframe rendering on and off</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>X</string>
</property>
</action>
<action name="actionPlanar_triangulation" >
<property name="checkable" >
<action name="actionPlanar_triangulation">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/planar.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/planar.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Planar triangulation</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Shows only simplices for which z=0 everywhere</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Z</string>
</property>
</action>
<action name="actionDraw_1_sheeted_covering" >
<property name="checkable" >
<action name="actionDraw_1_sheeted_covering">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/cover1.png</normaloff>
<normalon>:/cgal/Periodic_3_triangulation_3/icons/cover27.png</normalon>:/cgal/Periodic_3_triangulation_3/icons/cover1.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Draw 1-sheeted covering</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>toggles between displaying only one periodic copy of each simplex and the internal representation </string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>1</string>
</property>
</action>
<action name="actionDraw_bordering_cells_multiply" >
<property name="checkable" >
<action name="actionDraw_bordering_cells_multiply">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/multiple.png</normaloff>
<normalon>:/cgal/Periodic_3_triangulation_3/icons/multipleOff.png</normalon>:/cgal/Periodic_3_triangulation_3/icons/multiple.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Draw bordering cells multiply</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Draws each simplex for which the intersection with the fundamental cube is non-empty</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>M</string>
</property>
</action>
<action name="actionClip_along_the_cube_square" >
<property name="checkable" >
<action name="actionClip_along_the_cube_square">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/clipping.png</normaloff>
<normalon>:/cgal/Periodic_3_triangulation_3/icons/clippingOff.png</normalon>:/cgal/Periodic_3_triangulation_3/icons/clipping.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Clip along the cube/square</string>
</property>
</action>
<action name="action2_color_clipping" >
<property name="checkable" >
<action name="action2_color_clipping">
<property name="checkable">
<bool>true</bool>
</property>
<property name="enabled" >
<property name="enabled">
<bool>false</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/twoColorClipping.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/twoColorClipping.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>2-color clipping</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>show the clipped part of all clipped edges in a different color</string>
</property>
</action>
<action name="actionPoint_grid" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionPoint_grid">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/initGrid.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/initGrid.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Point grid</string>
</property>
<property name="iconText" >
<property name="iconText">
<string>pg</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>A grid of 36 points that can be triangulated in 1-sheeted covering space</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>F5</string>
</property>
</action>
<action name="actionSingle_Point" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionSingle_Point">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/init1.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/init1.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Single point</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>F2</string>
</property>
</action>
<action name="actionRandom_Points_in_Plane" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionRandom_Points_in_Plane">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/initRandPlanar.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/initRandPlanar.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Random planar point set</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Initial triangulation of 10 points chosen at random with z=0</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>F4</string>
</property>
</action>
<action name="actionRandom_Point_Set" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionRandom_Point_Set">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/initRand.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/initRand.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Random point set</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Initial triangulation of 30 points chosen at random</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>F3</string>
</property>
</action>
<action name="actionEmpty_scene" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionEmpty_scene">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/init0.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/init0.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Empty scene</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>F1</string>
</property>
</action>
<action name="actionDraw_cube_square" >
<property name="checkable" >
<action name="actionDraw_cube_square">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
<property name="text" >
<property name="text">
<string>Draw domain (cube/square)</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>D</string>
</property>
</action>
<action name="actionPoint_location" >
<property name="checkable" >
<action name="actionPoint_location">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/locate.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/locate.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Point location</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Marks the tetrahedron that currently contains the flying ball</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>L</string>
</property>
</action>
<action name="actionConflict_region" >
<property name="checkable" >
<action name="actionConflict_region">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/conflict.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/conflict.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Conflict region</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Shows all tetrahedra in whose circumcircle the flying ball is contained</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>C</string>
</property>
</action>
<action name="actionHole" >
<property name="checkable" >
<action name="actionHole">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text" >
<property name="text">
<string>Hole*</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>H</string>
</property>
</action>
<action name="actionStar" >
<property name="checkable" >
<action name="actionStar">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text" >
<property name="text">
<string>Star*</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>S</string>
</property>
</action>
<action name="actionFlying_ball" >
<property name="checkable" >
<action name="actionFlying_ball">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/ball.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/ball.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Flying ball</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Shows a ball flying through the cube, showing the periodicity</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>B</string>
</property>
</action>
<action name="actionPause" >
<property name="checkable" >
<action name="actionPause">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/pause.png</normaloff>
<normalon>:/cgal/Periodic_3_triangulation_3/icons/play.png</normalon>:/cgal/Periodic_3_triangulation_3/icons/pause.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Pause</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Pauses the flying ball</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>P</string>
</property>
</action>
<action name="actionInsert_point" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionInsert_point">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/inputPointBall.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/inputPointBall.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Insert point</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Insert point at the position of the flying ball (whether it is shown or not)</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>I</string>
</property>
</action>
<action name="actionInsert_random_point" >
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<action name="actionInsert_random_point">
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/inputPointRandom.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/inputPointRandom.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Insert random point</string>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Insert one point at random position (within the cube)</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>R</string>
</property>
</action>
<action name="actionDraw_segments" >
<property name="checkable" >
<action name="actionDraw_segments">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>false</bool>
</property>
<property name="text" >
<property name="text">
<string>Draw segments</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>2</string>
</property>
</action>
<action name="actionDraw_triangles" >
<property name="checkable" >
<action name="actionDraw_triangles">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text" >
<property name="text">
<string>Draw triangles</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>3</string>
</property>
</action>
<action name="actionDraw_tetrahedra" >
<property name="checkable" >
<action name="actionDraw_tetrahedra">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
<property name="text" >
<property name="text">
<string>Draw tetrahedra</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>4</string>
</property>
</action>
<action name="actionGrab_image" >
<property name="checkable" >
<action name="actionGrab_image">
<property name="checkable">
<bool>false</bool>
</property>
<property name="icon" >
<iconset resource="Periodic_3_triangulation_3.qrc" >
<property name="icon">
<iconset resource="Periodic_3_triangulation_3.qrc">
<normaloff>:/cgal/Periodic_3_triangulation_3/icons/camera.png</normaloff>:/cgal/Periodic_3_triangulation_3/icons/camera.png</iconset>
</property>
<property name="text" >
<property name="text">
<string>Grab image</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>G</string>
</property>
</action>
<action name="actionExport_pov" >
<property name="text" >
<action name="actionExport_pov">
<property name="text">
<string>Export pov</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>Ctrl+E</string>
</property>
</action>
<action name="actionDemo_Help" >
<property name="text" >
<action name="actionDemo_Help">
<property name="text">
<string>Demo Manual</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>H</string>
</property>
</action>
<action name="actionAbout" >
<property name="text" >
<action name="actionAbout">
<property name="text">
<string>About</string>
</property>
<property name="shortcut" >
<property name="shortcut">
<string>A</string>
</property>
</action>
<action name="actionAbout_CGAL" >
<property name="text" >
<action name="actionAbout_CGAL">
<property name="text">
<string>About CGAL</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11" />
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QGLViewer</class>
<class>Viewer</class>
<extends>QWidget</extends>
<header>QGLViewer/qglviewer.h</header>
<header>Viewer.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Periodic_3_triangulation_3.qrc" />
<include location="Periodic_3_triangulation_3.qrc"/>
</resources>
<connections>
<connection>
@ -596,11 +597,11 @@
<receiver>action2_color_clipping</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>-1</x>
<y>-1</y>
</hint>

View File

@ -1355,9 +1355,9 @@ void Scene::gl_draw_location() {
Point cp = Point(c.x(),c.y(),c.z());
// project facet center
double px,py,pz;
gluProject(cp.x(),cp.y(),cp.z(),
modelMatrix, projMatrix, viewport,
&px,&py,&pz);
// gluProject(cp.x(),cp.y(),cp.z(),
// modelMatrix, projMatrix, viewport,
// &px,&py,&pz);
cf.push_back(Projected_triangle(pz,Triangle(p,q,r)));
}
}

View File

@ -75,7 +75,6 @@ public:
}
~Scene() {
gluDeleteQuadric(pQuadric);
for(int i=0; i<24; i++)
buffers[i].destroy();
for(int i=0; i<12; i++)
@ -308,7 +307,6 @@ private:
QString materials[6];
QTimer* timer;
GLuint l_triangulation, l_domain;
GLUquadricObj* pQuadric;
bool flying_ball;
bool dlocate, dconflict;

View File

@ -10,7 +10,7 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
//w.ui->setupUi();
//w.ui->setupUi(w);
w.ui->viewer->restoreStateFromFile();
w.show();

View File

@ -9,6 +9,8 @@ int main(int argc, char** argv)
application.setOrganizationDomain("inria.fr");
application.setOrganizationName("INRIA");
application.setApplicationName("3D Periodic Lloyd");
//for windows
application.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGAL (Qt4 or QT5).
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE

View File

@ -7,6 +7,7 @@
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <CGAL/Qt/CreateOpenGLContext.h>
class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core {
@ -21,7 +22,7 @@ class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core {
int nr_of_facets;
public:
Viewer(QWidget* parent)
: QGLViewer(parent)
: QGLViewer(CGAL::Qt::createOpenGLContext(), parent)
{}
~Viewer()
{

View File

@ -4,7 +4,7 @@
#include <QGLViewer/qglviewer.h>
#include <QWidget>
#include <QPoint>
#include <CGAL/Qt/CreateOpenGLContext.h>
// forward declarations
class QWidget;
class Scene_draw_interface;
@ -18,8 +18,8 @@ class VIEWER_EXPORT Viewer_interface : public QGLViewer {
Q_OBJECT
public:
Viewer_interface(QWidget* parent) : QGLViewer(parent) {};
virtual ~Viewer_interface() {};
Viewer_interface(QWidget* parent) : QGLViewer(CGAL::Qt::createOpenGLContext(), parent) {}
virtual ~Viewer_interface() {}
virtual void setScene(Scene_draw_interface* scene) = 0;
virtual bool antiAliasing() const = 0;

View File

@ -38,6 +38,8 @@ int main(int argc, char **argv)
app.setOrganizationDomain("geometryfactory.com");
app.setOrganizationName("GeometryFactory");
app.setApplicationName("Polyhedron_3 demo");
//for windows
app.setAttribute(Qt::AA_UseDesktopOpenGL);
// Import resources from libCGAL (Qt4 or Qt5).
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE

View File

@ -83,21 +83,15 @@ bool Viewer::inFastDrawing() const {
void Viewer::draw()
{
d->inFastDrawing = false;
// ::glFogf(GL_FOG_END, 2*sceneRadius());
// ::glEnable(GL_FOG);
QGLViewer::draw();
d->draw_aux(false, this);
// drawLight(GL_LIGHT0);
}
void Viewer::fastDraw()
{
d->inFastDrawing = true;
// ::glFogf(GL_FOG_END, 2*sceneRadius());
// ::glEnable(GL_FOG);
QGLViewer::fastDraw();
d->draw_aux(false, this);
// drawLight(GL_LIGHT0);
}
void Viewer::initializeGL()
@ -107,11 +101,6 @@ void Viewer::initializeGL()
setBackgroundColor(::Qt::white);
d->scene->initializeGL();
// ::glFogf(GL_FOG_DENSITY, 0.05f);
// ::glHint(GL_FOG_HINT, GL_NICEST);
// ::glFogi(GL_FOG_MODE, GL_LINEAR);
// static const GLfloat fogColor[] = {0.5f, 0.5f, 0.5f, 1};
// ::glFogfv(GL_FOG_COLOR, fogColor);
}
#include <QMouseEvent>

View File

@ -30,6 +30,8 @@ int main(int argc, char** argv)
app.setOrganizationDomain("inria.fr");
app.setOrganizationName("INRIA");
app.setApplicationName("3D Triangulation Demo");
//for windows
app.setAttribute(Qt::AA_UseDesktopOpenGL);
MainWindow mw;
mw.show();

View File

@ -12,7 +12,7 @@
#include <QOpenGLVertexArrayObject>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <CGAL/Qt/CreateOpenGLContext.h>
#include <iostream>
using namespace qglviewer;
@ -24,7 +24,7 @@ class Viewer : public QGLViewer, QOpenGLFunctions_3_3_Core {
public:
Viewer(QWidget* parent)
: QGLViewer(parent)
: QGLViewer(CGAL::Qt::createOpenGLContext(),parent)
, m_showAxis(false)
, m_showVertex(true)
, m_showDEdge(true)