mirror of https://github.com/CGAL/cgal
Do not use OpenGL directly, but only using Qt5 OpenGL classes
This commit is contained in:
parent
670cf2bc24
commit
6ec4c12031
|
|
@ -11,10 +11,9 @@ include(${CGAL_USE_FILE})
|
||||||
|
|
||||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
||||||
|
|
||||||
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 )
|
||||||
|
|
||||||
|
|
||||||
include_directories (${QGLVIEWER_INCLUDE_DIR})
|
include_directories (${QGLVIEWER_INCLUDE_DIR})
|
||||||
|
|
@ -36,6 +35,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()
|
||||||
|
|
|
||||||
|
|
@ -860,10 +860,10 @@ void Viewer::init()
|
||||||
compile_shaders();
|
compile_shaders();
|
||||||
compute_elements();
|
compute_elements();
|
||||||
initialize_buffers();
|
initialize_buffers();
|
||||||
::glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -304,7 +304,6 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (${component} STREQUAL "Qt5")
|
if (${component} STREQUAL "Qt5")
|
||||||
find_package(OpenGL QUIET)
|
|
||||||
find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
|
find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
@ -341,7 +340,6 @@ if( NOT CGAL_MACROS_FILE_INCLUDED )
|
||||||
|
|
||||||
if (${component} STREQUAL "Qt5")
|
if (${component} STREQUAL "Qt5")
|
||||||
set(CGAL_${component}_FOUND TRUE)
|
set(CGAL_${component}_FOUND TRUE)
|
||||||
find_package(OpenGL QUIET)
|
|
||||||
find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
|
find_package(Qt5 COMPONENTS OpenGL Gui Core Script ScriptTools QUIET)
|
||||||
endif()
|
endif()
|
||||||
####message( STATUS "External library ${vlib} after find")
|
####message( STATUS "External library ${vlib} after find")
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
# .. code-block:: cmake
|
# .. code-block:: cmake
|
||||||
#
|
#
|
||||||
# find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
|
# find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
|
||||||
# find_package(OpenGL QUIET)
|
|
||||||
#
|
#
|
||||||
# and defines the variable :variable:`CGAL_Qt5_FOUND` and the function
|
# and defines the variable :variable:`CGAL_Qt5_FOUND` and the function
|
||||||
# :command:`CGAL_setup_CGAL_Qt5_dependencies`.
|
# :command:`CGAL_setup_CGAL_Qt5_dependencies`.
|
||||||
|
|
@ -25,9 +24,7 @@ set(CGAL_SetupCGAL_Qt5Dependencies_included TRUE)
|
||||||
# Used Modules
|
# Used Modules
|
||||||
# ^^^^^^^^^^^^
|
# ^^^^^^^^^^^^
|
||||||
# - :module:`Qt5Config`
|
# - :module:`Qt5Config`
|
||||||
# - :module:`FindOpenGL`
|
|
||||||
find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
|
find_package(Qt5 QUIET COMPONENTS OpenGL Svg)
|
||||||
find_package(OpenGL QUIET)
|
|
||||||
|
|
||||||
set(CGAL_Qt5_MISSING_DEPS "")
|
set(CGAL_Qt5_MISSING_DEPS "")
|
||||||
if(NOT Qt5OpenGL_FOUND)
|
if(NOT Qt5OpenGL_FOUND)
|
||||||
|
|
@ -39,9 +36,6 @@ endif()
|
||||||
if(NOT Qt5_FOUND)
|
if(NOT Qt5_FOUND)
|
||||||
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
|
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} Qt5")
|
||||||
endif()
|
endif()
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(CGAL_Qt5_MISSING_DEPS "${CGAL_Qt5_MISSING_DEPS} OpenGL")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
#.rst:
|
#.rst:
|
||||||
|
|
@ -71,9 +65,6 @@ if(NOT CGAL_Qt5_MISSING_DEPS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#get_property(QT_UIC_EXECUTABLE TARGET Qt5::uic PROPERTY LOCATION)
|
#get_property(QT_UIC_EXECUTABLE TARGET Qt5::uic PROPERTY LOCATION)
|
||||||
#message( STATUS "OpenGL include: ${OPENGL_INCLUDE_DIR}" )
|
|
||||||
#message( STATUS "OpenGL libraries: ${OPENGL_LIBRARIES}" )
|
|
||||||
#message( STATUS "OpenGL definitions: ${OPENGL_DEFINITIONS}" )
|
|
||||||
#message( STATUS "Qt5Core include: ${Qt5Core_INCLUDE_DIRS}" )
|
#message( STATUS "Qt5Core include: ${Qt5Core_INCLUDE_DIRS}" )
|
||||||
#message( STATUS "Qt5 libraries: ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5OpenGL_LIBRARIES}" )
|
#message( STATUS "Qt5 libraries: ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5OpenGL_LIBRARIES}" )
|
||||||
#message( STATUS "Qt5Core definitions: ${Qt5Core_DEFINITIONS}" )
|
#message( STATUS "Qt5Core definitions: ${Qt5Core_DEFINITIONS}" )
|
||||||
|
|
@ -105,11 +96,10 @@ function(CGAL_setup_CGAL_Qt5_dependencies target)
|
||||||
if($ENV{CGAL_FAKE_PUBLIC_RELEASE})
|
if($ENV{CGAL_FAKE_PUBLIC_RELEASE})
|
||||||
target_compile_definitions( ${target} ${keyword} CGAL_FAKE_PUBLIC_RELEASE=1 )
|
target_compile_definitions( ${target} ${keyword} CGAL_FAKE_PUBLIC_RELEASE=1 )
|
||||||
endif()
|
endif()
|
||||||
target_include_directories( ${target} SYSTEM ${keyword} ${OPENGL_INCLUDE_DIR})
|
|
||||||
target_link_libraries( ${target} ${keyword} CGAL::CGAL)
|
target_link_libraries( ${target} ${keyword} CGAL::CGAL)
|
||||||
if(CGAL_HEADER_ONLY)
|
if(CGAL_HEADER_ONLY)
|
||||||
target_link_libraries( ${target} ${keyword} CGAL::Qt5_moc_and_resources)
|
target_link_libraries( ${target} ${keyword} CGAL::Qt5_moc_and_resources)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries( ${target} ${keyword} Qt5::OpenGL Qt5::Svg ${OPENGL_LIBRARIES})
|
target_link_libraries( ${target} ${keyword} Qt5::OpenGL Qt5::Svg)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
if ( NOT FIND_OPENGL_WRAPPER )
|
|
||||||
|
|
||||||
set ( FIND_OPENGL_WRAPPER 1 )
|
|
||||||
|
|
||||||
set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} )
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${ORIG_CMAKE_MODULE_PATH} )
|
|
||||||
|
|
||||||
find_package(OpenGL)
|
|
||||||
|
|
||||||
if ( OPENGL_FOUND AND CGAL_APPLE_LEOPARD )
|
|
||||||
|
|
||||||
if ( BUILD_SHARED_LIBS )
|
|
||||||
|
|
||||||
uniquely_add_flags( CMAKE_SHARED_LINKER_FLAGS
|
|
||||||
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
|
|
||||||
)
|
|
||||||
|
|
||||||
else()
|
|
||||||
|
|
||||||
uniquely_add_flags( CMAKE_MODULE_LINKER_FLAGS
|
|
||||||
"-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH} )
|
|
||||||
|
|
||||||
endif()
|
|
||||||
|
|
@ -40,13 +40,12 @@ 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 ( NOT (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND
|
if ( NOT (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND
|
||||||
OPENGL_FOUND AND QGLVIEWER_FOUND) )
|
QGLVIEWER_FOUND) )
|
||||||
|
|
||||||
MESSAGE(STATUS "NOTICE: This demo requires CGAL, QGLViewer, OpenGL "
|
MESSAGE(STATUS "NOTICE: This demo requires CGAL, QGLViewer, "
|
||||||
"and Qt5, and will not be compiled.")
|
"and Qt5, and will not be compiled.")
|
||||||
|
|
||||||
else()
|
else()
|
||||||
|
|
|
||||||
|
|
@ -709,14 +709,14 @@ void Viewer::draw()
|
||||||
color.setRgbF(0.2f, 0.2f, 0.7f);
|
color.setRgbF(0.2f, 0.2f, 0.7f);
|
||||||
rendering_program_p_l.bind();
|
rendering_program_p_l.bind();
|
||||||
rendering_program_p_l.setAttributeValue(colorLocation,color);
|
rendering_program_p_l.setAttributeValue(colorLocation,color);
|
||||||
::glLineWidth(size_edges);
|
glLineWidth(size_edges);
|
||||||
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
|
glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(pos_lines.size()/3));
|
||||||
rendering_program_p_l.release();
|
rendering_program_p_l.release();
|
||||||
vao[2].release();
|
vao[2].release();
|
||||||
}
|
}
|
||||||
if(vertices)
|
if(vertices)
|
||||||
{
|
{
|
||||||
::glPointSize(size_points);
|
glPointSize(size_points);
|
||||||
vao[3].bind();
|
vao[3].bind();
|
||||||
attrib_buffers(this);
|
attrib_buffers(this);
|
||||||
color.setRgbF(.2f,.2f,.6f);
|
color.setRgbF(.2f,.2f,.6f);
|
||||||
|
|
@ -750,23 +750,23 @@ void Viewer::init()
|
||||||
setKeyDescription(Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)");
|
setKeyDescription(Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)");
|
||||||
|
|
||||||
// Light default parameters
|
// Light default parameters
|
||||||
::glLineWidth(size_edges);
|
glLineWidth(size_edges);
|
||||||
::glPointSize(size_points);
|
glPointSize(size_points);
|
||||||
::glEnable(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
::glPolygonOffset(1.0f,1.0f);
|
glPolygonOffset(1.0f,1.0f);
|
||||||
::glClearColor(1.0f,1.0f,1.0f,0.0f);
|
glClearColor(1.0f,1.0f,1.0f,0.0f);
|
||||||
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||||
|
|
||||||
::glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
|
|
||||||
::glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
|
||||||
|
|
||||||
::glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
::glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
::glDisable(GL_LINE_SMOOTH);
|
glDisable(GL_LINE_SMOOTH);
|
||||||
::glDisable(GL_POLYGON_SMOOTH_HINT);
|
glDisable(GL_POLYGON_SMOOTH_HINT);
|
||||||
::glBlendFunc(GL_ONE, GL_ZERO);
|
glBlendFunc(GL_ONE, GL_ZERO);
|
||||||
::glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST);
|
||||||
compile_shaders();
|
compile_shaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,6 @@ if(Qt5_FOUND)
|
||||||
add_definitions(-DQT_NO_KEYWORDS)
|
add_definitions(-DQT_NO_KEYWORDS)
|
||||||
endif(Qt5_FOUND)
|
endif(Qt5_FOUND)
|
||||||
|
|
||||||
# Find OpenGL
|
|
||||||
find_package(OpenGL)
|
|
||||||
|
|
||||||
# Find CImg
|
# Find CImg
|
||||||
find_path(CIMG_INCLUDE_DIR
|
find_path(CIMG_INCLUDE_DIR
|
||||||
NAMES CImg.h
|
NAMES CImg.h
|
||||||
|
|
@ -37,7 +34,7 @@ else()
|
||||||
"Try setting the environment variable CIMG_INC_DIR to point to the path of the directory containing CImg.h.")
|
"Try setting the environment variable CIMG_INC_DIR to point to the path of the directory containing CImg.h.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
|
if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||||
|
|
||||||
set(
|
set(
|
||||||
SRCS
|
SRCS
|
||||||
|
|
@ -96,7 +93,7 @@ if(CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
|
||||||
|
|
||||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||||
cgal_add_compilation_test(Otr2_demo)
|
cgal_add_compilation_test(Otr2_demo)
|
||||||
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND )
|
else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
|
||||||
|
|
||||||
set(OTR2_MISSING_DEPS "")
|
set(OTR2_MISSING_DEPS "")
|
||||||
|
|
||||||
|
|
@ -112,10 +109,6 @@ else (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND )
|
||||||
set(OTR2_MISSING_DEPS "Qt5.4, ${OTR2_MISSING_DEPS}")
|
set(OTR2_MISSING_DEPS "Qt5.4, ${OTR2_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(OTR2_MISSING_DEPS "OpenGL, ${OTR2_MISSING_DEPS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "NOTICE: This demo requires ${OTR2_MISSING_DEPS}and will not be compiled.")
|
message(STATUS "NOTICE: This demo requires ${OTR2_MISSING_DEPS}and will not be compiled.")
|
||||||
|
|
||||||
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND)
|
endif (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND)
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,13 @@ include( ${CGAL_USE_FILE} )
|
||||||
# Find Qt5 itself
|
# Find Qt5 itself
|
||||||
find_package(Qt5 QUIET COMPONENTS Xml OpenGL Help Core)
|
find_package(Qt5 QUIET COMPONENTS Xml OpenGL Help Core)
|
||||||
|
|
||||||
# Find OpenGL
|
|
||||||
find_package(OpenGL)
|
|
||||||
|
|
||||||
# Find QGLViewer
|
# Find QGLViewer
|
||||||
if(Qt5_FOUND)
|
if(Qt5_FOUND)
|
||||||
add_definitions(-DQT_NO_KEYWORDS)
|
add_definitions(-DQT_NO_KEYWORDS)
|
||||||
find_package(QGLViewer)
|
find_package(QGLViewer)
|
||||||
endif(Qt5_FOUND)
|
endif(Qt5_FOUND)
|
||||||
|
|
||||||
if (CGAL_FOUND AND CGAL_Qt5_FOUND AND OPENGL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator)
|
if (CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator)
|
||||||
|
|
||||||
include_directories( ${QGLVIEWER_INCLUDE_DIR} )
|
include_directories( ${QGLVIEWER_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
|
@ -86,10 +83,6 @@ else ()
|
||||||
set(PERIODIC_TRIANGULATION_MISSING_DEPS "Qt5, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
|
set(PERIODIC_TRIANGULATION_MISSING_DEPS "Qt5, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(PERIODIC_TRIANGULATION_MISSING_DEPS "OpenGL, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT QGLVIEWER_FOUND)
|
if(NOT QGLVIEWER_FOUND)
|
||||||
set(PERIODIC_TRIANGULATION_MISSING_DEPS "QGLViewer, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
|
set(PERIODIC_TRIANGULATION_MISSING_DEPS "QGLViewer, ${PERIODIC_TRIANGULATION_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -830,7 +830,7 @@ void Scene::draw() {
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
||||||
glPointSize(5);
|
glPointSize(5);
|
||||||
::glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
|
|
||||||
rendering_program.setUniformValue(colorLocation[0], color);
|
rendering_program.setUniformValue(colorLocation[0], color);
|
||||||
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(pos_points.size()/3));
|
||||||
|
|
@ -844,7 +844,7 @@ void Scene::draw() {
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
||||||
glPointSize(5);
|
glPointSize(5);
|
||||||
::glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
rendering_program.setUniformValue(colorLocation[0], color);
|
rendering_program.setUniformValue(colorLocation[0], color);
|
||||||
glDrawArrays(GL_POINTS, 0, 1);
|
glDrawArrays(GL_POINTS, 0, 1);
|
||||||
rendering_program.release();
|
rendering_program.release();
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,11 @@ include(${CGAL_USE_FILE})
|
||||||
|
|
||||||
find_package(Qt5 QUIET COMPONENTS Xml Script Help OpenGL Svg)
|
find_package(Qt5 QUIET COMPONENTS Xml Script Help OpenGL Svg)
|
||||||
|
|
||||||
find_package(OpenGL)
|
|
||||||
|
|
||||||
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 AND TARGET Qt5::qcollectiongenerator )
|
if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND TARGET Qt5::qcollectiongenerator )
|
||||||
|
|
||||||
|
|
||||||
include_directories (${QGLVIEWER_INCLUDE_DIR})
|
include_directories (${QGLVIEWER_INCLUDE_DIR})
|
||||||
|
|
@ -66,7 +64,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_
|
||||||
|
|
||||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||||
cgal_add_compilation_test(Periodic_Lloyd_3)
|
cgal_add_compilation_test(Periodic_Lloyd_3)
|
||||||
else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE )
|
else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND AND QT_QCOLLECTIONGENERATOR_EXECUTABLE )
|
||||||
|
|
||||||
set(PERIODIC_LLOYD_MISSING_DEPS "")
|
set(PERIODIC_LLOYD_MISSING_DEPS "")
|
||||||
|
|
||||||
|
|
@ -78,10 +76,6 @@ else( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER
|
||||||
set(PERIODIC_LLOYD_MISSING_DEPS "Qt5, ${PERIODIC_LLOYD_MISSING_DEPS}")
|
set(PERIODIC_LLOYD_MISSING_DEPS "Qt5, ${PERIODIC_LLOYD_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(PERIODIC_LLOYD_MISSING_DEPS "OpenGL, ${PERIODIC_LLOYD_MISSING_DEPS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT QGLVIEWER_FOUND)
|
if(NOT QGLVIEWER_FOUND)
|
||||||
set(PERIODIC_LLOYD_MISSING_DEPS "QGLViewer, ${PERIODIC_LLOYD_MISSING_DEPS}")
|
set(PERIODIC_LLOYD_MISSING_DEPS "QGLViewer, ${PERIODIC_LLOYD_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -32,18 +32,18 @@ Viewer::draw()
|
||||||
initialize_buffers();
|
initialize_buffers();
|
||||||
QColor color;
|
QColor color;
|
||||||
//the points
|
//the points
|
||||||
::glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
::glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
::glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
|
||||||
::glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
::glPointSize(5);
|
glPointSize(5);
|
||||||
|
|
||||||
::glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
|
||||||
::glColor3f(0.2f, 0.2f, 1.f);
|
glColor3f(0.2f, 0.2f, 1.f);
|
||||||
::glEnable(GL_POLYGON_OFFSET_FILL);
|
glEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
::glPolygonOffset(3.0f,-3.0f);
|
glPolygonOffset(3.0f,-3.0f);
|
||||||
|
|
||||||
|
|
||||||
attrib_buffers(this);
|
attrib_buffers(this);
|
||||||
|
|
@ -56,10 +56,10 @@ Viewer::draw()
|
||||||
vao[0].release();
|
vao[0].release();
|
||||||
|
|
||||||
//The Lines
|
//The Lines
|
||||||
::glLineWidth(1.);
|
glLineWidth(1.);
|
||||||
::glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
|
glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
|
||||||
::glColor3ub(0,0,0);
|
glColor3ub(0,0,0);
|
||||||
::glDisable(GL_POLYGON_OFFSET_FILL);
|
glDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
vao[1].bind();
|
vao[1].bind();
|
||||||
color.setRgbF(0.27f, 0.51f, 0.7f);
|
color.setRgbF(0.27f, 0.51f, 0.7f);
|
||||||
|
|
@ -173,7 +173,7 @@ void Viewer::initialize_buffers()
|
||||||
|
|
||||||
void Viewer::compute_elements()
|
void Viewer::compute_elements()
|
||||||
{
|
{
|
||||||
//::glColor3f(1.0f, 0.72f, 0.06f);
|
//glColor3f(1.0f, 0.72f, 0.06f);
|
||||||
pos_points.resize(0);
|
pos_points.resize(0);
|
||||||
pos_lines.resize(0);
|
pos_lines.resize(0);
|
||||||
pos_8lines.resize(0);
|
pos_8lines.resize(0);
|
||||||
|
|
@ -188,7 +188,7 @@ void Viewer::compute_elements()
|
||||||
pos_points.push_back(p.x()); pos_points.push_back(p.y()); pos_points.push_back(p.z());
|
pos_points.push_back(p.x()); pos_points.push_back(p.y()); pos_points.push_back(p.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
//::glColor3f(0.27f, 0.51f, 0.7f);
|
//glColor3f(0.27f, 0.51f, 0.7f);
|
||||||
for (Periodic_triangle_iterator ptit
|
for (Periodic_triangle_iterator ptit
|
||||||
= scene->periodic_triangulation.periodic_triangles_begin(
|
= scene->periodic_triangulation.periodic_triangles_begin(
|
||||||
P3DT3::UNIQUE);
|
P3DT3::UNIQUE);
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,12 @@ include( ${CGAL_USE_FILE} )
|
||||||
# Find Qt5 itself
|
# Find Qt5 itself
|
||||||
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
find_package(Qt5 QUIET COMPONENTS Xml Script OpenGL)
|
||||||
|
|
||||||
# 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_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
if(CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
||||||
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
|
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
|
@ -60,7 +57,7 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
||||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||||
cgal_add_compilation_test(PCA_demo)
|
cgal_add_compilation_test(PCA_demo)
|
||||||
|
|
||||||
else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
else (CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
||||||
set(PCA_MISSING_DEPS "")
|
set(PCA_MISSING_DEPS "")
|
||||||
|
|
||||||
|
|
@ -72,14 +69,10 @@ else (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
||||||
set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}")
|
set(PCA_MISSING_DEPS "Qt5, ${PCA_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(PCA_MISSING_DEPS "OpenGL, ${PCA_MISSING_DEPS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT QGLVIEWER_FOUND)
|
if(NOT QGLVIEWER_FOUND)
|
||||||
set(PCA_MISSING_DEPS "QGLViewer, ${PCA_MISSING_DEPS}")
|
set(PCA_MISSING_DEPS "QGLViewer, ${PCA_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.")
|
message(STATUS "NOTICE: This demo requires ${PCA_MISSING_DEPS} and will not be compiled.")
|
||||||
|
|
||||||
endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
endif (CGAL_Qt5_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND)
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ include(${CGAL_USE_FILE})
|
||||||
|
|
||||||
find_package(Qt5 QUIET COMPONENTS OpenGL)
|
find_package(Qt5 QUIET COMPONENTS OpenGL)
|
||||||
|
|
||||||
find_package(OpenGL)
|
|
||||||
|
|
||||||
if(Qt5_FOUND)
|
if(Qt5_FOUND)
|
||||||
add_definitions(-DQT_NO_KEYWORDS)
|
add_definitions(-DQT_NO_KEYWORDS)
|
||||||
find_package(QGLViewer)
|
find_package(QGLViewer)
|
||||||
|
|
@ -49,7 +47,7 @@ else( ACTIVATE_CONCURRENT_TRIANGULATION_3 )
|
||||||
endif( LINK_WITH_TBB )
|
endif( LINK_WITH_TBB )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
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})
|
||||||
include_directories (BEFORE ../../include ./ )
|
include_directories (BEFORE ../../include ./ )
|
||||||
|
|
@ -71,7 +69,6 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_
|
||||||
|
|
||||||
target_link_libraries( T3_demo PRIVATE ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
|
target_link_libraries( T3_demo PRIVATE ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})
|
||||||
target_link_libraries( T3_demo PRIVATE Qt5::OpenGL ${QGLVIEWER_LIBRARIES})
|
target_link_libraries( T3_demo PRIVATE Qt5::OpenGL ${QGLVIEWER_LIBRARIES})
|
||||||
target_link_libraries( T3_demo PRIVATE ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
|
|
||||||
if(TBB_FOUND)
|
if(TBB_FOUND)
|
||||||
CGAL_target_use_TBB(T3_demo)
|
CGAL_target_use_TBB(T3_demo)
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -82,7 +79,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_
|
||||||
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake)
|
||||||
cgal_add_compilation_test(T3_demo)
|
cgal_add_compilation_test(T3_demo)
|
||||||
|
|
||||||
else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
|
else( CGAL_FOUND AND Qt5_FOUND AND QGLVIEWER_FOUND )
|
||||||
|
|
||||||
set(TRIANGULATION_3_MISSING_DEPS "")
|
set(TRIANGULATION_3_MISSING_DEPS "")
|
||||||
|
|
||||||
|
|
@ -94,10 +91,6 @@ else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
|
||||||
set(TRIANGULATION_3_MISSING_DEPS "Qt5, ${TRIANGULATION_3_MISSING_DEPS}")
|
set(TRIANGULATION_3_MISSING_DEPS "Qt5, ${TRIANGULATION_3_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT OPENGL_FOUND)
|
|
||||||
set(TRIANGULATION_3_MISSING_DEPS "OpenGL, ${TRIANGULATION_3_MISSING_DEPS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT QGLVIEWER_FOUND)
|
if(NOT QGLVIEWER_FOUND)
|
||||||
set(TRIANGULATION_3_MISSING_DEPS "QGLViewer, ${TRIANGULATION_3_MISSING_DEPS}")
|
set(TRIANGULATION_3_MISSING_DEPS "QGLViewer, ${TRIANGULATION_3_MISSING_DEPS}")
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -105,4 +98,4 @@ else( CGAL_FOUND AND Qt5_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND )
|
||||||
|
|
||||||
message(STATUS "NOTICE: This demo requires ${TRIANGULATION_3_MISSING_DEPS}and will not be compiled.")
|
message(STATUS "NOTICE: This demo requires ${TRIANGULATION_3_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 )
|
||||||
|
|
|
||||||
|
|
@ -58,23 +58,23 @@ void Viewer::init()
|
||||||
GLfloat specular_color[4] = { 0.8f, 0.8f, 0.8f, 1.0 };
|
GLfloat specular_color[4] = { 0.8f, 0.8f, 0.8f, 1.0 };
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular_color);
|
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular_color);
|
||||||
// Set Smooth Shading
|
// Set Smooth Shading
|
||||||
::glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
|
|
||||||
// depth buffer setup
|
// depth buffer setup
|
||||||
::glClearDepth(1.0f);
|
glClearDepth(1.0f);
|
||||||
::glEnable(GL_DEPTH_TEST);
|
glEnable(GL_DEPTH_TEST);
|
||||||
::glDepthFunc(GL_LEQUAL);
|
glDepthFunc(GL_LEQUAL);
|
||||||
::glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
|
||||||
|
|
||||||
// enable semi-transparent culling planes
|
// enable semi-transparent culling planes
|
||||||
::glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
|
||||||
// anti-aliasing, i.e. reduce jaggedness (if the OpenGL driver permits that)
|
// anti-aliasing, i.e. reduce jaggedness (if the OpenGL driver permits that)
|
||||||
::glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
::glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
|
||||||
::glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
::glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||||
|
|
||||||
/* Add mouse and key description */
|
/* Add mouse and key description */
|
||||||
setKeyDescription( Qt::CTRL + Qt::Key_G, tr("Generate points") );
|
setKeyDescription( Qt::CTRL + Qt::Key_G, tr("Generate points") );
|
||||||
|
|
@ -1234,7 +1234,7 @@ void Viewer::draw()
|
||||||
// Insert point mode
|
// Insert point mode
|
||||||
if( m_curMode == INSERT_PT) {
|
if( m_curMode == INSERT_PT) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Insert a point"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Insert a point"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Hold Left: Move the point"), fontPrompt );
|
drawText( width()-200, 40, tr("Hold Left: Move the point"), fontPrompt );
|
||||||
drawText( width()-200, 60, tr("Return: Insert to DT"), fontPrompt );
|
drawText( width()-200, 60, tr("Return: Insert to DT"), fontPrompt );
|
||||||
|
|
@ -1258,7 +1258,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if( m_curMode == SELECT) {
|
else if( m_curMode == SELECT) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Select"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Select"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Ctrl+Left: Add selection"),
|
drawText( width()-200, 40, tr("Ctrl+Left: Add selection"),
|
||||||
QFont("Arial", 14) );
|
QFont("Arial", 14) );
|
||||||
|
|
@ -1274,7 +1274,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if( m_curMode == MOVE ) {
|
else if( m_curMode == MOVE ) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Left Click: Select"), fontPrompt );
|
drawText( width()-200, 20, tr("Left Click: Select"), fontPrompt );
|
||||||
if(m_isMoving)
|
if(m_isMoving)
|
||||||
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
|
|
@ -1288,7 +1288,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if( m_curMode == FINDNB ) {
|
else if( m_curMode == FINDNB ) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
@ -1307,7 +1307,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if(m_curMode == EMPTYSPH){
|
else if(m_curMode == EMPTYSPH){
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Press S: Show/Hide trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Press S: Show/Hide trackball"), fontPrompt );
|
||||||
drawText( width()-200, 60, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 60, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
|
|
@ -1337,7 +1337,7 @@ void Viewer::draw()
|
||||||
switch( m_curStep ) {
|
switch( m_curStep ) {
|
||||||
case NEWPT:
|
case NEWPT:
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( 10, 20, tr("Highlight the next-to-insert point"), fontPrompt );
|
drawText( 10, 20, tr("Highlight the next-to-insert point"), fontPrompt );
|
||||||
// Highlight the next-to-insert point
|
// Highlight the next-to-insert point
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
@ -1351,7 +1351,7 @@ void Viewer::draw()
|
||||||
break;
|
break;
|
||||||
case CELL: // show the tetrahedron that contains the point
|
case CELL: // show the tetrahedron that contains the point
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( 10, 20, tr("Show the tetrahedron containing the point"), fontPrompt );
|
drawText( 10, 20, tr("Show the tetrahedron containing the point"), fontPrompt );
|
||||||
drawText( 10, 40, tr("(Only finite facets are drawn)"), fontPrompt );
|
drawText( 10, 40, tr("(Only finite facets are drawn)"), fontPrompt );
|
||||||
// Highlight the next-to-insert vertex
|
// Highlight the next-to-insert vertex
|
||||||
|
|
@ -1373,7 +1373,7 @@ void Viewer::draw()
|
||||||
break;
|
break;
|
||||||
case CONFLICT: // show the conflict region
|
case CONFLICT: // show the conflict region
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( 10, 20, tr("Show the conflict region"), fontPrompt );
|
drawText( 10, 20, tr("Show the conflict region"), fontPrompt );
|
||||||
// Highlight the next-to-insert vertex
|
// Highlight the next-to-insert vertex
|
||||||
rendering_program.bind();
|
rendering_program.bind();
|
||||||
|
|
@ -1432,7 +1432,7 @@ void Viewer::draw()
|
||||||
|
|
||||||
if( m_curMode == INSERT_PT) {
|
if( m_curMode == INSERT_PT) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Insert a point"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Insert a point"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Hold Left: Move the point"), fontPrompt );
|
drawText( width()-200, 40, tr("Hold Left: Move the point"), fontPrompt );
|
||||||
drawText( width()-200, 60, tr("Return: Insert to DT"), fontPrompt );
|
drawText( width()-200, 60, tr("Return: Insert to DT"), fontPrompt );
|
||||||
|
|
@ -1457,7 +1457,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if( m_curMode == SELECT) {
|
else if( m_curMode == SELECT) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Select"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Select"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Ctrl+Left: Add selection"),
|
drawText( width()-200, 40, tr("Ctrl+Left: Add selection"),
|
||||||
QFont("Arial", 14) );
|
QFont("Arial", 14) );
|
||||||
|
|
@ -1473,7 +1473,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if( m_curMode == MOVE ) {
|
else if( m_curMode == MOVE ) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Left Click: Select"), fontPrompt );
|
drawText( width()-200, 20, tr("Left Click: Select"), fontPrompt );
|
||||||
if(m_isMoving)
|
if(m_isMoving)
|
||||||
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
|
|
@ -1487,7 +1487,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if( m_curMode == FINDNB ) {
|
else if( m_curMode == FINDNB ) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
rendering_program_spheres.bind();
|
rendering_program_spheres.bind();
|
||||||
|
|
@ -1507,7 +1507,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
else if(m_curMode == EMPTYSPH){
|
else if(m_curMode == EMPTYSPH){
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Place query point"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Press S: Show/Hide trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Press S: Show/Hide trackball"), fontPrompt );
|
||||||
drawText( width()-200, 60, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 60, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
|
|
@ -1539,7 +1539,7 @@ void Viewer::draw()
|
||||||
switch( m_curStep ) {
|
switch( m_curStep ) {
|
||||||
case NEWPT:
|
case NEWPT:
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( 10, 20, tr("Highlight the next-to-insert point"), fontPrompt );
|
drawText( 10, 20, tr("Highlight the next-to-insert point"), fontPrompt );
|
||||||
// Highlight the next-to-insert point
|
// Highlight the next-to-insert point
|
||||||
rendering_program_spheres.bind();
|
rendering_program_spheres.bind();
|
||||||
|
|
@ -1552,7 +1552,7 @@ void Viewer::draw()
|
||||||
break;
|
break;
|
||||||
case CELL: // show the tetrahedron that contains the point
|
case CELL: // show the tetrahedron that contains the point
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( 10, 20, tr("Show the tetrahedron containing the point"), fontPrompt );
|
drawText( 10, 20, tr("Show the tetrahedron containing the point"), fontPrompt );
|
||||||
drawText( 10, 40, tr("(Only finite facets are drawn)"), fontPrompt );
|
drawText( 10, 40, tr("(Only finite facets are drawn)"), fontPrompt );
|
||||||
// Highlight the next-to-insert vertex
|
// Highlight the next-to-insert vertex
|
||||||
|
|
@ -1573,7 +1573,7 @@ void Viewer::draw()
|
||||||
break;
|
break;
|
||||||
case CONFLICT: // show the conflict region
|
case CONFLICT: // show the conflict region
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( 10, 20, tr("Show the conflict region"), fontPrompt );
|
drawText( 10, 20, tr("Show the conflict region"), fontPrompt );
|
||||||
// Highlight the next-to-insert vertex
|
// Highlight the next-to-insert vertex
|
||||||
rendering_program_spheres.bind();
|
rendering_program_spheres.bind();
|
||||||
|
|
@ -1610,7 +1610,7 @@ void Viewer::draw()
|
||||||
}
|
}
|
||||||
if( m_curMode == INSERT_V ) {
|
if( m_curMode == INSERT_V ) {
|
||||||
// Show prompt messages
|
// Show prompt messages
|
||||||
::glColor3d(0,0,0);
|
glColor3d(0,0,0);
|
||||||
drawText( width()-200, 20, tr("Shift+Left: Insert a vertex"), fontPrompt );
|
drawText( width()-200, 20, tr("Shift+Left: Insert a vertex"), fontPrompt );
|
||||||
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
drawText( width()-200, 40, tr("Shift+Wheel: Resize trackball"), fontPrompt );
|
||||||
|
|
||||||
|
|
@ -1680,35 +1680,35 @@ void Viewer::drawWithNames()
|
||||||
for(int i=0; i<m_pScene->m_vhArray.size(); ++i) {
|
for(int i=0; i<m_pScene->m_vhArray.size(); ++i) {
|
||||||
// push a name for each point onto the name stack
|
// push a name for each point onto the name stack
|
||||||
// note: it can NOT be used between glBegin and glEnd
|
// note: it can NOT be used between glBegin and glEnd
|
||||||
::glPushName( i );
|
glPushName( i );
|
||||||
|
|
||||||
// draw the point
|
// draw the point
|
||||||
::glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
Point_3& p = m_pScene->m_vhArray.at(i)->point();
|
Point_3& p = m_pScene->m_vhArray.at(i)->point();
|
||||||
::glVertex3f(p.x(), p.y(), p.z());
|
glVertex3f(p.x(), p.y(), p.z());
|
||||||
::glEnd();
|
glEnd();
|
||||||
|
|
||||||
// pop one name off the top of the name stack
|
// pop one name off the top of the name stack
|
||||||
::glPopName();
|
glPopName();
|
||||||
}//end-for-points
|
}//end-for-points
|
||||||
|
|
||||||
// push a name for the newly inserted point
|
// push a name for the newly inserted point
|
||||||
if( m_curMode == INSERT_PT && m_hasNewPt ) {
|
if( m_curMode == INSERT_PT && m_hasNewPt ) {
|
||||||
::glPushName( ::GLuint(-1) );
|
glPushName( GLuint(-1) );
|
||||||
::glBegin(GL_POINTS);
|
glBegin(GL_POINTS);
|
||||||
::glVertex3f(m_newPt.x(), m_newPt.y(), m_newPt.z());
|
glVertex3f(m_newPt.x(), m_newPt.y(), m_newPt.z());
|
||||||
::glEnd();
|
glEnd();
|
||||||
::glPopName();
|
glPopName();
|
||||||
}//end-if-newPt
|
}//end-if-newPt
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer::endSelection(const QPoint& /*point*/)
|
void Viewer::endSelection(const QPoint& /*point*/)
|
||||||
{
|
{
|
||||||
// flush GL buffers
|
// flush GL buffers
|
||||||
::glFlush();
|
glFlush();
|
||||||
|
|
||||||
// reset GL_RENDER mode (was GL_SELECT) and get the number of selected points
|
// reset GL_RENDER mode (was GL_SELECT) and get the number of selected points
|
||||||
size_t nSel = ::glRenderMode(GL_RENDER);
|
size_t nSel = glRenderMode(GL_RENDER);
|
||||||
|
|
||||||
/* No selection */
|
/* No selection */
|
||||||
if( nSel <= 0 ) {
|
if( nSel <= 0 ) {
|
||||||
|
|
@ -1722,7 +1722,7 @@ void Viewer::endSelection(const QPoint& /*point*/)
|
||||||
|
|
||||||
/* Check whether the new point is clicked on */
|
/* Check whether the new point is clicked on */
|
||||||
else if( m_curMode == INSERT_PT ) {
|
else if( m_curMode == INSERT_PT ) {
|
||||||
if( m_hasNewPt && (selectBuffer())[3] == ::GLuint(-1) )
|
if( m_hasNewPt && (selectBuffer())[3] == GLuint(-1) )
|
||||||
m_isMoving = true;
|
m_isMoving = true;
|
||||||
}//end-if-inspt
|
}//end-if-inspt
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue