enable opengl es1

openmw-38
sandstranger 9 years ago
parent 77965501d4
commit bd5057aa3c

@ -159,8 +159,23 @@ if (WIN32)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
endif() endif()
# Dependencies if (ANDROID)
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
set(OSG_PLUGINS_DIR ${OSG_PLUGINS_DIR})
add_definitions (-DOSG_PLUGINS_DIR)
set(OPENGL_ES TRUE CACHE BOOL "enable opengl es support for android" FORCE)
endif (ANDROID)
option(OPENGL_ES "enable opengl es support" FALSE )
if (OPENGL_ES)
INCLUDE(cmake/FindOpenGLES.cmake)
add_definitions (-DOPENGL_ES)
INCLUDE_DIRECTORIES(${OPENGLES_INCLUDE_DIR})
endif (OPENGLES)
# Dependencies
if (NOT ANDROID)
set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)") set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)")
message(STATUS "Using Qt${DESIRED_QT_VERSION}") message(STATUS "Using Qt${DESIRED_QT_VERSION}")
@ -174,6 +189,7 @@ else()
# Instruct CMake to run moc automatically when needed. # Instruct CMake to run moc automatically when needed.
#set(CMAKE_AUTOMOC ON) #set(CMAKE_AUTOMOC ON)
endif() endif()
endif()
# Fix for not visible pthreads functions for linker with glibc 2.15 # Fix for not visible pthreads functions for linker with glibc 2.15
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
@ -204,7 +220,11 @@ IF(BOOST_STATIC)
set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_LIBS ON)
endif() endif()
if (NOT ANDROID)
find_package(OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle osgQt osgUtil osgFX) find_package(OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle osgQt osgUtil osgFX)
else()
find_package(OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle osgUtil osgFX)
endif()
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
if(OSG_STATIC) if(OSG_STATIC)

@ -140,18 +140,51 @@ target_link_libraries(openmw
) )
if (ANDROID) if (ANDROID)
set (OSG_PLUGINS
-Wl,--whole-archive
${OSG_PLUGINS_DIR}/libosgdb_dds.a
${OSG_PLUGINS_DIR}/libosgdb_bmp.a
${OSG_PLUGINS_DIR}/libosgdb_tga.a
${OSG_PLUGINS_DIR}/libosgdb_gif.a
${OSG_PLUGINS_DIR}/libosgdb_jpeg.a
${OSG_PLUGINS_DIR}/libosgdb_png.a
-Wl,--no-whole-archive
)
target_link_libraries(openmw target_link_libraries(openmw
EGL EGL
android android
log log
dl dl
MyGUIEngineStatic MyGUIEngineStatic
cpufeatures
BulletCollision BulletCollision
LinearMath LinearMath
z
osg
osgDB
osgAnimation
osgText
osgUtil
osgShadow
${OPENSCENEGRAPH_LIBRARIES}
${OSG_PLUGINS}
${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
jpeg
gif
png
) )
endif (ANDROID) endif (ANDROID)
if (OPENGL_ES)
target_link_libraries(openmw
${OPENGLES_gl_LIBRARY}
${OPENGLES2_gl_LIBRARY}
)
endif (OPENGL_ES)
if (USE_SYSTEM_TINYXML) if (USE_SYSTEM_TINYXML)
target_link_libraries(openmw ${TINYXML_LIBRARIES}) target_link_libraries(openmw ${TINYXML_LIBRARIES})
endif() endif()

@ -1,4 +1,3 @@
#include "../../SDL_internal.h"
#ifdef __ANDROID__ #ifdef __ANDROID__
#include "SDL_main.h" #include "SDL_main.h"

@ -23,7 +23,7 @@
#endif #endif
#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix)) #if (defined(__APPLE__) || (defined(__linux) && !defined(ANDROID)) || (defined(__unix) && !defined(ANDROID)) || defined(__posix))
#define USE_CRASH_CATCHER 1 #define USE_CRASH_CATCHER 1
#else #else
#define USE_CRASH_CATCHER 0 #define USE_CRASH_CATCHER 0

@ -0,0 +1,94 @@
#-------------------------------------------------------------------
# This file is part of the CMake build system for OGRE
# (Object-oriented Graphics Rendering Engine)
# For the latest info, see http://www.ogre3d.org/
#
# The contents of this file are placed in the public domain. Feel
# free to make use of it in any way you like.
#-------------------------------------------------------------------
# - Try to find OpenGLES
# Once done this will define
#
# OPENGLES_FOUND - system has OpenGLES
# OPENGLES_INCLUDE_DIR - the GL include directory
# OPENGLES_LIBRARIES - Link these to use OpenGLES
IF (WIN32)
IF (CYGWIN)
FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h )
FIND_LIBRARY(OPENGLES_gl_LIBRARY libgles_cm )
ELSE (CYGWIN)
IF(BORLAND)
SET (OPENGLES_gl_LIBRARY import32 CACHE STRING "OpenGL ES 1.x library for win32")
ELSE(BORLAND)
#MS compiler - todo - fix the following line:
SET (OPENGLES_gl_LIBRARY ${OGRE_SOURCE_DIR}/Dependencies/lib/release/libgles_cm.lib CACHE STRING "OpenGL ES 1.x library for win32")
ENDIF(BORLAND)
ENDIF (CYGWIN)
ELSE (WIN32)
IF (APPLE)
#create_search_paths(/Developer/Platforms)
#findpkg_framework(OpenGLES)
#set(OPENGLES_gl_LIBRARY "-framework OpenGLES")
ELSE(APPLE)
FIND_PATH(OPENGLES_INCLUDE_DIR GLES/gl.h
/opt/vc/include
/opt/graphics/OpenGL/include
/usr/openwin/share/include
/usr/X11R6/include
/usr/include
)
FIND_LIBRARY(OPENGLES_gl_LIBRARY
NAMES GLES_CM GLESv1_CM
PATHS /opt/vc/lib
/opt/graphics/OpenGL/lib
/usr/openwin/lib
/usr/shlib /usr/X11R6/lib
/usr/lib
)
# On Unix OpenGL most certainly always requires X11.
# Feel free to tighten up these conditions if you don't
# think this is always true.
#IF (OPENGLES_gl_LIBRARY)
# IF(NOT X11_FOUND)
# INCLUDE(FindX11)
# ENDIF(NOT X11_FOUND)
# IF (X11_FOUND)
# SET (OPENGLES_LIBRARIES ${X11_LIBRARIES})
# ENDIF (X11_FOUND)
#ENDIF (OPENGLES_gl_LIBRARY)
ENDIF(APPLE)
ENDIF (WIN32)
SET( OPENGLES_FOUND "NO" )
IF(OPENGLES_gl_LIBRARY)
SET( OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_LIBRARIES})
SET( OPENGLES_FOUND "YES" )
ENDIF(OPENGLES_gl_LIBRARY)
MARK_AS_ADVANCED(
OPENGLES_INCLUDE_DIR
OPENGLES_gl_LIBRARY
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OPENGLES REQUIRED_VARS OPENGLES_LIBRARIES OPENGLES_INCLUDE_DIR)

@ -20,7 +20,9 @@ else (GIT_CHECKOUT)
configure_file(${VERSION_IN_FILE} ${VERSION_FILE}) configure_file(${VERSION_IN_FILE} ${VERSION_FILE})
endif (GIT_CHECKOUT) endif (GIT_CHECKOUT)
if (NOT OPENGL_ES)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
endif()
# source files # source files
@ -137,6 +139,7 @@ add_component_dir (version
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
) )
if (NOT ANDROID)
add_component_qt_dir (contentselector add_component_qt_dir (contentselector
model/modelitem model/esmfile model/modelitem model/esmfile
model/naturalsort model/contentmodel model/naturalsort model/contentmodel
@ -161,6 +164,7 @@ else()
QT5_WRAP_UI(ESM_UI_HDR ${ESM_UI}) QT5_WRAP_UI(ESM_UI_HDR ${ESM_UI})
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES}) QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
endif() endif()
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE) if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)
@ -172,6 +176,7 @@ include_directories(${BULLET_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR}) add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
if (NOT ANDROID)
target_link_libraries(components target_link_libraries(components
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
@ -192,12 +197,34 @@ target_link_libraries(components
${OPENGL_gl_LIBRARY} ${OPENGL_gl_LIBRARY}
${MYGUI_LIBRARIES} ${MYGUI_LIBRARIES}
) )
else()
target_link_libraries(components
${Boost_SYSTEM_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${OSG_LIBRARIES}
${OPENTHREADS_LIBRARIES}
${OSGPARTICLE_LIBRARIES}
${OSGUTIL_LIBRARIES}
${OSGDB_LIBRARIES}
${OSGVIEWER_LIBRARIES}
${OSGGA_LIBRARIES}
${OSGFX_LIBRARIES}
${OSGANIMATION_LIBRARIES}
${BULLET_LIBRARIES}
${SDL2_LIBRARY}
# For MyGUI platform
${MYGUI_LIBRARIES}
)
endif()
if (WIN32) if (WIN32)
target_link_libraries(components target_link_libraries(components
${Boost_LOCALE_LIBRARY}) ${Boost_LOCALE_LIBRARY})
endif() endif()
if (NOT ANDROID)
if (DESIRED_QT_VERSION MATCHES 4) if (DESIRED_QT_VERSION MATCHES 4)
target_link_libraries(components target_link_libraries(components
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}
@ -205,6 +232,7 @@ if (DESIRED_QT_VERSION MATCHES 4)
else() else()
qt5_use_modules(components Widgets Core) qt5_use_modules(components Widgets Core)
endif() endif()
endif()
if (GIT_CHECKOUT) if (GIT_CHECKOUT)
add_dependencies (components git-version) add_dependencies (components git-version)

@ -217,6 +217,13 @@ namespace SDLUtil
void SDLCursorManager::_createCursorFromResource(const std::string& name, int rotDegrees, osg::Image* image, Uint8 size_x, Uint8 size_y, Uint8 hotspot_x, Uint8 hotspot_y) void SDLCursorManager::_createCursorFromResource(const std::string& name, int rotDegrees, osg::Image* image, Uint8 size_x, Uint8 size_y, Uint8 hotspot_x, Uint8 hotspot_y)
{ {
#ifdef ANDROID
return;
#endif
if (mCursorMap.find(name) != mCursorMap.end())
return;
if (mCursorMap.find(name) != mCursorMap.end()) if (mCursorMap.find(name) != mCursorMap.end())
return; return;

@ -93,6 +93,12 @@ void GraphicsWindowSDL2::init()
SDL_Window *oldWin = SDL_GL_GetCurrentWindow(); SDL_Window *oldWin = SDL_GL_GetCurrentWindow();
SDL_GLContext oldCtx = SDL_GL_GetCurrentContext(); SDL_GLContext oldCtx = SDL_GL_GetCurrentContext();
#ifdef OPENGL_ES
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
#endif
mContext = SDL_GL_CreateContext(mWindow); mContext = SDL_GL_CreateContext(mWindow);
if(!mContext) if(!mContext)
{ {

Loading…
Cancel
Save