enable opengl es1

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

@ -159,20 +159,36 @@ if (WIN32)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
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)
set(DESIRED_QT_VERSION 4 CACHE STRING "The QT version OpenMW should use (4 or 5)")
message(STATUS "Using Qt${DESIRED_QT_VERSION}")
option(OPENGL_ES "enable opengl es support" FALSE )
if (DESIRED_QT_VERSION MATCHES 4)
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtOpenGL)
else()
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5OpenGL REQUIRED)
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)")
message(STATUS "Using Qt${DESIRED_QT_VERSION}")
if (DESIRED_QT_VERSION MATCHES 4)
find_package(Qt4 REQUIRED COMPONENTS QtCore QtGui QtNetwork QtOpenGL)
else()
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5OpenGL REQUIRED)
# Instruct CMake to run moc automatically when needed.
#set(CMAKE_AUTOMOC ON)
endif()
endif()
# Fix for not visible pthreads functions for linker with glibc 2.15
@ -204,7 +220,11 @@ IF(BOOST_STATIC)
set(Boost_USE_STATIC_LIBS ON)
endif()
find_package(OpenSceneGraph 3.2.0 REQUIRED osgDB osgViewer osgText osgGA osgAnimation osgParticle osgQt osgUtil osgFX)
if (NOT ANDROID)
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})
if(OSG_STATIC)

@ -140,18 +140,51 @@ target_link_libraries(openmw
)
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
EGL
android
log
dl
MyGUIEngineStatic
cpufeatures
BulletCollision
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)
if (OPENGL_ES)
target_link_libraries(openmw
${OPENGLES_gl_LIBRARY}
${OPENGLES2_gl_LIBRARY}
)
endif (OPENGL_ES)
if (USE_SYSTEM_TINYXML)
target_link_libraries(openmw ${TINYXML_LIBRARIES})
endif()

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

@ -23,7 +23,7 @@
#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
#else
#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})
endif (GIT_CHECKOUT)
find_package(OpenGL REQUIRED)
if (NOT OPENGL_ES)
find_package(OpenGL REQUIRED)
endif()
# source files
@ -137,29 +139,31 @@ add_component_dir (version
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
)
add_component_qt_dir (contentselector
model/modelitem model/esmfile
model/naturalsort model/contentmodel
model/loadordererror
view/combobox view/contentselector
)
add_component_qt_dir (config
gamesettings
launchersettings
settingsbase
)
add_component_qt_dir (process
processinvoker
)
if (DESIRED_QT_VERSION MATCHES 4)
include(${QT_USE_FILE})
QT4_WRAP_UI(ESM_UI_HDR ${ESM_UI})
QT4_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
else()
QT5_WRAP_UI(ESM_UI_HDR ${ESM_UI})
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
if (NOT ANDROID)
add_component_qt_dir (contentselector
model/modelitem model/esmfile
model/naturalsort model/contentmodel
model/loadordererror
view/combobox view/contentselector
)
add_component_qt_dir (config
gamesettings
launchersettings
settingsbase
)
add_component_qt_dir (process
processinvoker
)
if (DESIRED_QT_VERSION MATCHES 4)
include(${QT_USE_FILE})
QT4_WRAP_UI(ESM_UI_HDR ${ESM_UI})
QT4_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
else()
QT5_WRAP_UI(ESM_UI_HDR ${ESM_UI})
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
endif()
endif()
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
@ -172,38 +176,62 @@ include_directories(${BULLET_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR})
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
${OPENGL_gl_LIBRARY}
${MYGUI_LIBRARIES}
)
if (NOT ANDROID)
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
${OPENGL_gl_LIBRARY}
${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)
target_link_libraries(components
${Boost_LOCALE_LIBRARY})
endif()
if (DESIRED_QT_VERSION MATCHES 4)
target_link_libraries(components
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY})
else()
qt5_use_modules(components Widgets Core)
if (NOT ANDROID)
if (DESIRED_QT_VERSION MATCHES 4)
target_link_libraries(components
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY})
else()
qt5_use_modules(components Widgets Core)
endif()
endif()
if (GIT_CHECKOUT)

@ -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)
{
#ifdef ANDROID
return;
#endif
if (mCursorMap.find(name) != mCursorMap.end())
return;
if (mCursorMap.find(name) != mCursorMap.end())
return;

@ -92,7 +92,13 @@ void GraphicsWindowSDL2::init()
// have to get the current one to be able to restore it afterward.
SDL_Window *oldWin = SDL_GL_GetCurrentWindow();
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);
if(!mContext)
{

Loading…
Cancel
Save