Update FGPanel:
- use OpenGL 2.0 instead of OpenGL 1.0; - port to Raspberry Pi; - remove PLib dependencies.
This commit is contained in:
parent
5b14d6e495
commit
e78b92ca27
7 changed files with 52 additions and 51 deletions
|
@ -16,7 +16,6 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
//
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <direct.h> // for getcwd()
|
||||
#else // !_WIN32
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -28,8 +28,7 @@ class PropertySetter;
|
|||
|
||||
typedef vector<PropertySetter*> PropertySetterVector;
|
||||
|
||||
class FGPanelProtocol : public SGSubsystem
|
||||
{
|
||||
class FGPanelProtocol : public SGSubsystem {
|
||||
public:
|
||||
FGPanelProtocol (SGPropertyNode_ptr a_Root);
|
||||
virtual ~FGPanelProtocol ();
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"; }
|
||||
|
|
Loading…
Reference in a new issue