diff --git a/CMakeLists.txt b/CMakeLists.txt index 8620cf3df..0694402e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,7 +313,6 @@ add_definitions(${OSD_COMPILER_FLAGS}) set(CMAKE_SUPPRESS_REGENERATION TRUE) option(PTEX_LOCATION "Path to Ptex" "") -option(GLEW_LOCATION "Path to GLEW" "") option(GLFW_LOCATION "Path to GLFW" "") option(NO_LIB "Disable the opensubdiv libs build (caveat emptor)" OFF) @@ -332,7 +331,6 @@ option(NO_METAL "Disable Metal support" OFF) option(NO_DX "Disable DirectX support") option(NO_TESTS "Disable all tests") option(NO_GLTESTS "Disable GL tests") -option(NO_GLEW "Disable use of GLEW" ON) option(NO_GLFW "Disable components depending on GLFW" OFF) option(NO_GLFW_X11 "Disable GLFW components depending on X11" OFF) option(NO_MACOS_FRAMEWORK "Disable generation of framework on macOS" OFF) @@ -386,18 +384,7 @@ if (OPENGL_FOUND AND NOT IOS) add_definitions( -DOPENSUBDIV_HAS_OPENGL ) - if (NOT NO_GLEW) - if (APPLE) - find_package(GLEW) - else() - find_package(GLEW REQUIRED) - endif() - endif() - if(GLEW_FOUND) - add_definitions( -DOSD_USES_GLEW ) - else() - add_definitions( -DOSD_USES_INTERNAL_GLAPILOADER ) - endif() + add_definitions( -DOSD_USES_INTERNAL_GLAPILOADER ) endif() if (WIN32 AND NOT NO_DX) @@ -484,18 +471,7 @@ macro(osd_detect_gl_version header) endmacro() -if(GLEW_FOUND AND GLEW_INCLUDE_DIR) - - osd_detect_gl_version(${GLEW_INCLUDE_DIR}/GL/glew.h) - set(OPENGL_LOADER_INCLUDE_DIRS - ${GLEW_INCLUDE_DIR} - ${PROJECT_SOURCE_DIR}/glLoader) - set(OPENGL_LOADER_LIBRARIES - ${GLEW_LIBRARY} - OpenGL::GL - ${CMAKE_DL_LIBS}) - -elseif(OPENGL_FOUND) +if(OPENGL_FOUND) osd_detect_gl_version(${PROJECT_SOURCE_DIR}/glLoader/glApi.h) set(OPENGL_LOADER_INCLUDE_DIRS @@ -657,13 +633,6 @@ else() endif() if (WIN32) - if ("${GLEW_LIBRARY}" MATCHES "glew32s(d|)") - # Link against the static version of GLEW - add_definitions( - -DGLEW_STATIC - ) - endif() - if (DXSDK_FOUND AND NOT NO_DX) add_definitions( -DOPENSUBDIV_HAS_DX11SDK diff --git a/cmake/FindGLEW.cmake b/cmake/FindGLEW.cmake deleted file mode 100644 index 314d496ec..000000000 --- a/cmake/FindGLEW.cmake +++ /dev/null @@ -1,107 +0,0 @@ -# -# Copyright 2013 Pixar -# -# Licensed under the Apache License, Version 2.0 (the "Apache License") -# with the following modification; you may not use this file except in -# compliance with the Apache License and the following modification to it: -# Section 6. Trademarks. is deleted and replaced with: -# -# 6. Trademarks. This License does not grant permission to use the trade -# names, trademarks, service marks, or product names of the Licensor -# and its affiliates, except as required to comply with Section 4(c) of -# the License and to reproduce the content of the NOTICE file. -# -# You may obtain a copy of the Apache License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the Apache License with the above modification is -# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the Apache License for the specific -# language governing permissions and limitations under the Apache License. -# - -# Try to find GLEW library and include path. -# Once done this will define -# -# GLEW_FOUND -# GLEW_INCLUDE_DIR -# GLEW_LIBRARY -# - -include(FindPackageHandleStandardArgs) - -if (WIN32) - - find_path(GLEW_INCLUDE_DIR - NAMES - GL/glew.h - HINTS - "${GLEW_LOCATION}/include" - "$ENV{GLEW_LOCATION}/include" - PATHS - "$ENV{PROGRAMFILES}/GLEW/include" - "${PROJECT_SOURCE_DIR}/extern/glew/include" - DOC "The directory where GL/glew.h resides" ) - - if ("${CMAKE_GENERATOR}" MATCHES "[Ww]in64" OR - "${CMAKE_GENERATOR_PLATFORM}" MATCHES "x64") - set(ARCH x64) - else() - set(ARCH x86) - endif() - - find_library(GLEW_LIBRARY - NAMES - glew GLEW glew32s glew32 - HINTS - "${GLEW_LOCATION}/lib" - "$ENV{GLEW_LOCATION}/lib" - PATHS - "$ENV{PROGRAMFILES}/GLEW/lib" - "${PROJECT_SOURCE_DIR}/extern/glew/bin" - "${PROJECT_SOURCE_DIR}/extern/glew/lib" - PATH_SUFFIXES - Release/${ARCH} - DOC "The GLEW library") -endif () - -if (${CMAKE_HOST_UNIX}) - find_path( GLEW_INCLUDE_DIR - NAMES - GL/glew.h - HINTS - "${GLEW_LOCATION}/include" - "$ENV{GLEW_LOCATION}/include" - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - NO_DEFAULT_PATH - DOC "The directory where GL/glew.h resides" - ) - find_library( GLEW_LIBRARY - NAMES - GLEW glew - HINTS - "${GLEW_LOCATION}/lib" - "$ENV{GLEW_LOCATION}/lib" - PATHS - /usr/lib64 - /usr/lib - /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - NO_DEFAULT_PATH - DOC "The GLEW library") -endif () - -find_package_handle_standard_args(GLEW - REQUIRED_VARS - GLEW_INCLUDE_DIR - GLEW_LIBRARY -) diff --git a/glLoader/glLoader.cpp b/glLoader/glLoader.cpp index d0ce9a9a6..6b83f25ec 100644 --- a/glLoader/glLoader.cpp +++ b/glLoader/glLoader.cpp @@ -36,41 +36,14 @@ namespace GLLoader { bool applicationInitializeGL() { -#if defined(OSD_USES_INTERNAL_GLAPILOADER) // -- GLAPILOADER return OpenSubdiv::internal::GLApi::glApiLoad(); - -#elif defined(OSD_USES_GLEW) - // -- GLEW -#define CORE_PROFILE -#ifdef CORE_PROFILE - // this is the only way to initialize GLEW (before GLEW 1.13) - // correctly under core profile context. - glewExperimental = true; -#endif - GLenum status = glewInit(); - if (status != GLEW_OK) { - printf("Failed to initialize glew. Error = %s\n", - glewGetErrorString(status)); - return false; - } -#ifdef CORE_PROFILE - // clear GL errors which were generated during glewInit() - glGetError(); -#endif -#endif - return true; } bool libraryInitializeGL() { -#if defined(OSD_USES_INTERNAL_GLAPILOADER) return OpenSubdiv::internal::GLApi::glApiLoad(); -#else - // otherwise do nothing - return true; -#endif } diff --git a/glLoader/glLoader.h b/glLoader/glLoader.h index 3a4317251..36f9d4361 100644 --- a/glLoader/glLoader.h +++ b/glLoader/glLoader.h @@ -142,13 +142,6 @@ #include "glApi.h" #define OSD_OPENGL_HAS(token) (GLAPILOADER_GL_##token) - -#elif defined(OSD_USES_GLEW) - // -- GLEW - #include - - #define OSD_OPENGL_HAS(token) (GLEW_##token) - #endif namespace OpenSubdiv { diff --git a/opensubdiv/osd/opengl.h b/opensubdiv/osd/opengl.h index 989177a69..0dfb1711f 100644 --- a/opensubdiv/osd/opengl.h +++ b/opensubdiv/osd/opengl.h @@ -30,11 +30,7 @@ #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR #include #else - #if defined(OSD_USES_GLEW) - #include - #else - #include - #endif + #include #endif #elif defined(ANDROID) #include @@ -43,11 +39,7 @@ #define WIN32_LEAN_AND_MEAN #include #endif - #if defined(OSD_USES_GLEW) - #include - #else - #include - #endif + #include #endif #endif // OPENSUBDIV3_OSD_OPENGL_H