mirror of
https://github.com/PixarAnimationStudios/OpenSubdiv
synced 2024-11-08 21:30:06 +00:00
migrate osd_regression from GLUT to GLFW (this regression still needs work)
fixes #98
This commit is contained in:
parent
7a39b0ad7c
commit
055ab17357
@ -59,7 +59,7 @@ add_subdirectory(hbr_regression)
|
||||
|
||||
add_subdirectory(far_regression)
|
||||
|
||||
if( OPENGL_FOUND AND GLEW_FOUND AND GLUT_FOUND)
|
||||
if(OPENGL_FOUND AND GLEW_FOUND AND GLFW_FOUND)
|
||||
add_subdirectory(osd_regression)
|
||||
else()
|
||||
set(MISSING "")
|
||||
@ -72,7 +72,7 @@ else()
|
||||
list(APPEND MISSING glew)
|
||||
endif()
|
||||
|
||||
if (NOT GLUT_FOUND)
|
||||
if (NOT GLFW_FOUND)
|
||||
list(APPEND MISSING glut)
|
||||
endif()
|
||||
|
||||
@ -80,7 +80,7 @@ else()
|
||||
"The following libraries could not be found : ${MISSING}. "
|
||||
"The osd regression test will not be available. "
|
||||
"If you have these libraries installed, please specify their "
|
||||
"path to cmake (through the GLEW_LOCATION and GLUT_LOCATION "
|
||||
"path to cmake (through the GLEW_LOCATION and GLFW_LOCATION "
|
||||
"command line arguments or environment variables)."
|
||||
)
|
||||
endif()
|
||||
|
@ -58,104 +58,24 @@
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/opensubdiv
|
||||
${GLEW_INCLUDE_DIR}
|
||||
${GLUT_INCLUDE_DIR}
|
||||
${GLFW_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
set(PLATFORM_LIBRARIES
|
||||
${OSD_LINK_TARGET}
|
||||
${OPENGL_LIBRARY}
|
||||
${GLEW_LIBRARY}
|
||||
${GLFW_LIBRARIES}
|
||||
)
|
||||
|
||||
add_executable(osd_regression
|
||||
${SOURCE_FILES}
|
||||
)
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
if( PTEX_FOUND )
|
||||
list(APPEND SOURCE_FILES
|
||||
pTexture.cpp
|
||||
)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
pTexture.h
|
||||
)
|
||||
include_directories( ${PTEX_INCLUDE_DIR} )
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
${PTEX_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
if( OPENMP_FOUND )
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
gomp
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# GL code & dependencies
|
||||
# note : (GLSL compute kernels require GL 4.2, which excludes APPLE)
|
||||
if( OPENGL_FOUND AND GLEW_FOUND AND (NOT APPLE) )
|
||||
list(APPEND SOURCE_FILES
|
||||
glslDispatcher.cpp
|
||||
)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
glslDispatcher.h
|
||||
)
|
||||
list(APPEND KERNEL_FILES
|
||||
glslKernel.glsl
|
||||
)
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
${OPENGL_LIBRARY}
|
||||
${GLEW_LIBRARY}
|
||||
)
|
||||
else( OPENGL_FOUND AND APPLE )
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
${OPENGL_LIBRARY}
|
||||
)
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# OpenCL code & dependencies
|
||||
if ( OPENCL_FOUND )
|
||||
list(APPEND SOURCE_FILES
|
||||
clDispatcher.cpp
|
||||
)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
clDispatcher.h
|
||||
)
|
||||
list(APPEND KERNEL_FILES
|
||||
clKernel.cl
|
||||
)
|
||||
list(APPEND PLATFORM_LIBRARIES
|
||||
${OPENCL_LIBRARIES}
|
||||
)
|
||||
include_directories(${OPENCL_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# CUDA code & dependencies
|
||||
if( CUDA_FOUND )
|
||||
list(APPEND SOURCE_FILES
|
||||
cudaDispatcher.cpp
|
||||
)
|
||||
list(APPEND PUBLIC_HEADER_FILES
|
||||
cudaDispatcher.h
|
||||
)
|
||||
list(APPEND KERNEL_FILES
|
||||
cudaKernel.cu
|
||||
)
|
||||
if (UNIX)
|
||||
list( APPEND CUDA_NVCC_FLAGS -Xcompiler -fPIC )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
target_link_libraries(osd_regression
|
||||
${OSD_LINK_TARGET}
|
||||
${OPENGL_LIBRARY}
|
||||
${GLEW_LIBRARY}
|
||||
${GLUT_LIBRARIES}
|
||||
${PLATFORM_LIBRARIES}
|
||||
)
|
||||
|
@ -60,7 +60,13 @@
|
||||
#else
|
||||
#include <stdlib.h>
|
||||
#include <GL/glew.h>
|
||||
#include <GL/glut.h>
|
||||
#endif
|
||||
|
||||
#if defined(GLFW_VERSION_3)
|
||||
#include <GL/glfw3.h>
|
||||
GLFWwindow* g_window=0;
|
||||
#else
|
||||
#include <GL/glfw.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@ -346,10 +352,29 @@ int checkMesh( char const * msg, char const * shape, int levels, Scheme scheme=k
|
||||
//------------------------------------------------------------------------------
|
||||
int main(int argc, char ** argv) {
|
||||
|
||||
// Make sure we have an OpenGL context.
|
||||
glutInit(&argc, argv);
|
||||
glutCreateWindow("osd_regression");
|
||||
// Make sure we have an OpenGL context : create dummy GLFW window
|
||||
if (not glfwInit()) {
|
||||
printf("Failed to initialize GLFW\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const char windowTitle[] = "OpenSubdiv glViewer";
|
||||
|
||||
int width=10, height=10;
|
||||
|
||||
#if GLFW_VERSION_MAJOR>=3
|
||||
if (not (g_window=glfwCreateWindow(width, height, windowTitle, NULL, NULL))) {
|
||||
#else
|
||||
if (glfwOpenWindow(width, height, 8, 8, 8, 8, 24, 8,GLFW_WINDOW) == GL_FALSE) {
|
||||
#endif
|
||||
printf("Failed to open window.\n");
|
||||
glfwTerminate();
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if not defined(__APPLE__)
|
||||
glewInit();
|
||||
#endif
|
||||
|
||||
int levels=5, total=0;
|
||||
|
||||
@ -545,6 +570,8 @@ int main(int argc, char ** argv) {
|
||||
total += checkMesh( "test_bilinear_cube", bilinear_cube, levels, kBilinear );
|
||||
#endif
|
||||
|
||||
glfwTerminate();
|
||||
|
||||
if (total==0)
|
||||
printf("All tests passed.\n");
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user