diff --git a/CMakeLists.txt b/CMakeLists.txt index 595a00d..aa3e068 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ foreach(F ${PIP_FOLDERS}) endforeach(F) #message(STATUS "PIP includes = ${PIP_INCLUDES}") -set(LIST_LIBS pip qad_widgets qad_utils qad_application qad_blockview qad_graphic qad_sql_table piqt mbricks kx_tools piqt_tools touch_widgets) +set(LIST_LIBS pip qad_widgets qad_utils qad_application qad_blockview qad_graphic qad_sql_table piqt mbricks kx_tools piqt_tools touch_widgets qglview) foreach(L ${LIST_LIBS}) add_subdirectory(${L}) diff --git a/qglview/CMakeLists.txt b/qglview/CMakeLists.txt index c68d568..a8bfb27 100644 --- a/qglview/CMakeLists.txt +++ b/qglview/CMakeLists.txt @@ -4,16 +4,12 @@ find_package(Qt4 REQUIRED) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") -add_definitions(-DGL_GLEXT_PROTOTYPES) set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} qad_widgets) -if (${WIN32}) - list(APPEND LIBS opengl32 glu32) -else (${WIN32}) - list(APPEND LIBS GL GLU glut GLEW) -endif (${WIN32}) +find_package(OpenGL REQUIRED) +list(APPEND LIBS ${OPENGL_LIBRARIES}) file(GLOB MOCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h") file(GLOB CPPS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") diff --git a/qglview/gltypes.h b/qglview/gltypes.h index f2ee0c9..11edf8b 100644 --- a/qglview/gltypes.h +++ b/qglview/gltypes.h @@ -41,6 +41,7 @@ # define CC_VC #endif +#define GL_GLEXT_PROTOTYPES #ifdef WINDOWS # include "GLee.h" #else diff --git a/qglview/qglview.cpp b/qglview/qglview.cpp index 8880563..4856b9b 100644 --- a/qglview/qglview.cpp +++ b/qglview/qglview.cpp @@ -35,7 +35,7 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) { ambientColor_ = QColor(10, 10, 10); lastPos = QPoint(-1, -1); lineWidth_ = 1.; - linearFiltering_ = cameraOrbit_ = true; + linearFiltering_ = cameraOrbit_ = lightEnabled_ = true; shaders_supported = selecting_ = customMouseMove_ = false; sel_button = Qt::LeftButton; sel_mod = Qt::NoModifier; @@ -265,6 +265,7 @@ void QGLView::paintGL() { renderer_->reloadShaders(); } } + emit glBeginPaint(); if (renderer_ != 0) renderer_->renderScene(); if (selectionHalo_ || hoverHalo_) { glReleaseTextures(); diff --git a/qglview/qglview.h b/qglview/qglview.h index ffbaaaa..b1abd87 100644 --- a/qglview/qglview.h +++ b/qglview/qglview.h @@ -126,6 +126,7 @@ public: FogMode fogMode() const {return fogMode_;} //LightingMode lightingMode() const {return lmode;} bool isFogEnabled() const {return fogEnabled_;} + bool isLightEnabled() const {return lightEnabled_;} bool isGrabMouseEnabled() const {return grabMouse_;} bool isMouseRotateEnabled() const {return mouseRotate_;} bool isMouseSelectionEnabled() const {return mouseSelect_;} @@ -255,7 +256,7 @@ private: double lineWidth_, linearFiltering_, accom_time, accom_max_speed, cur_luminance; double fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_; int timer, fps_cnt, sh_id_loc, shadow_map_size, dynamic_cubemap_size; - bool is_init, fogEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_; + bool is_init, fogEnabled_, lightEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_; bool hoverHalo_, selectionHalo_, mouseThis_, shaders_bind, shadows_, shadows_soft, selecting_; bool shaders_supported, dynamic_reflections, hdr_, bloom_, msaa_, fxaa_, accomodation_, changed_, cameraOrbit_; @@ -274,6 +275,7 @@ public slots: void setFogEnd(const double & arg) {fogEnd_ = arg;} void setFogMode(const FogMode & arg) {fogMode_ = arg;} void setFogEnabled(const bool & arg) {fogEnabled_ = arg;} + void setLightEnabled(const bool & arg) {lightEnabled_ = arg;} void setGrabMouseEnabled(const bool & arg) {grabMouse_ = arg; mouse_first = true;} void setMouseRotateEnabled(const bool & arg) {mouseRotate_ = arg;} void setMouseSelectionEnabled(const bool & arg) {mouseSelect_ = arg;} diff --git a/qglview/renderer_simple.cpp b/qglview/renderer_simple.cpp index 7776ca4..3f47d5a 100644 --- a/qglview/renderer_simple.cpp +++ b/qglview/renderer_simple.cpp @@ -74,16 +74,16 @@ void RendererSimple::renderScene() { fbo_c.bind(); glClearFramebuffer(); shader->bind(); /// WARNING - renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled()); + renderObjects(GLObjectBase::Solid, l, 0, true, view.isLightEnabled(), view.isFogEnabled()); shader->release(); /// WARNING if (QRect(QPoint(), fbo_c.size()).contains(mpos)) { //qDebug() << mpos; GLfloat data[4] = {0, 0, 0, 0}; glReadPixels(mpos.x(), fbo_c.height() - mpos.y(), 1, 1, GL_RGBA, GL_FLOAT, data); - qDebug() << QVector3D(data[0], data[1], data[2]); + //qDebug() << QVector3D(data[0], data[1], data[2]); } fbo_c.release(); - renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled()); + renderObjects(GLObjectBase::Solid, l, 0, true, view.isLightEnabled(), view.isFogEnabled()); //renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled());