WIP: Allow compilation for Android
Does not work as OpenGL code relies on glVertex2f() and glColor3f(). Maybe the following would work: https://stackoverflow.com/questions/10299918/how-to-re-write-2d-opengl-app-for-opengl-es
This commit is contained in:
parent
86ce9b0538
commit
dc77a39036
|
@ -149,7 +149,26 @@ include(BasicConfig)
|
|||
|
||||
# find OpenGL
|
||||
set(OpenGL_GL_PREFERENCE "GLVND")
|
||||
if (ANDROID)
|
||||
set(USE_OPENGL_ES ON)
|
||||
set(OPENGL_INCLUDE_DIR "${CMAKE_SYSROOT}/usr/include")
|
||||
if (ANDROID_TOOLCHAIN_NAME MATCHES "(.*)(-clang)")
|
||||
set(OPENGL_opengl_LIBRARY "${CMAKE_SYSROOT}/usr/lib/${CMAKE_MATCH_1}/${ANDROID_NATIVE_API_LEVEL}/libGLESv2.so")
|
||||
set(OPENGL_glx_LIBRARY "${CMAKE_SYSROOT}/usr/lib/${CMAKE_MATCH_1}/${ANDROID_NATIVE_API_LEVEL}/libGLX.so")
|
||||
endif ()
|
||||
message(STATUS "OpenGL library: ${OPENGL_opengl_LIBRARY}")
|
||||
if (NOT EXISTS "${OPENGL_INCLUDE_DIR}" OR NOT EXISTS "${OPENGL_opengl_LIBRARY}")
|
||||
message(FATAL_ERROR "Unable to find OpenGL.")
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT USE_OPENGL_ES)
|
||||
option(USE_OPENGL_ES "Whether to use OpenGL ES (instead of regular OpenGL)" OFF)
|
||||
endif ()
|
||||
find_package(OpenGL REQUIRED)
|
||||
if (USE_OPENGL_ES)
|
||||
add_compile_options("-DUSE_OPENGL_ES")
|
||||
set(OPENGL_LIBRARIES ${OPENGL_gles2_LIBRARY})
|
||||
endif ()
|
||||
|
||||
# find pkg-config
|
||||
if (NOT WIN32 OR MINGW)
|
||||
|
@ -319,7 +338,7 @@ target_link_libraries("${META_TARGET_NAME}" PRIVATE ${OPENGL_LIBRARIES} ${FTGL_L
|
|||
${FLUIDSYNTH_LIBRARY} ${RTMIDI_LIBRARY})
|
||||
|
||||
# install various additional files
|
||||
if (NOT APPLE)
|
||||
if (NOT APPLE AND NOT ANDROID)
|
||||
install(FILES ../pianobooster.desktop DESTINATION share/applications)
|
||||
install(TARGETS "${META_TARGET_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif (NOT APPLE)
|
||||
|
|
14
src/Draw.h
14
src/Draw.h
|
@ -32,6 +32,9 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENGL_ES
|
||||
#include <GLES2/gl2.h>
|
||||
#else
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
|
@ -39,6 +42,7 @@
|
|||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NO_USE_FTGL
|
||||
#include <FTGL/ftgl.h>
|
||||
#endif
|
||||
|
@ -81,14 +85,6 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
void scrollVertex(float x, float y)
|
||||
{
|
||||
if (m_scrollProperties->horizontal())
|
||||
glVertex2f (x,y);
|
||||
else
|
||||
glVertex2f (y,x);
|
||||
}
|
||||
|
||||
void drawSymbol(CSymbol symbol, float x, float y, CSlot* slot = 0);
|
||||
void drawSymbol(CSymbol symbol, float x);
|
||||
void drawSlot(CSlot* slot);
|
||||
|
@ -99,7 +95,9 @@ public:
|
|||
m_forceCompileRedraw = 1;
|
||||
}
|
||||
static whichPart_t getDisplayHand() {return m_displayHand;}
|
||||
#ifndef USE_OPENGL_ES
|
||||
static void drColor(CColor color) { glColor3f(color.red, color.green, color.blue);}
|
||||
#endif
|
||||
static void forceCompileRedraw(int value = 1) { m_forceCompileRedraw = value; }
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue