mirror of https://github.com/CGAL/cgal
Supposed to make windows able to run this demo
- Add setAttribute() to use desktop OGL in the main function - create a specific context in the Viewer's creator
This commit is contained in:
parent
8c391c1cdf
commit
e12b46d285
|
|
@ -13,6 +13,7 @@ int main(int argc, char** argv)
|
|||
application.setOrganizationDomain("geometryfactory.com");
|
||||
application.setOrganizationName("GeometryFactory");
|
||||
application.setApplicationName("Alpha Shape Reconstruction");
|
||||
application.setAttribute(Qt::AA_UseDesktopOpenGL);
|
||||
|
||||
// Import resources from libCGALQt (Qt4 or Qt5).
|
||||
// See http://doc.trolltech.com/4.4/qdir.html#Q_INIT_RESOURCE
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ endif()
|
|||
find_package(CGAL COMPONENTS Qt5)
|
||||
include(${CGAL_USE_FILE})
|
||||
|
||||
find_package(Qt5 COMPONENTS Xml Script OpenGL)
|
||||
find_package(Qt5 COMPONENTS Xml Script OpenGL Svg)
|
||||
|
||||
find_package(OpenGL)
|
||||
find_package(QGLViewer)
|
||||
|
|
@ -37,7 +37,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_
|
|||
#qt4_automoc( MainWindow.cpp Viewer.cpp)
|
||||
|
||||
add_executable ( Alpha_shape_3 Alpha_shape_3.cpp MainWindow.cpp Viewer.cpp ${uis} ${RESOURCE_FILES} )
|
||||
qt5_use_modules(Alpha_shape_3 Xml Script OpenGL)
|
||||
qt5_use_modules(Alpha_shape_3 Xml Script OpenGL Svg)
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Alpha_shape_3 )
|
||||
|
||||
target_link_libraries( Alpha_shape_3 ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class Viewer : public QGLViewer, protected QOpenGLFunctions_3_3_Core{
|
|||
int nr_of_facets;
|
||||
public:
|
||||
Viewer(QWidget* parent)
|
||||
: QGLViewer(parent)
|
||||
: QGLViewer(createContext(),parent)
|
||||
{
|
||||
are_buffers_initialized = false;
|
||||
}
|
||||
|
|
@ -42,6 +42,16 @@ 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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue