1
0
Fork 0

FGPanel: update for Raspbian 10

This commit is contained in:
James Turner 2020-04-01 21:01:07 +01:00
parent 1ce36af298
commit d0fd02fa8d
5 changed files with 88 additions and 50 deletions

View file

@ -1,6 +1,14 @@
find_package(PNG REQUIRED)
find_package(OpenGL REQUIRED)
find_package(Freetype REQUIRED)
find_package(PNG)
find_package(OpenGL)
find_package(Freetype)
if((NOT PNG_FOUND) OR (NOT OPENGL_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 "Freetype: ${FREETYPE_FOUND}")
return()
endif()
find_path(BCMHOST_INCLUDE_DIR
NAMES bcm_host.h
@ -13,15 +21,7 @@ include_directories(
${PNG_INCLUDE_DIR}
)
if(BCMHOST_INCLUDE_DIR)
# CMAKE > 3.1 : target_sources(fgpanel
set(TARGET_SOURCES
GLES_utils.cxx
GLES_utils.hxx
)
endif()
add_executable(fgpanel
set(TARGET_SOURCES
main.cxx
ApplicationProperties.hxx
ApplicationProperties.cxx
@ -63,58 +63,82 @@ add_executable(fgpanel
panel_io.hxx
GL_utils.cxx
GL_utils.hxx
${TARGET_SOURCES}
)
add_executable(fgpanel ${TARGET_SOURCES})
target_link_libraries(fgpanel
${PNG_LIBRARIES}
SimGearCore
${PNG_LIBRARIES}
${FREETYPE_LIBRARIES}
)
if(BCMHOST_INCLUDE_DIR)
message(STATUS "found Raspberry Pi")
include_directories(
add_executable(fgpanel-egl ${TARGET_SOURCES}
GLES_utils.cxx
GLES_utils.hxx
)
target_include_directories(fgpanel-egl PUBLIC
${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
target_link_libraries(fgpanel-egl
SimGearCore
${PNG_LIBRARIES}
${FREETYPE_LIBRARIES}
-lbrcmGLESv2 -lbrcmEGL -lm -lbcm_host -L/opt/vc/lib
)
add_definitions(-D_GLES2 -D_RPI)
else()
find_package(GLUT)
if(GLUT_FOUND)
target_compile_definitions(fgpanel-egl PUBLIC
-D_GLES2 -D_RPI
)
target_compile_definitions(fgpanel PUBLIC
-D_RPI
)
message(STATUS "FGPanel (Raspberry Pi) : ENABLED")
install(TARGETS fgpanel-egl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else(BCMHOST_INCLUDE_DIR)
message(STATUS "FGPanel (Raspberry Pi) : DISABLED")
endif(BCMHOST_INCLUDE_DIR)
find_package(GLEW)
if(GLEW_FOUND)
find_package(GLUT)
if(GLUT_FOUND)
message(STATUS "found GLUT inc ${GLUT_INCLUDE_DIR}, lib ${GLUT_LIBRARIES}")
if(MSVC)
target_compile_definitions(fgpanel PUBLIC
-DFREEGLUT_LIB_PRAGMAS=0
)
endif(MSVC)
include_directories(
${GLEW_INCLUDE_DIRS}
)
find_package(GLEW)
if(GLEW_FOUND)
message(STATUS "found GLEW inc ${GLEW_INCLUDE_DIR}, lib ${GLEW_LIBRARIES}")
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")
target_include_directories(fgpanel PUBLIC
${GLEW_INCLUDE_DIRS}
)
target_link_libraries(fgpanel
${OPENGL_LIBRARIES}
${GLUT_LIBRARIES}
${GLEW_LIBRARIES}
)
else(GLEW_FOUND)
message(WARNING "GLEW NOT found, can't build FGPanel")
set(WITH_FGPANEL 0)
endif(GLUT_FOUND)
endif()
endif(GLEW_FOUND)
else(GLUT_FOUND)
message(WARNING "GLUT NOT found, can't build FGPanel")
set(WITH_FGPANEL 0)
endif(GLUT_FOUND)
if(WITH_FGPANEL)
message(STATUS "FGPanel : ENABLED")
install(TARGETS fgpanel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
else(WITH_FGPANEL)
message(WARNING "FGPanel : DISABLED")
endif()
endif(WITH_FGPANEL)

View file

@ -89,7 +89,8 @@ void
FGPanel::init () {
// Textured Layer Shaders
const char V_Textured_Layer_Shader_Str[] =
#ifdef _GLES2
#ifdef _RPI
"#version 100 \n"
"attribute vec4 a_position; \n"
"attribute vec2 a_tex_coord; \n"
"varying vec2 v_tex_coord; \n"
@ -106,7 +107,8 @@ FGPanel::init () {
"} \n";
const char F_Textured_Layer_Shader_Str[] =
#ifdef _GLES2
#ifdef _RPI
"#version 100 \n"
"precision mediump float; \n"
"varying vec2 v_tex_coord; \n"
#else

View file

@ -36,7 +36,6 @@
#include <GLUT/glut.h>
#elif defined (_GLES2)
#include <GLES2/gl2.h>
#include "GLES_utils.hxx"
#else
#include <GL/glew.h> // Must be included before <GL/gl.h>
#include <GL/gl.h>

View file

@ -35,7 +35,8 @@ GLint FGTextLayer::Text_Layer_Color_Loc (0);
bool
FGTextLayer::Init () {
const char V_Text_Layer_Shader_Str[] =
#ifdef _GLES2
#ifdef _RPI
"#version 100 \n"
"attribute vec4 a_position; \n"
"attribute vec2 a_tex_coord; \n"
"varying vec2 v_tex_coord; \n"
@ -52,7 +53,8 @@ FGTextLayer::Init () {
"} \n";
const char F_Text_Layer_Shader_Str[] =
#ifdef _GLES2
#ifdef _RPI
"#version 100 \n"
"precision mediump float; \n"
"varying vec2 v_tex_coord; \n"
#else

View file

@ -15,10 +15,10 @@ INSTALLATION
The source code of FGPanel can easily be adapted to other embedded devices supporting OpenGL ES 2.0.
3. Build FGPanel only (don't build all components on the Raspberry Pi as this will take ages!!!):
make -- fgpanel
make -- fgpanel-egl fgpanel
USAGE
=====
USAGE (fgpanel-egl)
===================
1. Increase the amount of GPU memory by editing the /boot/config.txt file.
Add the following line (this is for Raspberry Pi model 1B with 512 Mb of memory):
@ -30,10 +30,21 @@ USAGE
3. Stop X server. FGPanel runs in the console (Linux framebuffer).
4. Start FGPanel as usual but as ROOT or use the 'sudo' command (see README):
sudo -- utils/fgpanel/fgpanel --fg-root=/path/to/fg/data --panel=Aircraft/MyAircraft/Panels/MyPanel.xml
sudo -- utils/fgpanel/fgpanel-egl --fg-root=/path/to/fg/data --panel=Aircraft/MyAircraft/Panels/MyPanel.xml
ROOT privileges are required to access the GPU of the Raspberry Pi.
USAGE (fgpanel)
===================
1. Activate the Full KMS driver on the Raspberry Pi using the raspi-config program:
Advanced Options -> GL Driver -> Full KMS
2. Reboot. The Full KMS driver should be activated.
3. When X server is running, start FGPanel as usual (see README):
utils/fgpanel/fgpanel --fg-root=/path/to/fg/data --panel=Aircraft/MyAircraft/Panels/MyPanel.xml
FEATURES
========