diff --git a/utils/fgpanel/ApplicationProperties.cxx b/utils/fgpanel/ApplicationProperties.cxx index 2224e0730..7f02348b6 100644 --- a/utils/fgpanel/ApplicationProperties.cxx +++ b/utils/fgpanel/ApplicationProperties.cxx @@ -16,7 +16,6 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // - #ifdef _WIN32 # include // for getcwd() #else // !_WIN32 diff --git a/utils/fgpanel/CMakeLists.txt b/utils/fgpanel/CMakeLists.txt index 96a192ba9..b1dde3a63 100644 --- a/utils/fgpanel/CMakeLists.txt +++ b/utils/fgpanel/CMakeLists.txt @@ -1,16 +1,6 @@ -find_package(PNG) -find_package(OpenGL) -find_package(GLEW) -find_package(Freetype) - -if ((NOT PNG_FOUND) OR (NOT OPENGL_FOUND) OR (NOT GLEW_FOUND) OR (NOT FREETYPE_FOUND)) - message(WARNING "FGPanel enabled, but some dependencies are missing") - message(STATUS "libPNG: ${PNG_FOUND}") - message(STATUS "OpenGL: ${OPENGL_FOUND}") - message(STATUS "GLEW: ${GLEW_FOUND}") - message(STATUS "Freetype: ${FREETYPE_FOUND}") - return() -endif() +find_package(PNG REQUIRED) +find_package(OpenGL REQUIRED) +find_package(Freetype REQUIRED) find_path(BCMHOST_INCLUDE_DIR NAMES bcm_host.h @@ -23,8 +13,7 @@ include_directories( ${PNG_INCLUDE_DIR} ) -if(${BCMHOST_INCLUDE_DIR} STREQUAL "BCMHOST_INCLUDE_DIR-NOTFOUND") -else() +if(BCMHOST_INCLUDE_DIR) # CMAKE > 3.1 : target_sources(fgpanel set(TARGET_SOURCES GLES_utils.cxx @@ -78,41 +67,54 @@ add_executable(fgpanel ) target_link_libraries(fgpanel - SimGearCore ${PNG_LIBRARIES} + SimGearCore ${FREETYPE_LIBRARIES} ) -if(${BCMHOST_INCLUDE_DIR} STREQUAL "BCMHOST_INCLUDE_DIR-NOTFOUND") - find_package(GLUT REQUIRED) - if(GLUT_FOUND) - message(STATUS "found GLUT inc ${GLUT_INCLUDE_DIR}, lib ${GLUT_LIBRARIES} ") - if (MSVC) - add_definitions( -DFREEGLUT_LIB_PRAGMAS=0 ) - endif () - - target_link_libraries(fgpanel - ${OPENGL_LIBRARIES} - ${GLUT_LIBRARIES} - GLEW::GLEW - ) - else(GLUT_FOUND) - message(STATUS "glut NOT found, can't build fgpanel") - endif(GLUT_FOUND) -else() +if(BCMHOST_INCLUDE_DIR) message(STATUS "found Raspberry Pi") - target_link_libraries(fgpanel - -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib - ) - include_directories( ${BCMHOST_INCLUDE_DIR} ${BCMHOST_INCLUDE_DIR}/interface/vcos/pthreads ${BCMHOST_INCLUDE_DIR}/interface/vmcs_host/linux ) + target_link_libraries(fgpanel + -lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib + ) + add_definitions(-D_GLES2 -D_RPI) +else() + find_package(GLUT) + if(GLUT_FOUND) + + find_package(GLEW) + if(GLEW_FOUND) + + include_directories( + ${GLEW_INCLUDE_DIRS} + ) + + target_link_libraries(fgpanel + ${GLUT_LIBRARIES} + ${GLEW_LIBRARIES} + ${OPENGL_LIBRARIES} + ) + else(GLEW_FOUND) + message(WARNING "GLEW NOT found, can't build FGPanel") + set(WITH_FGPANEL 0) + endif(GLEW_FOUND) + else(GLUT_FOUND) + message(WARNING "GLUT NOT found, can't build FGPanel") + set(WITH_FGPANEL 0) + endif(GLUT_FOUND) endif() -install(TARGETS fgpanel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +if(WITH_FGPANEL) + message(STATUS "FGPanel : ENABLED") + install(TARGETS fgpanel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +else() + message(WARNING "FGPanel : DISABLED") +endif() diff --git a/utils/fgpanel/FGPanel.cxx b/utils/fgpanel/FGPanel.cxx index b89e18926..944395f3b 100644 --- a/utils/fgpanel/FGPanel.cxx +++ b/utils/fgpanel/FGPanel.cxx @@ -94,7 +94,7 @@ FGPanel::init () { "attribute vec2 a_tex_coord; \n" "varying vec2 v_tex_coord; \n" #else - "#version 330 \n" + "#version 130 \n" "in vec4 a_position; \n" "in vec2 a_tex_coord; \n" "out vec2 v_tex_coord; \n" @@ -110,9 +110,8 @@ FGPanel::init () { "precision mediump float; \n" "varying vec2 v_tex_coord; \n" #else - "#version 330 \n" + "#version 130 \n" "in vec2 v_tex_coord; \n" - "out vec4 gl_FragColor; \n" #endif "uniform sampler2D u_texture; \n" "void main () { \n" diff --git a/utils/fgpanel/FGPanel.hxx b/utils/fgpanel/FGPanel.hxx index 718e3dc9b..9f186d887 100644 --- a/utils/fgpanel/FGPanel.hxx +++ b/utils/fgpanel/FGPanel.hxx @@ -51,8 +51,7 @@ using namespace std; * redraw themselves when necessary, and will pass mouse clicks on to * the appropriate instruments for processing. */ -class FGPanel : public SGSubsystem -{ +class FGPanel : public SGSubsystem { public: FGPanel (const SGPropertyNode_ptr root); virtual ~FGPanel (); diff --git a/utils/fgpanel/FGPanelProtocol.hxx b/utils/fgpanel/FGPanelProtocol.hxx index df818300b..33e72122c 100644 --- a/utils/fgpanel/FGPanelProtocol.hxx +++ b/utils/fgpanel/FGPanelProtocol.hxx @@ -28,8 +28,7 @@ class PropertySetter; typedef vector PropertySetterVector; -class FGPanelProtocol : public SGSubsystem -{ +class FGPanelProtocol : public SGSubsystem { public: FGPanelProtocol (SGPropertyNode_ptr a_Root); virtual ~FGPanelProtocol (); diff --git a/utils/fgpanel/FGTextLayer.cxx b/utils/fgpanel/FGTextLayer.cxx index 8ca9de1fe..5dddbc5b0 100644 --- a/utils/fgpanel/FGTextLayer.cxx +++ b/utils/fgpanel/FGTextLayer.cxx @@ -38,13 +38,14 @@ FGTextLayer::Init () { #ifdef _GLES2 "attribute vec4 a_position; \n" "attribute vec2 a_tex_coord; \n" + "varying vec2 v_tex_coord; \n" #else - "#version 330 \n" + "#version 130 \n" "in vec4 a_position; \n" "in vec2 a_tex_coord; \n" + "out vec2 v_tex_coord; \n" #endif "uniform mat4 u_mvp_matrix; \n" - "varying vec2 v_tex_coord; \n" "void main () { \n" " gl_Position = u_mvp_matrix * a_position; \n" " v_tex_coord = a_tex_coord; \n" @@ -53,8 +54,11 @@ FGTextLayer::Init () { const char F_Text_Layer_Shader_Str[] = #ifdef _GLES2 "precision mediump float; \n" -#endif "varying vec2 v_tex_coord; \n" +#else + "#version 130 \n" + "in vec2 v_tex_coord; \n" +#endif "uniform sampler2D u_texture; \n" "uniform vec4 u_color; \n" "void main () { \n" diff --git a/utils/fgpanel/panel_io.hxx b/utils/fgpanel/panel_io.hxx index d24db4e0f..fef6e3ec7 100644 --- a/utils/fgpanel/panel_io.hxx +++ b/utils/fgpanel/panel_io.hxx @@ -31,8 +31,7 @@ #include "FGPanel.hxx" -class FGReadablePanel : public FGPanel -{ +class FGReadablePanel : public FGPanel { public: // Subsystem identification. static const char* staticSubsystemClassId() { return "readable-panel"; }