mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 10:05:10 +00:00
Added support for GLESv1_CM and GLESv2 client libraries.
This commit is contained in:
parent
f8df91d815
commit
0517a82467
16
CMake/modules/FindGLESv1.cmake
Normal file
16
CMake/modules/FindGLESv1.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
# Find GLESv1
|
||||
#
|
||||
# GLESv1_INCLUDE_DIR
|
||||
# GLESv1_LIBRARY
|
||||
# GLESv1_FOUND
|
||||
|
||||
find_path(GLESv1_INCLUDE_DIR NAMES GLES/gl.h)
|
||||
|
||||
set(GLESv1_NAMES ${GLESv1_NAMES} GLESv1_CM)
|
||||
find_library(GLESv1_LIBRARY NAMES ${GLESv1_NAMES})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GLESv1 DEFAULT_MSG GLESv1_LIBRARY GLESv1_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(GLESv1_INCLUDE_DIR GLESv1_LIBRARY)
|
||||
|
16
CMake/modules/FindGLESv2.cmake
Normal file
16
CMake/modules/FindGLESv2.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
# Find GLESv2
|
||||
#
|
||||
# GLESv2_INCLUDE_DIR
|
||||
# GLESv2_LIBRARY
|
||||
# GLESv2_FOUND
|
||||
|
||||
find_path(GLESv2_INCLUDE_DIR NAMES GLES2/gl2.h)
|
||||
|
||||
set(GLESv2_NAMES ${GLESv2_NAMES} GLESv2)
|
||||
find_library(GLESv2_LIBRARY NAMES ${GLESv2_NAMES})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARY GLESv2_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(GLESv2_INCLUDE_DIR GLESv2_LIBRARY)
|
||||
|
@ -20,6 +20,19 @@ if (NOT APPLE)
|
||||
endif()
|
||||
|
||||
if (GLFW_USE_EGL)
|
||||
set(GLFW_CLIENT_LIBRARY "opengl" CACHE STRING
|
||||
"The client library to use; one of: opengl, glesv1 or glesv2")
|
||||
|
||||
if (${GLFW_CLIENT_LIBRARY} STREQUAL "opengl")
|
||||
set(_GLFW_USE_OPENGL 1)
|
||||
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv1")
|
||||
set(_GLFW_USE_GLESV1 1)
|
||||
elseif (${GLFW_CLIENT_LIBRARY} STREQUAL "glesv2")
|
||||
set(_GLFW_USE_GLESV2 1)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported client library")
|
||||
endif()
|
||||
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/modules)
|
||||
find_package(EGL REQUIRED)
|
||||
|
||||
@ -27,7 +40,15 @@ if (GLFW_USE_EGL)
|
||||
set(GLFW_BUILD_TESTS OFF)
|
||||
message(STATUS "NOTE: Examples and tests are disabled for EGL")
|
||||
else()
|
||||
set(_GLFW_USE_OPENGL 1)
|
||||
endif()
|
||||
|
||||
if (_GLFW_USE_OPENGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
elseif (_GLFW_USE_GLESV1)
|
||||
find_package(GLESv1 REQUIRED)
|
||||
elseif (_GLFW_USE_GLESV2)
|
||||
find_package(GLESv2 REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
@ -86,14 +107,10 @@ else()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Win32 and WGL on Windows
|
||||
# Set up GLFW for Win32
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_WIN32)
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
if (MSVC)
|
||||
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
|
||||
|
||||
@ -116,6 +133,14 @@ if (_GLFW_WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for WGL
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_WGL)
|
||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Xlib and GLX or EGL on Unix-like systems with X Windows
|
||||
#--------------------------------------------------------------------
|
||||
@ -123,8 +148,7 @@ if (_GLFW_X11)
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
set(GLFW_PKG_LIBS "")
|
||||
set(GLFW_PKG_DEPS "x11")
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} x11")
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND glfw_INCLUDE_DIRS ${X11_X11_INCLUDE_PATH})
|
||||
@ -183,7 +207,6 @@ endif()
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_GLX)
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
|
||||
@ -233,11 +256,10 @@ if (_GLFW_GLX)
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# EGL Context
|
||||
# Use EGL for context creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_EGL)
|
||||
|
||||
# Set up library and include paths
|
||||
list(APPEND glfw_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
|
||||
list(APPEND glfw_LIBRARIES ${EGL_LIBRARY})
|
||||
|
||||
@ -247,10 +269,24 @@ if (_GLFW_EGL)
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} egl")
|
||||
endif()
|
||||
|
||||
if (_GLFW_USE_OPENGL)
|
||||
list(APPEND glfw_LIBRARIES ${OPENGL_gl_LIBRARY})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} gl")
|
||||
elseif (_GLFW_USE_GLESV1)
|
||||
list(APPEND glfw_LIBRARIES ${GLESv1_LIBRARY})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${GLESv1_INCLUDE_DIR})
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv1_cm")
|
||||
elseif (_GLFW_USE_GLESV2)
|
||||
list(APPEND glfw_LIBRARIES ${GLESv2_LIBRARY})
|
||||
list(APPEND glfw_INCLUDE_DIRS ${GLESv2_INCLUDE_DIR})
|
||||
set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} glesv2")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Set up GLFW for Cocoa and NSOpenGL on Mac OS X
|
||||
# Use Cocoa for window creation and NSOpenGL for context creation
|
||||
#--------------------------------------------------------------------
|
||||
if (_GLFW_COCOA AND _GLFW_NSGL)
|
||||
|
||||
|
@ -64,6 +64,13 @@
|
||||
// Define this to 1 if glXGetProcAddressEXT is available
|
||||
#cmakedefine _GLFW_HAS_GLXGETPROCADDRESSEXT
|
||||
|
||||
// Define this to 1 if using OpenGL as the client library
|
||||
#cmakedefine _GLFW_USE_OPENGL
|
||||
// Define this to 1 if using OpenGL ES 1.1 as the client library
|
||||
#cmakedefine _GLFW_USE_GLESV1
|
||||
// Define this to 1 if using OpenGL ES 2.0 as the client library
|
||||
#cmakedefine _GLFW_USE_GLESV2
|
||||
|
||||
// The GLFW version as used by glfwGetVersionString
|
||||
#define _GLFW_VERSION_FULL "@GLFW_VERSION_FULL@"
|
||||
|
||||
|
@ -390,6 +390,7 @@ GLboolean _glfwRefreshContextParams(void)
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
if (window->glMajor > 2)
|
||||
{
|
||||
// OpenGL 3.0+ uses a different function for extension string retrieval
|
||||
@ -472,6 +473,7 @@ GLboolean _glfwRefreshContextParams(void)
|
||||
window->glRobustness = GLFW_NO_RESET_NOTIFICATION;
|
||||
}
|
||||
}
|
||||
#endif // _GLFW_USE_OPENGL
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
@ -659,6 +661,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
else
|
||||
{
|
||||
int i;
|
||||
@ -677,6 +680,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _GLFW_USE_OPENGL
|
||||
|
||||
// Check if extension is in the platform-specific string
|
||||
return _glfwPlatformExtensionSupported(extension);
|
||||
|
@ -81,16 +81,24 @@ typedef struct _GLFWmonitor _GLFWmonitor;
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(_GLFW_USE_GLESV1)
|
||||
#define GLFW_INCLUDE_ES1
|
||||
#elif defined(_GLFW_USE_GLESV2)
|
||||
#define GLFW_INCLUDE_ES2
|
||||
#endif
|
||||
|
||||
// Disable the inclusion of the platform glext.h by gl.h to allow proper
|
||||
// inclusion of our own, newer glext.h below
|
||||
#define GL_GLEXT_LEGACY
|
||||
|
||||
#include "../include/GL/glfw3.h"
|
||||
|
||||
// This path may need to be changed if you build GLFW using your own setup
|
||||
// We ship and use our own copy of glext.h since GLFW uses fairly new
|
||||
// extensions and not all operating systems come with an up-to-date version
|
||||
#include "../support/GL/glext.h"
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
// This path may need to be changed if you build GLFW using your own setup
|
||||
// GLFW comes with its own copy of glext.h since it uses fairly new extensions
|
||||
// and not all development environments come with an up-to-date version
|
||||
#include "../support/GL/glext.h"
|
||||
#endif
|
||||
|
||||
#if defined(_GLFW_COCOA)
|
||||
#include "cocoa_platform.h"
|
||||
@ -227,7 +235,9 @@ struct _GLFWwindow
|
||||
GLboolean glForward, glDebug;
|
||||
int glProfile;
|
||||
int glRobustness;
|
||||
#if defined(_GLFW_USE_OPENGL)
|
||||
PFNGLGETSTRINGIPROC GetStringi;
|
||||
#endif
|
||||
|
||||
GLFWwindowposfun windowPosCallback;
|
||||
GLFWwindowsizefun windowSizeCallback;
|
||||
|
Loading…
Reference in New Issue
Block a user