Quantcast
Channel: Qt DevNet forums: Installation and Deployment
Viewing all articles
Browse latest Browse all 2113

OpenGL + QT using CMake

$
0
0
I have a QT project created with a .pro file that I need to migrate it to a CMakeLists. This project uses a simple OpenGL animation to show a 3D model of a hand. I already change it to use CMake, but I encounter 2 problems. (The program compiles but it doesn’t run properly) 1. The memory consumption of the program passes from being 20-50 mb using the .pro file, to 1.3 gb using CMake (Maybe some library being loaded completely or something??) 2. The program runs incredibly slow (like 1 frame every 5-10 seconds) in contrast with the speed from using the .pro file (approx. 3 frames per second) The question is, what I am doing wrong and how can I fix it? Here is the .pro file     QT += core gui opengl         TARGET   = RGBD_3D_Viewer     TEMPLATE = app             SOURCES +=  main.cpp\                 mainwindow.cpp \                 glwidget.cpp \                 glwidget_Camera.cpp \                 glwidget_Comm.cpp \                 glwidget_Extractors.cpp \                 glwidget_Rendering.cpp \                 glwidget_Video.cpp \                 glwidget_UI_Mouse.cpp \                 glwidget_OpenGL.cpp \                 mainwindow_Comm.cpp \                 mainwindow_GUI.cpp \                 model.cpp \                 cameraSet.cpp \                 model_Mesh.cpp \                 model_Skeleton.cpp \                 model_Skin.cpp \                 model_Extra_SkinningStuff.cpp \                 animation.cpp \                 animation_Transform.cpp \                 videoSequence.cpp \                 sequence.cpp \                 mainwindow_UI_Keyboard_Mouse.cpp \                 tracker.cpp \                 mainwindow_FrameNumber.cpp \                 model_Limits.cpp \                 animation_Files_CompleteSequence.cpp \                 mainwindow_MODELS_INFO.cpp \                 modelSET.cpp \                 animation_0_RotAxes_Limits.cpp \                 myMATH.cpp \                 types_Background.cpp \                 model_Extra_VOI.cpp \                 fingertipSet.cpp \                 tracker_OnIndexChange.cpp \                 tracker_wFeatureSet.cpp         HEADERS  += mainwindow.h \                 glwidget.h \                 model.h \                 cameraSet.h \                 animation.h \                 videoSequence.h \                 sequence.h \                 tracker.h \                 mymath.h \                 modelSET.h \                 ui_mainwindow.h \                 featureSet.h \                 typesBackground.h \                 fingertipSet.h         FORMS    += mainwindow.ui                 INCLUDEPATH += /usr/include/eigen3/         INCLUDEPATH += /home/cvg11/projects/development/RGBD_3D_Viewer/glm             LIBS += -L/usr/local/lib/     LIBS += -lopencv_core     LIBS += -lopencv_highgui             QMAKE_CXXFLAGS += -O3     QMAKE_CXXFLAGS += -frounding-math     #QMAKE_CXXFLAGS += -std=c++0x Here is the CMakeLists.txt file     project(3d_viewer)     cmake_minimum_required(VERSION 2.6 FATAL_ERROR)         include_directories(${CMAKE_CURRENT_BINARY_DIR})     include_directories( ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/glm)         find_package( PkgConfig )     pkg_check_modules( EIGEN3 REQUIRED eigen3 )     include_directories( ${EIGEN3_INCLUDE_DIRS} )         # Opencv required     find_package(OpenCV COMPONENTS core highgui REQUIRED)     include_directories(${OPENCV_INCLUDE_DIRS})     link_directories(${OPENCV_LIBRARY_DIRS})     add_definitions(${OPENCV_DEFINITIONS})         message("\n\nFound OpenCV\n\n")             # QT4 required     find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED)     set(QT_USE_QTOPENGL TRUE)     include(${QT_USE_FILE})     add_definitions(${QT_DEFINITIONS})         message("\n\nFound QT4\n\n")             INCLUDE_DIRECTORIES(${QT_QTOPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} )         #set the default path for built executables to the "bin" directory     set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)     #set the default path for built libraries to the "lib" directory     set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)             file(GLOB VIEWER_SOURCES src/*.cpp)         file(GLOB VIEWER_INCLUDES include/*.h)             # set QT headers     SET(QT_HEADERS         include/mainwindow.h         include/glwidget.h         )         #set QT forms     SET(QT_FORMS         ui/mainwindow.ui     )         # create moc for QT     QT4_WRAP_CPP(QT_MOC ${QT_HEADERS})         # process ui     QT4_WRAP_UI(QT_FORMS_HEADERS ${QT_FORMS})         ADD_EXECUTABLE(3d_viewer ${VIEWER_SOURCES} ${VIEWER_INCLUDES}         ${QT_HEADERS}         ${QT_MOC}         ${QT_FORMS})         TARGET_LINK_LIBRARIES(3d_viewer ${QT_LIBRARIES} ${OpenCV_LIBS} )     set_property(TARGET 3d_viewer PROPERTY COMPILE_DEFINITIONS QT_SHARED) If needed I can give the output when I compile with make VERBOSE=1

Viewing all articles
Browse latest Browse all 2113