diff --git a/CI/before_script.msvc.sh b/CI/before_script.msvc.sh index 2a052912a..a0cf06919 100644 --- a/CI/before_script.msvc.sh +++ b/CI/before_script.msvc.sh @@ -613,8 +613,7 @@ fi SUFFIX="" fi - add_runtime_dlls "$(pwd)/bin/lib"{EGL,GLESv2}${SUFFIX}.dll \ - "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll + add_runtime_dlls "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll add_qt_platform_dlls "$(pwd)/plugins/platforms/qwindows${SUFFIX}.dll" echo Done. diff --git a/CMakeLists.txt b/CMakeLists.txt index e81c502f6..d42097c96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,6 +141,8 @@ find_package(RakNet REQUIRED) include_directories(${RakNet_INCLUDES}) # Dependencies +find_package(OpenGL REQUIRED) + if (USE_QT) message(STATUS "Using Qt${DESIRED_QT_VERSION}") @@ -190,12 +192,6 @@ if (NOT WIN32 AND BUILD_WIZARD) # windows users can just run the morrowind insta set(OPENMW_USE_UNSHIELD TRUE) endif() -option(OPENGL_ES "enable opengl es support" FALSE ) - -if (OPENGL_ES) - add_definitions(-DOPENGL_ES) -endif(OPENGL_ES) - # Fix for not visible pthreads functions for linker with glibc 2.15 if (UNIX AND NOT APPLE) find_package (Threads) diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index dbfee05df..6e1fef716 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -503,13 +503,11 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha) // use a shader to render the simple water, ensuring that fog is applied per pixel as required. // this could be removed if a more detailed water mesh, using some sort of paging solution, is implemented. -#if !defined(OPENGL_ES) && !defined(ANDROID) Resource::SceneManager* sceneManager = mResourceSystem->getSceneManager(); bool oldValue = sceneManager->getForceShaders(); sceneManager->setForceShaders(true); sceneManager->recreateShaders(node); sceneManager->setForceShaders(oldValue); -#endif } void Water::createShaderWaterStateSet(osg::Node* node, Reflection* reflection, Refraction* refraction) diff --git a/cmake/FindOpenGLES.cmake b/cmake/FindOpenGLES.cmake deleted file mode 100644 index 6a0466409..000000000 --- a/cmake/FindOpenGLES.cmake +++ /dev/null @@ -1,94 +0,0 @@ -#------------------------------------------------------------------- -# This file is part of the CMake build system for OGRE -# (Object-oriented Graphics Rendering Engine) -# For the latest info, see https://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) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 56373cdab..48e5aa4e8 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -26,14 +26,6 @@ else (GIT_CHECKOUT) configure_resource_file(${VERSION_IN_FILE} ${VERSION_FILE_PATH_BASE} ${VERSION_FILE_PATH_RELATIVE}) endif (GIT_CHECKOUT) -if(BUILD_OPENMW OR BUILD_OPENCS) - if (OPENGL_ES) - find_package(OpenGLES REQUIRED) - else() - find_package(OpenGL REQUIRED) - endif() -endif(BUILD_OPENMW OR BUILD_OPENCS) - # source files add_component_dir (settings @@ -251,14 +243,6 @@ include_directories(${Bullet_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}) add_library(components STATIC ${COMPONENT_FILES} ${MOC_SRCS} ${ESM_UI_HDR}) -if(BUILD_OPENMW OR BUILD_OPENCS) - if (OPENGL_ES) - set(GL_LIB ${OPENGLES_gl_LIBRARY}) - else() - set(GL_LIB ${OPENGL_gl_LIBRARY}) - endif() -endif(BUILD_OPENMW OR BUILD_OPENCS) - target_link_libraries(components ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} @@ -275,8 +259,7 @@ target_link_libraries(components ${OSGANIMATION_LIBRARIES} ${Bullet_LIBRARIES} ${SDL2_LIBRARIES} - # For MyGUI platform - ${GL_LIB} + ${OPENGL_gl_LIBRARY} ${MyGUI_LIBRARIES} ) diff --git a/components/sdlutil/sdlgraphicswindow.cpp b/components/sdlutil/sdlgraphicswindow.cpp index de82ca850..f9767238f 100644 --- a/components/sdlutil/sdlgraphicswindow.cpp +++ b/components/sdlutil/sdlgraphicswindow.cpp @@ -91,7 +91,7 @@ void GraphicsWindowSDL2::init() SDL_Window *oldWin = SDL_GL_GetCurrentWindow(); SDL_GLContext oldCtx = SDL_GL_GetCurrentContext(); -#if defined(OPENGL_ES) || defined(ANDROID) +#if defined(ANDROID) int major = 1; int minor = 1; char *ver = getenv("OPENMW_GLES_VERSION"); diff --git a/files/shaders/lighting.glsl b/files/shaders/lighting.glsl index 7b8486fbe..06eebea68 100644 --- a/files/shaders/lighting.glsl +++ b/files/shaders/lighting.glsl @@ -47,8 +47,8 @@ vec3 getSpecular(vec3 viewNormal, vec3 viewDirection, float shininess, vec3 matS { vec3 lightDir = normalize(gl_LightSource[0].position.xyz); float NdotL = max(dot(viewNormal, lightDir), 0.0); - if (NdotL < 0) - return vec3(0,0,0); + if (NdotL < 0.0) + return vec3(0.,0.,0.); vec3 halfVec = normalize(lightDir - viewDirection); - return pow(max(dot(viewNormal, halfVec), 0.0), 128) * gl_LightSource[0].specular.xyz * matSpec; + return pow(max(dot(viewNormal, halfVec), 0.0), 128.) * gl_LightSource[0].specular.xyz * matSpec; }