mirror of https://github.com/CGAL/cgal
Remove direct use of the OpenGL API
We always use the Qt wrappers.
This commit is contained in:
parent
1296d83552
commit
f5b5aead66
|
|
@ -27,15 +27,12 @@ find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Gui Svg)
|
||||||
|
|
||||||
include( ${CGAL_USE_FILE} )
|
include( ${CGAL_USE_FILE} )
|
||||||
|
|
||||||
# Find OpenGL
|
|
||||||
find_package(OpenGL)
|
|
||||||
|
|
||||||
# Find QGLViewer
|
# Find QGLViewer
|
||||||
if(Qt5_FOUND)
|
if(Qt5_FOUND)
|
||||||
find_package(QGLViewer)
|
find_package(QGLViewer)
|
||||||
endif(Qt5_FOUND)
|
endif(Qt5_FOUND)
|
||||||
|
|
||||||
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
||||||
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
|
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
|
@ -71,7 +68,7 @@ if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FO
|
||||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||||
cgal_add_compilation_test(AABB_demo)
|
cgal_add_compilation_test(AABB_demo)
|
||||||
|
|
||||||
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
||||||
set(AABB_MISSING_DEPS "")
|
set(AABB_MISSING_DEPS "")
|
||||||
|
|
||||||
|
|
@ -87,14 +84,10 @@ else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER
|
||||||
set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
|
set(AABB_MISSING_DEPS "Qt5, ${AABB_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(AABB_MISSING_DEPS "OpenGL, ${AABB_MISSING_DEPS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT QGLVIEWER_FOUND)
|
if(NOT QGLVIEWER_FOUND)
|
||||||
set(AABB_MISSING_DEPS "QGLViewer, ${AABB_MISSING_DEPS}")
|
set(AABB_MISSING_DEPS "QGLViewer, ${AABB_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
|
message(STATUS "NOTICE: This demo requires ${AABB_MISSING_DEPS}and will not be compiled.")
|
||||||
|
|
||||||
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
|
||||||
|
|
@ -595,6 +595,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
initGL();
|
initGL();
|
||||||
if(!are_buffers_initialized)
|
if(!are_buffers_initialized)
|
||||||
initialize_buffers();
|
initialize_buffers();
|
||||||
|
gl->glEnable(GL_DEPTH_TEST);
|
||||||
QColor color;
|
QColor color;
|
||||||
QMatrix4x4 fMatrix;
|
QMatrix4x4 fMatrix;
|
||||||
fMatrix.setToIdentity();
|
fMatrix.setToIdentity();
|
||||||
|
|
@ -663,7 +664,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
|
|
||||||
//cutting_segments
|
//cutting_segments
|
||||||
fMatrix.setToIdentity();
|
fMatrix.setToIdentity();
|
||||||
::glLineWidth(2.0f);
|
gl->glLineWidth(2.0f);
|
||||||
vao[3].bind();
|
vao[3].bind();
|
||||||
attrib_buffers(viewer);
|
attrib_buffers(viewer);
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
@ -671,7 +672,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
|
gl->glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_cut_segments.size()/3));
|
||||||
::glLineWidth(1.0f);
|
gl->glLineWidth(1.0f);
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[3].release();
|
vao[3].release();
|
||||||
//grid
|
//grid
|
||||||
|
|
@ -690,8 +691,8 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
//cutting_plane
|
//cutting_plane
|
||||||
// for(int i=0; i< 16 ; i++)
|
// for(int i=0; i< 16 ; i++)
|
||||||
// fMatrix.data()[i] = m_frame->matrix()[i];
|
// fMatrix.data()[i] = m_frame->matrix()[i];
|
||||||
::glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
gl->glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
||||||
::glEnable(GL_BLEND);
|
gl->glEnable(GL_BLEND);
|
||||||
vao[4].bind();
|
vao[4].bind();
|
||||||
attrib_buffers(viewer);
|
attrib_buffers(viewer);
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
@ -699,7 +700,7 @@ void Scene::draw(QGLViewer* viewer)
|
||||||
rendering_program.setUniformValue(colorLocation, color);
|
rendering_program.setUniformValue(colorLocation, color);
|
||||||
rendering_program.setUniformValue(fLocation, fMatrix);
|
rendering_program.setUniformValue(fLocation, fMatrix);
|
||||||
gl->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_plane.size()/3));
|
gl->glDrawArrays(GL_TRIANGLES, 0, static_cast<GLsizei>(pos_plane.size()/3));
|
||||||
::glDisable(GL_BLEND);
|
gl->glDisable(GL_BLEND);
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
vao[4].release();
|
vao[4].release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ void Viewer::setScene(Scene* pScene)
|
||||||
|
|
||||||
void Viewer::draw()
|
void Viewer::draw()
|
||||||
{
|
{
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
QGLViewer::draw();
|
QGLViewer::draw();
|
||||||
if(m_pScene != NULL)
|
if(m_pScene != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,9 @@ include(${CGAL_USE_FILE})
|
||||||
|
|
||||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL Svg)
|
||||||
|
|
||||||
find_package(OpenGL)
|
|
||||||
find_package(QGLViewer)
|
find_package(QGLViewer)
|
||||||
|
|
||||||
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
|
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
||||||
|
|
||||||
add_definitions(-DQT_NO_KEYWORDS)
|
add_definitions(-DQT_NO_KEYWORDS)
|
||||||
|
|
||||||
|
|
@ -55,6 +54,6 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
||||||
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, OpenGL and Qt5, and will not be compiled.")
|
message(STATUS "NOTICE: This demo requires CGAL, the QGLViewer, and Qt5, and will not be compiled.")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ Viewer::draw()
|
||||||
rendering_program_points.bind();
|
rendering_program_points.bind();
|
||||||
color.setRgbF(1.0f, 0.0f, 0.0f);
|
color.setRgbF(1.0f, 0.0f, 0.0f);
|
||||||
glPointSize(5);
|
glPointSize(5);
|
||||||
::glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
rendering_program_points.setUniformValue(colorLocation_points, color);
|
rendering_program_points.setUniformValue(colorLocation_points, color);
|
||||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
||||||
rendering_program_points.release();
|
rendering_program_points.release();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue