├── Pangolin ├── CMakeLists.txt ├── CMakeModules │ ├── AndroidUtils.cmake │ ├── EmbedBinaryFiles.cmake │ ├── FindDC1394.cmake │ ├── FindDepthSense.cmake │ ├── FindEigen3.cmake │ ├── FindFFMPEG.cmake │ ├── FindFREEGLUT.cmake │ ├── FindGLEW.cmake │ ├── FindGLUES.cmake │ ├── FindOculus.cmake │ ├── FindOpenEXR.cmake │ ├── FindOpenNI.cmake │ ├── FindOpenNI2.cmake │ ├── FindPleora.cmake │ ├── FindROBOTVISION.cmake │ ├── FindTeliCam.cmake │ ├── FindTooN.cmake │ ├── FindXrandr.cmake │ ├── Findlibusb1.cmake │ ├── Findpthread.cmake │ ├── Finduvc.cmake │ └── SetPlatformVars.cmake ├── LICENCE ├── README.md ├── cmake_uninstall.cmake.in ├── examples │ ├── CMakeLists.txt │ ├── HelloPangolin │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── SimpleDisplay │ │ ├── CMakeLists.txt │ │ ├── app.cfg │ │ └── main.cpp │ ├── SimpleDisplayImage │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── SimpleMultiDisplay │ │ ├── CMakeLists.txt │ │ ├── app.cfg │ │ └── main.cpp │ ├── SimpleOculus │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── SimplePlot │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── SimpleRecord │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── SimpleRepeatVideo │ │ ├── CMakeLists.txt │ │ └── main.cpp │ ├── SimpleVideo │ │ ├── CMakeLists.txt │ │ └── main.cpp │ └── VBODisplay │ │ ├── CMakeLists.txt │ │ ├── kernal.cu │ │ └── main.cpp ├── external │ └── CMakeLists.txt ├── include │ └── pangolin │ │ ├── compat │ │ ├── bind.h │ │ ├── boostd.h │ │ ├── condition_variable.h │ │ ├── function.h │ │ ├── glconsole.h │ │ ├── glutbitmap.h │ │ ├── memory.h │ │ ├── mutex.h │ │ ├── ovr.h │ │ ├── thread.h │ │ └── type_traits.h │ │ ├── console │ │ ├── ConsoleInterpreter.h │ │ └── ConsoleView.h │ │ ├── display │ │ ├── attach.h │ │ ├── device │ │ │ ├── display_android.h │ │ │ └── display_glut.h │ │ ├── display.h │ │ ├── display_internal.h │ │ ├── opengl_render_state.h │ │ ├── user_app.h │ │ ├── view.h │ │ ├── viewport.h │ │ └── widgets │ │ │ └── widgets.h │ │ ├── gl │ │ ├── cg.h │ │ ├── colour.h │ │ ├── compat │ │ │ ├── gl2engine.h │ │ │ ├── gl2engine.h~ │ │ │ ├── gl_es_compat.h │ │ │ └── gl_es_compat.h~ │ │ ├── gl.h │ │ ├── gl.hpp │ │ ├── gl.hpp~ │ │ ├── glchar.h │ │ ├── glcuda.h │ │ ├── gldraw.h │ │ ├── glfont.h │ │ ├── glformattraits.h │ │ ├── glformattraits.h~ │ │ ├── glglut.h │ │ ├── glinclude.h │ │ ├── glinclude.h~ │ │ ├── glpangoglu.h │ │ ├── glpixformat.h │ │ ├── glpixformat.h~ │ │ ├── glplatform.h │ │ ├── glplatform.h~ │ │ ├── glsl.h │ │ ├── glstate.h │ │ ├── gltext.h │ │ ├── gltexturecache.h │ │ └── glvbo.h │ │ ├── handler │ │ ├── handler.h │ │ ├── handler_enums.h │ │ ├── handler_glbuffer.h │ │ └── handler_image.h │ │ ├── hud │ │ └── oculus_hud.h │ │ ├── image │ │ ├── image.h │ │ ├── image_common.h │ │ └── image_io.h │ │ ├── ios │ │ ├── PangolinAppDelegate.h │ │ └── PangolinUIView.h │ │ ├── log │ │ └── packetstream.h │ │ ├── pangolin.h │ │ ├── platform.h │ │ ├── plot │ │ ├── datalog.h │ │ ├── plotter.h │ │ └── range.h │ │ ├── python │ │ ├── PyInterpreter.h │ │ ├── PyModulePangolin.h │ │ ├── PyPangoIO.h │ │ ├── PyUniqueObj.h │ │ └── PyVar.h │ │ ├── utils │ │ ├── file_extension.h │ │ ├── file_utils.h │ │ ├── params.h │ │ ├── picojson.h │ │ ├── picojson.h~ │ │ ├── simple_math.h │ │ ├── threadedfilebuf.h │ │ ├── timer.h │ │ ├── type_convert.h │ │ ├── uri.h │ │ └── xml │ │ │ ├── license.txt │ │ │ ├── rapidxml.hpp │ │ │ ├── rapidxml_iterators.hpp │ │ │ ├── rapidxml_print.hpp │ │ │ └── rapidxml_utils.hpp │ │ ├── var │ │ ├── input_record_repeat.h │ │ ├── var.h │ │ ├── varextra.h │ │ ├── varstate.h │ │ ├── varvalue.h │ │ ├── varvaluegeneric.h │ │ ├── varvaluet.h │ │ └── varwrapper.h │ │ └── video │ │ ├── drivers │ │ ├── debayer.h │ │ ├── depthsense.h │ │ ├── ffmpeg.h │ │ ├── firewire.h │ │ ├── firewire_deinterlace.h │ │ ├── images.h │ │ ├── join.h │ │ ├── openni.h │ │ ├── openni2.h │ │ ├── openni_common.h │ │ ├── pango_video.h │ │ ├── pango_video_output.h │ │ ├── pleora.h │ │ ├── pvn_video.h │ │ ├── shift.h │ │ ├── teli.h │ │ ├── test.h │ │ ├── unpack.h │ │ ├── uvc.h │ │ ├── v4l.h │ │ └── video_splitter.h │ │ ├── video.h │ │ ├── video_output.h │ │ └── video_record_repeat.h ├── src │ ├── CMakeLists.txt │ ├── CMakeLists.txt~ │ ├── Doxyfile.in │ ├── PangolinConfig.cmake.in │ ├── PangolinConfigVersion.cmake.in │ ├── _embed_ │ │ └── fonts │ │ │ ├── AnonymousPro.ttf │ │ │ └── AnonymousPro.txt │ ├── config.h.in │ ├── console │ │ └── ConsoleView.cpp │ ├── display │ │ ├── device │ │ │ ├── display_android.cpp │ │ │ ├── display_glut.cpp │ │ │ ├── display_osx.mm │ │ │ ├── display_win.cpp │ │ │ └── display_x11.cpp │ │ ├── display.cpp │ │ ├── opengl_render_state.cpp │ │ ├── view.cpp │ │ ├── viewport.cpp │ │ └── widgets │ │ │ └── widgets.cpp │ ├── gl │ │ ├── compat │ │ │ ├── gl2engine.cpp │ │ │ └── gl2engine.cpp~ │ │ ├── glchar.cpp │ │ ├── glfont.cpp │ │ ├── glpangoglu.cpp │ │ ├── gltext.cpp │ │ ├── gltexturecache.cpp │ │ └── stb_truetype.h │ ├── handler │ │ ├── handler.cpp │ │ └── handler_glbuffer.cpp │ ├── hud │ │ └── oculus_hud.cpp │ ├── image │ │ ├── image_common.cpp │ │ └── image_io.cpp │ ├── ios │ │ ├── PangolinAppDelegate.mm │ │ └── PangolinUIView.mm │ ├── log │ │ └── packetstream.cpp │ ├── plot │ │ ├── datalog.cpp │ │ └── plotter.cpp │ ├── python │ │ └── PyInterpreter.cpp │ ├── utils │ │ ├── file_extension.cpp │ │ ├── file_utils.cpp │ │ ├── threadedfilebuf.cpp │ │ └── uri.cpp │ ├── var │ │ ├── input_record_repeat.cpp │ │ └── vars.cpp │ └── video │ │ ├── drivers │ │ ├── debayer.cpp │ │ ├── depthsense.cpp │ │ ├── ffmpeg.cpp │ │ ├── firewire.cpp │ │ ├── firewire_deinterlace.cpp │ │ ├── images.cpp │ │ ├── join.cpp │ │ ├── openni.cpp │ │ ├── openni2.cpp │ │ ├── pango_video.cpp │ │ ├── pango_video_output.cpp │ │ ├── pleora.cpp │ │ ├── pvn_video.cpp │ │ ├── shift.cpp │ │ ├── teli.cpp │ │ ├── test.cpp │ │ ├── unpack.cpp │ │ ├── uvc.cpp │ │ ├── v4l.cpp │ │ ├── v4l.cpp~ │ │ └── video_splitter.cpp │ │ ├── video.cpp │ │ ├── video_output.cpp │ │ └── video_record_repeat.cpp └── tools │ ├── CMakeLists.txt │ └── VideoViewer │ ├── CMakeLists.txt │ ├── application-x-pango.xml │ └── main.cpp ├── README.md └── android-cmake ├── AndroidNdkGdb.cmake ├── AndroidNdkModules.cmake ├── README.md ├── android.toolchain.cmake └── ndk_links.md /Pangolin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project("Pangolin") 3 | set(PANGOLIN_VERSION_MAJOR 0) 4 | set(PANGOLIN_VERSION_MINOR 3) 5 | set(PANGOLIN_VERSION ${PANGOLIN_VERSION_MAJOR}.${PANGOLIN_VERSION_MINOR}) 6 | 7 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/") 8 | 9 | include_directories(/usr/include/) 10 | 11 | # Platform configuration vars 12 | include(SetPlatformVars) 13 | 14 | option( BUILD_EXAMPLES "Build Examples" ON ) 15 | option( CPP11_NO_BOOST "Use c++11 over boost for threading etc." ON ) 16 | 17 | if(_WIN_) 18 | option( BUILD_SHARED_LIBS "Build Shared Library" OFF) 19 | option( BUILD_EXTERN_GLEW "Automatically download, build and compile GLEW" ON) 20 | option( BUILD_EXTERN_LIBPNG "Automatically download, build and compile libpng" ON) 21 | option( BUILD_EXTERN_LIBJPEG "Automatically download, build and compile libjpeg" ON) 22 | else() 23 | option( BUILD_SHARED_LIBS "Build Shared Library" ON) 24 | endif() 25 | 26 | if(CPP11_NO_BOOST AND NOT MSVC) 27 | set( CMAKE_CXX_FLAGS "-std=c++0x -Wall ${CMAKE_CXX_FLAGS}" ) 28 | if(_CLANG_) 29 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") 30 | endif() 31 | endif() 32 | 33 | if(ANDROID) 34 | set(ANDROID_PACKAGE_NAME "com.github.stevenlovegrove.pangolin") 35 | include(AndroidUtils) 36 | endif() 37 | 38 | if(ANDROID OR IOS) 39 | set(HAVE_GLES 1) 40 | option(BUILD_FOR_GLES_2 "Build for OpenGL ES 2 instead of ES 1" ON ) 41 | if(BUILD_FOR_GLES_2) 42 | set(HAVE_GLES_2 1) 43 | endif() 44 | endif() 45 | 46 | if(_OSX_) 47 | set(CMAKE_MACOSX_RPATH ON) 48 | endif() 49 | 50 | # Overide with cmake -DCMAKE_BUILD_TYPE=Debug {dir} 51 | if( NOT CMAKE_BUILD_TYPE AND NOT _WIN_ ) 52 | message("Build type not set (defaults to release)") 53 | message("-DCMAKE_BUILD_TYPE=Debug for debug") 54 | set( CMAKE_BUILD_TYPE Release ) 55 | endif() 56 | 57 | string(TOLOWER ${PROJECT_NAME} LIBRARY_NAME) 58 | 59 | # make an uninstall target 60 | configure_file( 61 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" 62 | "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" 63 | IMMEDIATE @ONLY 64 | ) 65 | 66 | add_custom_target(uninstall 67 | "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") 68 | 69 | add_subdirectory("external") 70 | add_subdirectory("src") 71 | 72 | if(BUILD_EXAMPLES) 73 | set(Pangolin_DIR ${Pangolin_BINARY_DIR}/src) 74 | add_subdirectory(examples) 75 | add_subdirectory(tools) 76 | endif() 77 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/EmbedBinaryFiles.cmake: -------------------------------------------------------------------------------- 1 | # Creates C resources file from files in given directory 2 | # Based on http://stackoverflow.com/a/27206982 3 | function(embed_binary_files file_glob output) 4 | # Create empty output file 5 | file(WRITE ${output} "") 6 | # Collect input files 7 | file(GLOB bins ${file_glob}) 8 | # Iterate through input files 9 | foreach(bin ${bins}) 10 | # Get short filename 11 | string(REGEX MATCH "([^/]+)$" filename ${bin}) 12 | # Replace filename spaces & extension separator for C compatibility 13 | string(REGEX REPLACE "\\.| " "_" filename ${filename}) 14 | # Read hex data from file 15 | file(READ ${bin} filedata HEX) 16 | # Convert hex data for C compatibility 17 | string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," filedata ${filedata}) 18 | # Append data to output file 19 | file(APPEND ${output} "const unsigned char ${filename}[] = {${filedata}};\nconst unsigned ${filename}_size = sizeof(${filename});\n") 20 | endforeach() 21 | endfunction() 22 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindDC1394.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the dc1394 v2 lib and include files 2 | # 3 | # DC1394_INCLUDE_DIR 4 | # DC1394_LIBRARIES 5 | # DC1394_FOUND 6 | 7 | FIND_PATH( DC1394_INCLUDE_DIR dc1394/control.h 8 | /usr/include 9 | /usr/local/include 10 | ) 11 | 12 | FIND_LIBRARY( DC1394_LIBRARY dc1394 13 | /usr/lib64 14 | /usr/lib 15 | /usr/local/lib 16 | ) 17 | 18 | IF(DC1394_INCLUDE_DIR AND DC1394_LIBRARY) 19 | SET( DC1394_FOUND TRUE ) 20 | SET( DC1394_LIBRARIES ${DC1394_LIBRARY} ) 21 | ENDIF(DC1394_INCLUDE_DIR AND DC1394_LIBRARY) 22 | 23 | IF(DC1394_FOUND) 24 | IF(NOT DC1394_FIND_QUIETLY) 25 | MESSAGE(STATUS "Found DC1394: ${DC1394_LIBRARY}") 26 | ENDIF(NOT DC1394_FIND_QUIETLY) 27 | ELSE(DC1394_FOUND) 28 | IF(DC1394_FIND_REQUIRED) 29 | MESSAGE(FATAL_ERROR "Could not find libdc1394") 30 | ENDIF(DC1394_FIND_REQUIRED) 31 | ENDIF(DC1394_FOUND) 32 | 33 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindDepthSense.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the DepthSense SDK For SoftKinetic Cameras 2 | # 3 | # DepthSense_INCLUDE_DIRS 4 | # DepthSense_LIBRARIES 5 | # DepthSense_FOUND 6 | 7 | FIND_PATH( DepthSense_INCLUDE_DIR DepthSense.hxx 8 | PATHS 9 | "${PROGRAM_FILES}/SoftKinetic/DepthSenseSDK/include" 10 | "${PROGRAM_FILES}/Meta/DepthSenseSDK/include" 11 | /usr/include 12 | /usr/local/include 13 | /opt/local/include 14 | /opt/softkinetic/DepthSenseSDK/include 15 | ) 16 | 17 | FIND_LIBRARY( DepthSense_LIBRARY DepthSense 18 | PATHS 19 | "${PROGRAM_FILES}/SoftKinetic/DepthSenseSDK/lib" 20 | "${PROGRAM_FILES}/Meta/DepthSenseSDK/lib" 21 | /usr/lib64 22 | /usr/lib 23 | /usr/local/lib 24 | /opt/local/lib 25 | /opt/softkinetic/DepthSenseSDK/lib 26 | ) 27 | 28 | IF(DepthSense_INCLUDE_DIR AND DepthSense_LIBRARY) 29 | SET( DepthSense_FOUND TRUE ) 30 | SET( DepthSense_LIBRARIES ${DepthSense_LIBRARY} ) 31 | SET( DepthSense_INCLUDE_DIRS ${DepthSense_INCLUDE_DIR} ) 32 | ENDIF() 33 | 34 | IF(DepthSense_FOUND) 35 | IF(NOT DepthSense_FIND_QUIETLY) 36 | MESSAGE(STATUS "Found DepthSense: ${DepthSense_LIBRARY}") 37 | ENDIF() 38 | ELSE() 39 | IF(DepthSense_FIND_REQUIRED) 40 | MESSAGE(FATAL_ERROR "Could not find DepthSense") 41 | ENDIF() 42 | ENDIF() 43 | 44 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindFFMPEG.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the ffmpeg libraries and headers for avcodec avformat swscale 2 | # 3 | # FFMPEG_INCLUDE_DIRS 4 | # FFMPEG_LIBRARIES 5 | # FFMPEG_FOUND 6 | 7 | # Find header files 8 | FIND_PATH( 9 | AVCODEC_INCLUDE_DIR libavcodec/avcodec.h 10 | /usr/include /usr/local/include /opt/local/include 11 | ) 12 | FIND_PATH( 13 | AVFORMAT_INCLUDE_DIR libavformat/avformat.h 14 | /usr/include /usr/local/include /opt/local/include 15 | ) 16 | FIND_PATH( 17 | AVUTIL_INCLUDE_DIR libavutil/avutil.h 18 | /usr/include /usr/local/include /opt/local/include 19 | ) 20 | FIND_PATH( 21 | SWSCALE_INCLUDE_DIR libswscale/swscale.h 22 | /usr/include /usr/local/include /opt/local/include 23 | ) 24 | 25 | # Find Library files 26 | FIND_LIBRARY( 27 | AVCODEC_LIBRARY 28 | NAMES avcodec 29 | PATH /usr/lib /usr/local/lib /opt/local/lib 30 | ) 31 | FIND_LIBRARY( 32 | AVFORMAT_LIBRARY 33 | NAMES avformat 34 | PATH /usr/lib /usr/local/lib /opt/local/lib 35 | ) 36 | FIND_LIBRARY( 37 | AVUTIL_LIBRARY 38 | NAMES avutil 39 | PATH /usr/lib /usr/local/lib /opt/local/lib 40 | ) 41 | FIND_LIBRARY( 42 | SWSCALE_LIBRARY 43 | NAMES swscale 44 | PATH /usr/lib /usr/local/lib /opt/local/lib 45 | ) 46 | 47 | IF( EXISTS "${AVUTIL_INCLUDE_DIR}/libavutil/pixdesc.h" ) 48 | SET( AVUTIL_HAVE_PIXDESC TRUE) 49 | endif() 50 | 51 | IF(AVCODEC_INCLUDE_DIR AND AVFORMAT_INCLUDE_DIR AND AVUTIL_INCLUDE_DIR AND SWSCALE_INCLUDE_DIR AND AVCODEC_LIBRARY AND AVFORMAT_LIBRARY AND AVUTIL_LIBRARY AND SWSCALE_LIBRARY AND AVUTIL_HAVE_PIXDESC) 52 | SET(FFMPEG_FOUND TRUE) 53 | SET(FFMPEG_LIBRARIES ${AVCODEC_LIBRARY} ${AVFORMAT_LIBRARY} ${AVUTIL_LIBRARY} ${SWSCALE_LIBRARY}) 54 | SET(FFMPEG_INCLUDE_DIRS ${AVCODEC_INCLUDE_DIR} ${AVFORMAT_INCLUDE_DIR} ${AVUTIL_INCLUDE_DIR} ${SWSCALE_INCLUDE_DIR}) 55 | 56 | include(CheckCXXSourceCompiles) 57 | 58 | CHECK_CXX_SOURCE_COMPILES( 59 | "#include \"${AVCODEC_INCLUDE_DIR}/libavformat/avformat.h\" 60 | int main() { 61 | &AVFormatContext::max_analyze_duration2; 62 | }" HAVE_FFMPEG_MAX_ANALYZE_DURATION2 63 | ) 64 | CHECK_CXX_SOURCE_COMPILES( 65 | "#include \"${AVCODEC_INCLUDE_DIR}/libavformat/avformat.h\" 66 | int main() { 67 | &avformat_alloc_output_context2; 68 | }" HAVE_FFMPEG_AVFORMAT_ALLOC_OUTPUT_CONTEXT2 69 | ) 70 | ENDIF() 71 | 72 | IF (FFMPEG_FOUND) 73 | IF (NOT FFMPEG_FIND_QUIETLY) 74 | MESSAGE(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}") 75 | ENDIF (NOT FFMPEG_FIND_QUIETLY) 76 | ELSE (FFMPEG_FOUND) 77 | IF (FFMPEG_FIND_REQUIRED) 78 | MESSAGE(FATAL_ERROR "Could not find FFMPEG") 79 | ENDIF (FFMPEG_FIND_REQUIRED) 80 | ENDIF (FFMPEG_FOUND) 81 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindFREEGLUT.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the FREEGLUT library 2 | # 3 | # FREEGLUT_INCLUDE_DIR 4 | # FREEGLUT_LIBRARY 5 | # FREEGLUT_FOUND 6 | 7 | FIND_PATH( 8 | FREEGLUT_INCLUDE_DIR GL/freeglut.h 9 | ${CMAKE_INCLUDE_PATH} 10 | $ENV{include} 11 | ${OPENGL_INCLUDE_DIR} 12 | /usr/include 13 | /usr/local/include 14 | ) 15 | 16 | SET(STORE_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) 17 | SET(CMAKE_FIND_FRAMEWORK NEVER) 18 | 19 | FIND_LIBRARY( 20 | FREEGLUT_LIBRARY 21 | NAMES freeglut_static freeglut glut 22 | PATH 23 | /opt/local/lib 24 | ${CMAKE_LIBRARY_PATH} 25 | $ENV{lib} 26 | /usr/lib 27 | /usr/local/lib 28 | ) 29 | 30 | SET(CMAKE_FIND_FRAMEWORK ${STORE_CMAKE_FIND_FRAMEWORK}) 31 | 32 | IF (FREEGLUT_INCLUDE_DIR AND FREEGLUT_LIBRARY) 33 | SET(FREEGLUT_FOUND TRUE) 34 | ENDIF (FREEGLUT_INCLUDE_DIR AND FREEGLUT_LIBRARY) 35 | 36 | IF (FREEGLUT_FOUND) 37 | IF (NOT FREEGLUT_FIND_QUIETLY) 38 | MESSAGE(STATUS "Found FREEGLUT: ${FREEGLUT_LIBRARY}") 39 | ENDIF (NOT FREEGLUT_FIND_QUIETLY) 40 | ELSE (FREEGLUT_FOUND) 41 | IF (FREEGLUT_FIND_REQUIRED) 42 | MESSAGE(FATAL_ERROR "Could not find FREEGLUT") 43 | ENDIF (FREEGLUT_FIND_REQUIRED) 44 | ENDIF (FREEGLUT_FOUND) 45 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindGLEW.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Try to find GLEW library and include path. 3 | # Once done this will define 4 | # 5 | # GLEW_FOUND 6 | # GLEW_INCLUDE_DIR 7 | # GLEW_LIBRARY 8 | # 9 | 10 | IF (WIN32) 11 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h 12 | $ENV{PROGRAMFILES}/GLEW/include 13 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/include 14 | DOC "The directory where GL/glew.h resides") 15 | FIND_LIBRARY( GLEW_LIBRARY 16 | NAMES glew GLEW glew32 glew32s 17 | PATHS 18 | $ENV{PROGRAMFILES}/GLEW/lib 19 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/bin 20 | ${PROJECT_SOURCE_DIR}/src/nvgl/glew/lib 21 | DOC "The GLEW library") 22 | ELSE (WIN32) 23 | FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h 24 | /usr/include 25 | /usr/local/include 26 | /sw/include 27 | /opt/local/include 28 | DOC "The directory where GL/glew.h resides") 29 | FIND_LIBRARY( GLEW_LIBRARY 30 | NAMES GLEW glew 31 | PATHS 32 | /usr/lib64 33 | /usr/lib 34 | /usr/local/lib64 35 | /usr/local/lib 36 | /sw/lib 37 | /opt/local/lib 38 | DOC "The GLEW library") 39 | ENDIF (WIN32) 40 | 41 | IF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY) 42 | SET( GLEW_FOUND TRUE ) 43 | ENDIF (GLEW_INCLUDE_DIR AND GLEW_LIBRARY) 44 | 45 | IF (GLEW_FOUND) 46 | IF (NOT GLEW_FIND_QUIETLY) 47 | MESSAGE(STATUS "Found GLEW: ${GLEW_LIBRARY}") 48 | ENDIF (NOT GLEW_FIND_QUIETLY) 49 | ELSE (GLEW_FOUND) 50 | IF (GLEW_FIND_REQUIRED) 51 | MESSAGE(FATAL_ERROR "Could not find GLEW") 52 | ENDIF (GLEW_FIND_REQUIRED) 53 | ENDIF (GLEW_FOUND) 54 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindGLUES.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the GLUES lib and include files 2 | # 3 | # GLUES_INCLUDE_DIR 4 | # GLUES_LIBRARIES 5 | # GLUES_FOUND 6 | 7 | FIND_PATH( GLUES_INCLUDE_DIR glues/glues.h 8 | /usr/include 9 | /usr/local/include 10 | /opt/include 11 | /opt/local/include 12 | ${CMAKE_INSTALL_PREFIX}/include 13 | ) 14 | 15 | FIND_LIBRARY( GLUES_LIBRARY glues 16 | /usr/lib64 17 | /usr/lib 18 | /usr/local/lib 19 | /opt/local/lib 20 | /opt/local/lib64 21 | ${CMAKE_INSTALL_PREFIX}/lib 22 | ) 23 | 24 | IF(GLUES_INCLUDE_DIR AND GLUES_LIBRARY) 25 | SET( GLUES_FOUND TRUE ) 26 | SET( GLUES_LIBRARIES ${GLUES_LIBRARY} ) 27 | ENDIF(GLUES_INCLUDE_DIR AND GLUES_LIBRARY) 28 | 29 | IF(GLUES_FOUND) 30 | IF(NOT GLUES_FIND_QUIETLY) 31 | MESSAGE(STATUS "Found GLUES: ${GLUES_LIBRARY}") 32 | ENDIF(NOT GLUES_FIND_QUIETLY) 33 | ELSE(GLUES_FOUND) 34 | IF(GLUES_FIND_REQUIRED) 35 | MESSAGE(FATAL_ERROR "Could not find GLUES") 36 | ENDIF(GLUES_FIND_REQUIRED) 37 | ENDIF(GLUES_FOUND) 38 | 39 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindOculus.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Oculus Rift SDK 2 | # 3 | # Oculus_FOUND - system has libuvc 4 | # Oculus_INCLUDE_DIRS - the libuvc include directories 5 | # Oculus_LIBRARIES - link these to use libuvc 6 | 7 | FIND_PATH( 8 | Oculus_INCLUDE_DIRS 9 | NAMES OVR.h 10 | PATHS 11 | ${CMAKE_SOURCE_DIR}/../LibOVR/Include 12 | ${CMAKE_SOURCE_DIR}/../OculusSDK/LibOVR/Include 13 | /usr/include/LibOVR/Include 14 | /usr/local/include/LibOVR/Include 15 | /opt/local/include/LibOVR/Include 16 | /usr/include/ 17 | /usr/local/include 18 | /opt/local/include 19 | ) 20 | 21 | FIND_LIBRARY( 22 | Oculus_LIBRARIES 23 | NAMES ovr 24 | PATHS 25 | ${CMAKE_SOURCE_DIR}/../LibOVR/Lib/MacOS/Release 26 | ${CMAKE_SOURCE_DIR}/../OculusSDK/LibOVR/Lib/Linux/Release/x86_64 27 | /usr/include/LibOVR/Lib 28 | /usr/local/include/LibOVR/Lib 29 | /opt/local/include/LibOVR/Lib 30 | /usr/lib 31 | /usr/local/lib 32 | /opt/local/lib 33 | ) 34 | 35 | IF(Oculus_INCLUDE_DIRS AND Oculus_LIBRARIES) 36 | IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 37 | find_library(CARBON_LIBRARIES NAMES Carbon) 38 | find_library(IOKIT_LIBRARIES NAMES IOKit) 39 | list(APPEND Oculus_LIBRARIES ${CARBON_LIBRARIES}) 40 | list(APPEND Oculus_LIBRARIES ${IOKIT_LIBRARIES}) 41 | SET(Oculus_FOUND TRUE) 42 | ELSEIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 43 | FIND_PACKAGE(Xrandr QUIET) 44 | IF( Xrandr_FOUND ) 45 | list(APPEND Oculus_LIBRARIES ${Xrandr_LIBRARIES} -ludev -lXrandr -lXinerama ) 46 | SET(Oculus_FOUND TRUE) 47 | ENDIF() 48 | ENDIF() 49 | ENDIF(Oculus_INCLUDE_DIRS AND Oculus_LIBRARIES) 50 | 51 | 52 | 53 | IF(Oculus_FOUND) 54 | IF(NOT Oculus_FIND_QUIETLY) 55 | MESSAGE(STATUS "Found Oculus: ${Oculus_LIBRARIES}") 56 | MESSAGE(STATUS "Found Oculus: ${Oculus_INCLUDE_DIRS}") 57 | ENDIF(NOT Oculus_FIND_QUIETLY) 58 | ELSE(Oculus_FOUND) 59 | message(STATUS "Oculus NOT found") 60 | IF(Oculus_FIND_REQUIRED) 61 | MESSAGE(FATAL_ERROR "Could not find Oculus") 62 | ENDIF(Oculus_FIND_REQUIRED) 63 | ENDIF(Oculus_FOUND) 64 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindOpenEXR.cmake: -------------------------------------------------------------------------------- 1 | # Try to find the OpenEXR v2 lib and include files 2 | # 3 | # OpenEXR_INCLUDE_DIR 4 | # OpenEXR_LIBRARIES 5 | # OpenEXR_FOUND 6 | 7 | FIND_PATH( OpenEXR_INCLUDE_DIR ImfHeader.h 8 | /usr/include 9 | /usr/local/include 10 | PATH_SUFFIXES OpenEXR 11 | ) 12 | 13 | FIND_LIBRARY( OpenEXR_LIBRARY IlmImf 14 | /usr/lib64 15 | /usr/lib 16 | /usr/local/lib 17 | ) 18 | 19 | IF(OpenEXR_INCLUDE_DIR AND OpenEXR_LIBRARY) 20 | SET( OpenEXR_FOUND TRUE ) 21 | SET( OpenEXR_LIBRARIES ${OpenEXR_LIBRARY} ) 22 | ENDIF() 23 | 24 | IF(OpenEXR_FOUND) 25 | IF(NOT OpenEXR_FIND_QUIETLY) 26 | MESSAGE(STATUS "Found OpenEXR: ${OpenEXR_LIBRARY}") 27 | ENDIF(NOT OpenEXR_FIND_QUIETLY) 28 | ELSE(OpenEXR_FOUND) 29 | IF(OpenEXR_FIND_REQUIRED) 30 | MESSAGE(FATAL_ERROR "Could not find libOpenEXR") 31 | ENDIF(OpenEXR_FIND_REQUIRED) 32 | ENDIF(OpenEXR_FOUND) 33 | 34 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindOpenNI.cmake: -------------------------------------------------------------------------------- 1 | # -*- mode: cmake; -*- 2 | ############################################################################### 3 | # Find OpenNI 4 | # 5 | # This sets the following variables: 6 | # OPENNI_FOUND - True if OPENNI was found. 7 | # OPENNI_INCLUDE_DIRS - Directories containing the OPENNI include files. 8 | # OPENNI_LIBRARIES - Libraries needed to use OPENNI. 9 | # OPENNI_DEFINITIONS - Compiler flags for OPENNI. 10 | # 11 | # File forked from augmented_dev, project of alantrrs 12 | # (https://github.com/alantrrs/augmented_dev). 13 | 14 | find_package(PkgConfig) 15 | if(${CMAKE_VERSION} VERSION_LESS 2.8.2) 16 | pkg_check_modules(PC_OPENNI openni-dev) 17 | else() 18 | pkg_check_modules(PC_OPENNI QUIET openni-dev) 19 | endif() 20 | 21 | set(OPENNI_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER}) 22 | 23 | #using the 64bit version of OpenNi if generating for 64bit 24 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 25 | set(PROGRAMFILES_ "$ENV{PROGRAMW6432}") 26 | set(OPENNI_SUFFIX "64") 27 | else(CMAKE_SIZEOF_VOID_P EQUAL 8) 28 | set(PROGRAMFILES_ "$ENV{PROGRAMFILES}") 29 | set(OPENNI_SUFFIX "") 30 | endif(CMAKE_SIZEOF_VOID_P EQUAL 8) 31 | 32 | #add a hint so that it can find it without the pkg-config 33 | find_path(OPENNI_INCLUDE_DIR XnStatus.h 34 | HINTS ${PC_OPENNI_INCLUDEDIR} ${PC_OPENNI_INCLUDE_DIRS} /usr/include/ni /usr/include/openni 35 | "${PROGRAMFILES_}/OpenNI/Include" 36 | PATH_SUFFIXES openni) 37 | #add a hint so that it can find it without the pkg-config 38 | find_library(OPENNI_LIBRARY 39 | NAMES OpenNI64 OpenNI 40 | HINTS ${PC_OPENNI_LIBDIR} ${PC_OPENNI_LIBRARY_DIRS} /usr/lib "${PROGRAMFILES_}/OpenNI/Lib${OPENNI_SUFFIX}") 41 | 42 | set(OPENNI_INCLUDE_DIRS ${OPENNI_INCLUDE_DIR}) 43 | set(OPENNI_LIBRARIES ${OPENNI_LIBRARY}) 44 | 45 | include(FindPackageHandleStandardArgs) 46 | find_package_handle_standard_args(OpenNI DEFAULT_MSG 47 | OPENNI_LIBRARY OPENNI_INCLUDE_DIR) 48 | 49 | mark_as_advanced(OPENNI_LIBRARY OPENNI_INCLUDE_DIR) 50 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindOpenNI2.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find OpenNI2 3 | # 4 | # This sets the following variables: 5 | # OPENNI2_FOUND - True if OPENNI was found. 6 | # OPENNI2_INCLUDE_DIRS - Directories containing the OPENNI include files. 7 | # OPENNI2_LIBRARIES - Libraries needed to use OPENNI. 8 | 9 | find_package(PkgConfig) 10 | if(${CMAKE_VERSION} VERSION_LESS 2.8.2) 11 | pkg_check_modules(PC_OPENNI openni2-dev) 12 | else() 13 | pkg_check_modules(PC_OPENNI QUIET openni2-dev) 14 | endif() 15 | 16 | set(OPENNI2_DEFINITIONS ${PC_OPENNI_CFLAGS_OTHER}) 17 | 18 | #add a hint so that it can find it without the pkg-config 19 | find_path(OPENNI2_INCLUDE_DIR OpenNI.h 20 | HINTS 21 | ${PC_OPENNI_INCLUDEDIR} 22 | ${PC_OPENNI_INCLUDE_DIRS} 23 | PATHS 24 | "${PROGRAM_FILES}/OpenNI2/Include" 25 | "${CMAKE_SOURCE_DIR}/../OpenNI2/Include" 26 | /usr/include 27 | /user/include 28 | PATH_SUFFIXES openni2 ni2 29 | ) 30 | 31 | if(${CMAKE_CL_64}) 32 | set(OPENNI_PATH_SUFFIXES lib64) 33 | else() 34 | set(OPENNI_PATH_SUFFIXES lib) 35 | endif() 36 | 37 | #add a hint so that it can find it without the pkg-config 38 | find_library(OPENNI2_LIBRARY 39 | NAMES OpenNI2 40 | HINTS 41 | ${PC_OPENNI_LIBDIR} 42 | ${PC_OPENNI_LIBRARY_DIRS} 43 | PATHS 44 | "${PROGRAM_FILES}}/OpenNI2/Redist" 45 | "${PROGRAM_FILES}/OpenNI2" 46 | "${CMAKE_SOURCE_DIR}/../OpenNI2/Bin/x64-Release" 47 | /usr/lib 48 | /user/lib 49 | PATH_SUFFIXES ${OPENNI_PATH_SUFFIXES} 50 | ) 51 | 52 | set(OPENNI2_INCLUDE_DIRS ${OPENNI2_INCLUDE_DIR}) 53 | set(OPENNI2_LIBRARIES ${OPENNI2_LIBRARY}) 54 | 55 | include(FindPackageHandleStandardArgs) 56 | find_package_handle_standard_args(OpenNI2 DEFAULT_MSG 57 | OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR) 58 | 59 | mark_as_advanced(OPENNI2_LIBRARY OPENNI2_INCLUDE_DIR) 60 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindROBOTVISION.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find librobotvision 2 | # 3 | # ROBOTVISION_FOUND - system has librobotvision 4 | # ROBOTVISION_INCLUDE_DIR - the librobotvision include directories 5 | # ROBOTVISION_LIBRARY - link these to use librobotvision 6 | 7 | FIND_PATH( 8 | ROBOTVISION_INCLUDE_DIR 9 | NAMES robotvision/bundle_adjuster.h 10 | PATHS ${CMAKE_SOURCE_DIR}/.. /usr/include/robotvision /usr/local/include/robotvision 11 | ) 12 | 13 | FIND_LIBRARY( 14 | ROBOTVISION_LIBRARY 15 | NAMES robotvision 16 | PATHS ${CMAKE_SOURCE_DIR}/../robotvision/release /usr/lib /usr/local/lib 17 | ) 18 | 19 | IF (ROBOTVISION_INCLUDE_DIR AND ROBOTVISION_LIBRARY) 20 | SET(ROBOTVISION_FOUND TRUE) 21 | ENDIF (ROBOTVISION_INCLUDE_DIR AND ROBOTVISION_LIBRARY) 22 | 23 | IF (ROBOTVISION_FOUND) 24 | IF (NOT ROBOTVISION_FIND_QUIETLY) 25 | MESSAGE(STATUS "Found ROBOTVISION: ${ROBOTVISION_LIBRARY}") 26 | ENDIF (NOT ROBOTVISION_FIND_QUIETLY) 27 | ELSE (ROBOTVISION_FOUND) 28 | IF (ROBOTVISION_FIND_REQUIRED) 29 | MESSAGE(FATAL_ERROR "Could not find ROBOTVISION") 30 | ENDIF (ROBOTVISION_FIND_REQUIRED) 31 | ENDIF (ROBOTVISION_FOUND) 32 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindTeliCam.cmake: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Find Toshiba TeliCam 3 | # 4 | # This sets the following variables: 5 | # TeliCam_FOUND - True if TeliCam was found. 6 | # TeliCam_INCLUDE_DIRS - Directories containing the TeliCam include files. 7 | # TeliCam_LIBRARIES - Libraries needed to use TeliCam. 8 | 9 | find_path( 10 | TeliCam_INCLUDE_DIR TeliCamApi.h 11 | PATHS 12 | "${PROGRAM_FILES}/Toshiba Teli/TeliCamSDK/TeliCamApi/Include" 13 | "${CMAKE_SOURCE_DIR}/../TeliCamSDK/TeliCamApi/Include" 14 | /usr/include 15 | /user/include 16 | PATH_SUFFIXES TeliCam 17 | ) 18 | 19 | if(${CMAKE_CL_64}) 20 | set(TELI_PATH_SUFFIXES x64) 21 | else() 22 | set(TELI_PATH_SUFFIXES x86) 23 | endif() 24 | 25 | find_library( 26 | TeliCamApi_LIBRARY 27 | NAMES TeliCamApi TeliCamApi64 28 | PATHS 29 | "${PROGRAM_FILES}/Toshiba Teli/TeliCamSDK/TeliCamApi/lib" 30 | "${CMAKE_SOURCE_DIR}/../TeliCamSDK/TeliCamApi/lib" 31 | /usr/lib 32 | /user/lib 33 | PATH_SUFFIXES ${TELI_PATH_SUFFIXES} 34 | ) 35 | 36 | find_library( 37 | TeliCamUtl_LIBRARY 38 | NAMES TeliCamUtl TeliCamUtl64 39 | PATHS 40 | "${PROGRAM_FILES}/Toshiba Teli/TeliCamSDK/TeliCamApi/lib" 41 | "${CMAKE_SOURCE_DIR}/../TeliCamSDK/TeliCamApi/lib" 42 | /usr/lib 43 | /user/lib 44 | PATH_SUFFIXES ${TELI_PATH_SUFFIXES} 45 | ) 46 | 47 | set(TeliCam_INCLUDE_DIRS ${TeliCam_INCLUDE_DIR}) 48 | set(TeliCam_LIBRARY "${TeliCamApi_LIBRARY}" "${TeliCamUtl_LIBRARY}") 49 | set(TeliCam_LIBRARIES ${TeliCam_LIBRARY}) 50 | 51 | include(FindPackageHandleStandardArgs) 52 | find_package_handle_standard_args( TeliCam 53 | FOUND_VAR TeliCam_FOUND 54 | REQUIRED_VARS TeliCamApi_LIBRARY TeliCamUtl_LIBRARY TeliCam_INCLUDE_DIR 55 | ) 56 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindTooN.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libTooN 2 | # 3 | # TooN_FOUND - system has libTooN 4 | # TooN_INCLUDE_DIR - the libTooN include directories 5 | 6 | FIND_PATH( 7 | TooN_INCLUDE_DIR 8 | NAMES TooN/TooN.h 9 | PATHS 10 | ${CMAKE_SOURCE_DIR} 11 | ${CMAKE_SOURCE_DIR}/.. 12 | /usr/include 13 | /usr/local/include 14 | ) 15 | 16 | IF(TooN_INCLUDE_DIR) 17 | SET(TooN_FOUND TRUE) 18 | ENDIF() 19 | 20 | IF(TooN_FOUND) 21 | IF(NOT TooN_FIND_QUIETLY) 22 | MESSAGE(STATUS "Found TooN: ${TooN_INCLUDE_DIR}") 23 | ENDIF() 24 | ELSE() 25 | IF(TooN_FIND_REQUIRED) 26 | MESSAGE(FATAL_ERROR "Could not find TooN") 27 | ENDIF() 28 | ENDIF() 29 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/FindXrandr.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Xrandr 2 | # 3 | # Xrandr_FOUND - system has libXrandr 4 | # Xrandr_INCLUDE_DIRS - the libXrandr include directories 5 | # Xrandr_LIBRARIES - link these to use libXrandr 6 | 7 | FIND_PATH( 8 | Xrandr_INCLUDE_DIRS 9 | NAMES X11/extensions/Xrandr.h 10 | PATH_SUFFIXES X11/extensions 11 | DOC "The Xrandr include directory" 12 | ) 13 | 14 | FIND_LIBRARY( 15 | Xrandr_LIBRARIES 16 | NAMES Xrandr 17 | DOC "The Xrandr library" 18 | ) 19 | 20 | IF (Xrandr_INCLUDE_DIRS AND Xrandr_LIBRARIES) 21 | SET(Xrandr_FOUND TRUE) 22 | ENDIF (Xrandr_INCLUDE_DIRS AND Xrandr_LIBRARIES) 23 | 24 | IF (Xrandr_FOUND) 25 | IF (NOT Xrandr_FIND_QUIETLY) 26 | MESSAGE(STATUS "Found Xrandr: ${Xrandr_LIBRARIES}") 27 | ENDIF (NOT Xrandr_FIND_QUIETLY) 28 | ELSE (Xrandr_FOUND) 29 | IF (Xrandr_FIND_REQUIRED) 30 | MESSAGE(FATAL_ERROR "Could not find Xrandr") 31 | ENDIF (Xrandr_FIND_REQUIRED) 32 | ENDIF (Xrandr_FOUND) 33 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/Findlibusb1.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find libusb1 2 | # 3 | # libusb1_FOUND - system has libusb1 4 | # libusb1_INCLUDE_DIRS - the libusb1 include directories 5 | # libusb1_LIBRARIES - link these to use libusb1 6 | 7 | FIND_PATH( 8 | libusb1_INCLUDE_DIRS 9 | NAMES libusb-1.0/libusb.h 10 | PATHS 11 | c:/dev/sysroot32/usr/include 12 | ${CMAKE_SOURCE_DIR}/../libusb1/include 13 | /usr/include/ 14 | /usr/local/include 15 | /opt/local/include 16 | ) 17 | 18 | FIND_LIBRARY( 19 | libusb1_LIBRARIES 20 | NAMES libusb-1.0 21 | PATHS 22 | c:/dev/sysroot32/usr/lib 23 | ${CMAKE_SOURCE_DIR}/../libusb1/lib 24 | /usr/lib 25 | /usr/local/lib 26 | /opt/local/lib 27 | ) 28 | 29 | IF(libusb1_INCLUDE_DIRS AND libusb1_LIBRARIES) 30 | SET(libusb1_FOUND TRUE) 31 | ENDIF(libusb1_INCLUDE_DIRS AND libusb1_LIBRARIES) 32 | 33 | IF(libusb1_FOUND) 34 | IF(NOT libusb1_FIND_QUIETLY) 35 | MESSAGE(STATUS "Found libusb1: ${libusb1_LIBRARIES}") 36 | ENDIF(NOT libusb1_FIND_QUIETLY) 37 | ELSE(libusb1_FOUND) 38 | message(STATUS "libusb1 NOT found") 39 | IF(libusb1_FIND_REQUIRED) 40 | MESSAGE(FATAL_ERROR "Could not find libusb1") 41 | ENDIF(libusb1_FIND_REQUIRED) 42 | ENDIF(libusb1_FOUND) 43 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/Findpthread.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find pthread 2 | # 3 | # pthread_FOUND - system has pthread 4 | # pthread_INCLUDE_DIRS - the pthread include directories 5 | # pthread_LIBRARIES - link these to use pthread 6 | 7 | FIND_PATH( 8 | pthread_INCLUDE_DIRS 9 | NAMES pthread.h 10 | PATHS 11 | c:/dev/sysroot32/usr/include 12 | ${CMAKE_SOURCE_DIR}/../pthread/include 13 | /usr/include/ 14 | /usr/local/include 15 | /opt/local/include 16 | ) 17 | 18 | FIND_LIBRARY( 19 | pthread_LIBRARIES 20 | NAMES pthreadVSE2 pthread 21 | PATHS 22 | c:/dev/sysroot32/usr/lib 23 | ${CMAKE_SOURCE_DIR}/../pthread/lib 24 | /usr/lib 25 | /usr/local/lib 26 | /opt/local/lib 27 | ) 28 | 29 | IF(pthread_INCLUDE_DIRS AND pthread_LIBRARIES) 30 | SET(pthread_FOUND TRUE) 31 | ENDIF(pthread_INCLUDE_DIRS AND pthread_LIBRARIES) 32 | 33 | IF(pthread_FOUND) 34 | IF(NOT pthread_FIND_QUIETLY) 35 | MESSAGE(STATUS "Found pthread: ${pthread_LIBRARIES}") 36 | ENDIF(NOT pthread_FIND_QUIETLY) 37 | ELSE(pthread_FOUND) 38 | message(STATUS "pthread NOT found") 39 | IF(pthread_FIND_REQUIRED) 40 | MESSAGE(FATAL_ERROR "Could not find pthread") 41 | ENDIF(pthread_FIND_REQUIRED) 42 | ENDIF(pthread_FOUND) 43 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/Finduvc.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find uvc 2 | # 3 | # uvc_FOUND - system has libuvc 4 | # uvc_INCLUDE_DIRS - the libuvc include directories 5 | # uvc_LIBRARIES - link these to use libuvc 6 | 7 | FIND_PATH( 8 | uvc_INCLUDE_DIRS 9 | NAMES libuvc/libuvc.h 10 | PATHS 11 | ${CMAKE_SOURCE_DIR}/.. 12 | /usr/include/ 13 | /usr/local/include 14 | /opt/local/include 15 | ) 16 | 17 | FIND_LIBRARY( 18 | uvc_LIBRARIES 19 | NAMES uvc 20 | PATHS 21 | ${CMAKE_SOURCE_DIR}/../uvc/build 22 | /usr/lib 23 | /usr/local/lib 24 | /opt/local/lib 25 | ) 26 | 27 | IF (uvc_INCLUDE_DIRS AND uvc_LIBRARIES) 28 | SET(uvc_FOUND TRUE) 29 | ENDIF (uvc_INCLUDE_DIRS AND uvc_LIBRARIES) 30 | 31 | IF (uvc_FOUND) 32 | IF (NOT uvc_FIND_QUIETLY) 33 | MESSAGE(STATUS "Found uvc: ${uvc_LIBRARIES}") 34 | ENDIF (NOT uvc_FIND_QUIETLY) 35 | ELSE (uvc_FOUND) 36 | IF (uvc_FIND_REQUIRED) 37 | MESSAGE(FATAL_ERROR "Could not find uvc") 38 | ENDIF (uvc_FIND_REQUIRED) 39 | ENDIF (uvc_FOUND) 40 | -------------------------------------------------------------------------------- /Pangolin/CMakeModules/SetPlatformVars.cmake: -------------------------------------------------------------------------------- 1 | ## Compiler configuration 2 | IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) 3 | SET(_GCC_ 1) 4 | ENDIF() 5 | 6 | IF(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") 7 | SET(_CLANG_ 1) 8 | ENDIF() 9 | 10 | IF(MSVC) 11 | SET(_MSVC_ 1) 12 | ENDIF() 13 | 14 | ## Platform configuration 15 | 16 | IF(WIN32 OR WIN64) 17 | SET(_WIN_ 1) 18 | ENDIF() 19 | 20 | IF(UNIX) 21 | SET(_UNIX_ 1) 22 | ENDIF() 23 | 24 | IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 25 | SET(_OSX_ 1) 26 | ENDIF() 27 | 28 | IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux") 29 | SET(_LINUX_ 1) 30 | ENDIF() 31 | 32 | IF(ANDROID) 33 | SET(_ANDROID_ 1) 34 | ENDIF() 35 | 36 | IF(IOS) 37 | SET(_APPLE_IOS_ 1) 38 | ENDIF() 39 | 40 | 41 | 42 | ## Default search paths 43 | 44 | IF(_WIN_) 45 | IF(${CMAKE_CL_64}) 46 | LIST(APPEND CMAKE_INCLUDE_PATH "c:/dev/sysroot64/usr/include") 47 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot64/usr/lib") 48 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot64/usr/bin") 49 | set(PROGRAM_FILES "$ENV{PROGRAMW6432}" ) 50 | ELSE() 51 | LIST(APPEND CMAKE_INCLUDE_PATH "c:/dev/sysroot32/usr/include") 52 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot32/usr/lib") 53 | LIST(APPEND CMAKE_LIBRARY_PATH "c:/dev/sysroot32/usr/bin") 54 | set(PROGRAM_FILES "$ENV{PROGRAMFILES}" ) 55 | ENDIF() 56 | ENDIF() 57 | -------------------------------------------------------------------------------- /Pangolin/LICENCE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Steven Lovegrove and Richard Newcombe 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /Pangolin/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------- 2 | # File that provides "make uninstall" target 3 | # We use the file 'install_manifest.txt' 4 | # ----------------------------------------------- 5 | IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 6 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") 7 | ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 8 | 9 | FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 10 | STRING(REGEX REPLACE "\n" ";" files "${files}") 11 | FOREACH(file ${files}) 12 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 13 | IF(EXISTS "$ENV{DESTDIR}${file}") 14 | EXEC_PROGRAM( 15 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 16 | OUTPUT_VARIABLE rm_out 17 | RETURN_VALUE rm_retval 18 | ) 19 | IF(NOT "${rm_retval}" STREQUAL 0) 20 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 21 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 22 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 23 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 24 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 25 | ENDFOREACH(file) 26 | -------------------------------------------------------------------------------- /Pangolin/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #find_package(CUDA QUIET) 2 | find_package(Oculus QUIET) 3 | 4 | # All examples depend on Pangolin GUI 5 | if(BUILD_PANGOLIN_GUI) 6 | add_subdirectory(HelloPangolin) 7 | add_subdirectory(SimpleMultiDisplay) 8 | add_subdirectory(SimpleDisplayImage) 9 | 10 | if(NOT HAVE_GLES OR HAVE_GLES_2) 11 | add_subdirectory(SimplePlot) 12 | endif() 13 | 14 | ## These samples require Pangolin Var support 15 | if(BUILD_PANGOLIN_VARS) 16 | add_subdirectory(SimpleDisplay) 17 | 18 | ## Video Samples require Pangolin Video support 19 | if(BUILD_PANGOLIN_VIDEO) 20 | add_subdirectory(SimpleVideo) 21 | add_subdirectory(SimpleRecord) 22 | add_subdirectory(SimpleRepeatVideo) 23 | endif() 24 | 25 | # if(Oculus_FOUND) 26 | # add_subdirectory(SimpleOculus) 27 | # endif() 28 | 29 | # This sample fails on many platforms, so exclude it for now, 30 | # until we can create a better cmake test for support. 31 | # ## VBODisplay Sample requires CUDA 32 | # if( CUDA_FOUND ) 33 | # add_subdirectory(VBODisplay) 34 | # endif() 35 | endif() 36 | endif() 37 | -------------------------------------------------------------------------------- /Pangolin/examples/HelloPangolin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(HelloPangolin main.cpp) 6 | target_link_libraries(HelloPangolin ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/HelloPangolin/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main( int /*argc*/, char** /*argv*/ ) 4 | { 5 | pangolin::CreateWindowAndBind("Main",640,480); 6 | glEnable(GL_DEPTH_TEST); 7 | 8 | // Define Projection and initial ModelView matrix 9 | pangolin::OpenGlRenderState s_cam( 10 | pangolin::ProjectionMatrix(640,480,420,420,320,240,0.2,100), 11 | pangolin::ModelViewLookAt(-2,2,-2, 0,0,0, pangolin::AxisY) 12 | ); 13 | 14 | // Create Interactive View in window 15 | pangolin::Handler3D handler(s_cam); 16 | pangolin::View& d_cam = pangolin::CreateDisplay() 17 | .SetBounds(0.0, 1.0, 0.0, 1.0, -640.0f/480.0f) 18 | .SetHandler(&handler); 19 | 20 | while( !pangolin::ShouldQuit() ) 21 | { 22 | // Clear screen and activate view to render into 23 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 24 | d_cam.Activate(s_cam); 25 | 26 | // Render OpenGL Cube 27 | pangolin::glDrawColouredCube(); 28 | 29 | // Swap frames and Process Events 30 | pangolin::FinishFrame(); 31 | } 32 | 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleDisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleDisplay main.cpp) 6 | target_link_libraries(SimpleDisplay ${Pangolin_LIBRARIES} ) 7 | 8 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleDisplay/app.cfg: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Pangolin Sample configuration file 3 | % Comments start with '%' or '#' 4 | % 5 | % Declarations are name value pairs, 6 | % seperated with '=' and terminated with ';' 7 | 8 | % We can set any variable referenced in code directly 9 | ui.A Double = 3.2; 10 | ui.A Checkbox = false; 11 | 12 | % We can set unreferenced variables too 13 | a.b = 1; 14 | a.c = 2; 15 | z.b = 3; 16 | z.c = 4; 17 | start = z; 18 | 19 | % Which we might refer to by reference 20 | ui.An Int = ${${start}.c}; 21 | 22 | % Declarations can span multiple lines 23 | M = 24 | [1, 0, 0 25 | 0, 1, 0 26 | 0, 0, 1]; 27 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleDisplayImage/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleDisplayImage main.cpp) 6 | target_link_libraries(SimpleDisplayImage ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleDisplayImage/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void setImageData(unsigned char * imageArray, int size){ 6 | for(int i = 0 ; i < size;i++) { 7 | imageArray[i] = (unsigned char)(rand()/(RAND_MAX/255.0)); 8 | } 9 | } 10 | 11 | int main( int /*argc*/, char* argv[] ) 12 | { 13 | // Create OpenGL window in single line 14 | pangolin::CreateWindowAndBind("Main",640,480); 15 | 16 | // 3D Mouse handler requires depth testing to be enabled 17 | glEnable(GL_DEPTH_TEST); 18 | 19 | pangolin::OpenGlRenderState s_cam( 20 | pangolin::ProjectionMatrix(640,480,420,420,320,240,0.1,1000), 21 | pangolin::ModelViewLookAt(-1,1,-1, 0,0,0, pangolin::AxisY) 22 | ); 23 | 24 | // Aspect ratio allows us to constrain width and height whilst fitting within specified 25 | // bounds. A positive aspect ratio makes a view 'shrink to fit' (introducing empty bars), 26 | // whilst a negative ratio makes the view 'grow to fit' (cropping the view). 27 | pangolin::View& d_cam = pangolin::Display("cam") 28 | .SetBounds(0,1.0f,0,1.0f,-640/480.0) 29 | .SetHandler(new pangolin::Handler3D(s_cam)); 30 | 31 | // This view will take up no more than a third of the windows width or height, and it 32 | // will have a fixed aspect ratio to match the image that it will display. When fitting 33 | // within the specified bounds, push to the top-left (as specified by SetLock). 34 | pangolin::View& d_image = pangolin::Display("image") 35 | .SetBounds(2/3.0f,1.0f,0,1/3.0f,640.0/480) 36 | .SetLock(pangolin::LockLeft, pangolin::LockTop); 37 | 38 | std::cout << "Resize the window to experiment with SetBounds, SetLock and SetAspect." << std::endl; 39 | std::cout << "Notice that the cubes aspect is maintained even though it covers the whole screen." << std::endl; 40 | 41 | const int width = 64; 42 | const int height = 48; 43 | 44 | unsigned char* imageArray = new unsigned char[3*width*height]; 45 | pangolin::GlTexture imageTexture(width,height,GL_RGB,false,0,GL_RGB,GL_UNSIGNED_BYTE); 46 | 47 | // Default hooks for exiting (Esc) and fullscreen (tab). 48 | while(!pangolin::ShouldQuit()) 49 | { 50 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 51 | 52 | d_cam.Activate(s_cam); 53 | 54 | glColor3f(1.0,1.0,1.0); 55 | pangolin::glDrawColouredCube(); 56 | 57 | //Set some random image data and upload to GPU 58 | setImageData(imageArray,3*width*height); 59 | imageTexture.Upload(imageArray,GL_RGB,GL_UNSIGNED_BYTE); 60 | 61 | //display the image 62 | d_image.Activate(); 63 | glColor3f(1.0,1.0,1.0); 64 | imageTexture.RenderToViewport(); 65 | 66 | pangolin::FinishFrame(); 67 | } 68 | 69 | delete[] imageArray; 70 | 71 | return 0; 72 | } 73 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleMultiDisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleMultiDisplay main.cpp) 6 | target_link_libraries(SimpleMultiDisplay ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleMultiDisplay/app.cfg: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | % Pangolin Sample configuration file 3 | % Comments start with '%' or '#' 4 | % 5 | % Declarations are name value pairs, 6 | % seperated with '=' and terminated with ';' 7 | 8 | % We can set any variable referenced in code directly 9 | ui.A Double = 3.2; 10 | 11 | % We can set unreferenced variables too 12 | a.b = 1; 13 | a.c = 2; 14 | z.b = 3; 15 | z.c = 4; 16 | start = z; 17 | 18 | % Which we might refer to by reference 19 | ui.An Int = ${${start}.c}; 20 | 21 | % Declarations can span multiple lines 22 | M = 23 | [1, 0, 0 24 | 0, 1, 0 25 | 0, 0, 1]; 26 | 27 | ui.Aliased Double = @ui.A Double; 28 | ui.Aliased Double = 2.0; 29 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleOculus/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleOculus main.cpp) 6 | target_link_libraries(SimpleOculus ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleOculus/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // This Oculus sample is experimental - the OculusHud API is subject to change. 6 | int main(int argc, char ** argv) { 7 | pangolin::CreateWindowAndBind("Main",640,480); 8 | glEnable(GL_DEPTH_TEST); 9 | 10 | pangolin::OculusHud oculus; 11 | pangolin::OpenGlRenderState s_cam = oculus.DefaultRenderState(); 12 | s_cam.SetModelViewMatrix(pangolin::ModelViewLookAt(-1.5,1.5,-1.5, 0,0,0, pangolin::AxisY)); 13 | oculus.SetHandler(new pangolin::Handler3DFramebuffer(oculus.Framebuffer(), s_cam)); 14 | 15 | // Create Pangolin panel (displayed in both views) with sample input variables. 16 | oculus.CommonView().AddDisplay( 17 | pangolin::CreatePanel("ui") 18 | .SetBounds(0.0, 0.6, pangolin::Attach::Pix(150), pangolin::Attach::Pix(-150)) 19 | ); 20 | pangolin::RegisterKeyPressCallback(' ', boostd::bind(&pangolin::View::ToggleShow, boostd::ref(oculus.CommonView()) ) ); 21 | pangolin::Var a_button("ui.A Button",false,false); 22 | pangolin::Var a_double("ui.A Double",3,0,5); 23 | pangolin::Var an_int("ui.An Int",2,0,5); 24 | 25 | while( !pangolin::ShouldQuit() ) 26 | { 27 | // Update modelview matrix with head transform 28 | s_cam.GetModelViewMatrix() = oculus.HeadTransformDelta() * s_cam.GetModelViewMatrix(); 29 | 30 | oculus.Framebuffer().Bind(); 31 | glClearColor(1,1,1,0); 32 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 33 | for(unsigned int view = 0; view < oculus.NumEyes(); ++view) 34 | { 35 | oculus[view].Activate(); 36 | s_cam.ApplyNView(view); 37 | pangolin::glDrawColouredCube(); 38 | } 39 | oculus.Framebuffer().Unbind(); 40 | 41 | pangolin::FinishFrame(); 42 | } 43 | 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Pangolin/examples/SimplePlot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimplePlot main.cpp) 6 | target_link_libraries(SimplePlot ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/SimplePlot/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main( int /*argc*/, char* argv[] ) 6 | { 7 | // Create OpenGL window in single line 8 | pangolin::CreateWindowAndBind("Main",640,480); 9 | 10 | // Data logger object 11 | pangolin::DataLog log; 12 | 13 | // Optionally add named labels 14 | std::vector labels; 15 | labels.push_back(std::string("sin(t)")); 16 | labels.push_back(std::string("cos(t)")); 17 | labels.push_back(std::string("sin(t)+cos(t)")); 18 | log.SetLabels(labels); 19 | 20 | const double tinc = 0.01; 21 | 22 | // OpenGL 'view' of data. We might have many views of the same data. 23 | pangolin::Plotter plotter(&log,0,4*M_PI/tinc,-2,2,M_PI/(4*tinc),0.5); 24 | plotter.SetBounds(0.0, 1.0, 0.0, 1.0); 25 | plotter.Track("$i"); 26 | 27 | pangolin::DisplayBase().AddDisplay(plotter); 28 | 29 | float t = 0; 30 | 31 | // Default hooks for exiting (Esc) and fullscreen (tab). 32 | while( !pangolin::ShouldQuit() ) 33 | { 34 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 35 | 36 | log.Log(sin(t),cos(t),sin(t)+cos(t)); 37 | t += tinc; 38 | 39 | // Render graph, Swap frames and Process Events 40 | pangolin::FinishFrame(); 41 | } 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleRecord/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleRecord main.cpp) 6 | target_link_libraries(SimpleRecord ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleRepeatVideo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleRepeatVideo main.cpp) 6 | target_link_libraries(SimpleRepeatVideo ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/SimpleVideo/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(SimpleVideo main.cpp) 6 | target_link_libraries(SimpleVideo ${Pangolin_LIBRARIES}) 7 | -------------------------------------------------------------------------------- /Pangolin/examples/VBODisplay/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | link_directories(${Pangolin_LIBRARY_DIRS}) 5 | link_libraries(${Pangolin_LIBRARIES}) 6 | 7 | find_package(CUDA QUIET) 8 | 9 | # This example could be made to work with C++11, but the kernel code must be 10 | # compiled without it. 11 | if(CUDA_FOUND) 12 | cuda_include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 13 | 14 | cuda_add_executable( 15 | VBODisplay 16 | main.cpp kernal.cu 17 | ) 18 | 19 | endif() 20 | -------------------------------------------------------------------------------- /Pangolin/examples/VBODisplay/kernal.cu: -------------------------------------------------------------------------------- 1 | // Colour Sine wave Kernal 2 | // Based on kernal_colour in kernelVBO.cpp by Rob Farber 3 | __global__ void kernel(float4* dVertexArray, uchar4 *dColorArray, 4 | unsigned int width, unsigned int height, float time) 5 | { 6 | unsigned int x = blockIdx.x*blockDim.x + threadIdx.x; 7 | unsigned int y = blockIdx.y*blockDim.y + threadIdx.y; 8 | 9 | // Each thread is unique point (u,v) in interval [-1,1],[-1,1] 10 | const float u = 2.0f* (x/(float)width) - 1.0f; 11 | const float v = 2.0f* (y/(float)height) - 1.0f; 12 | const float w = 0.5f * sinf(4.0f*u + time) * cosf(4.0f*v + time); 13 | 14 | // Update vertex array for point 15 | dVertexArray[y*width+x] = make_float4(u, w, v, 1.0f); 16 | 17 | // Update colour array for point 18 | dColorArray[y*width+x].w = 0.0f; 19 | dColorArray[y*width+x].x = 255.0f *0.5f*(1.f+sinf(w+x)); 20 | dColorArray[y*width+x].y = 255.0f *0.5f*(1.f+sinf(x)*cosf(y)); 21 | dColorArray[y*width+x].z = 255.0f *0.5f*(1.f+sinf(w+time/10.0f)); 22 | } 23 | 24 | extern "C" void launch_kernel(float4* dVertexArray, uchar4* dColourArray, 25 | unsigned int width, unsigned int height, float time) 26 | { 27 | dim3 block(8, 8, 1); 28 | dim3 grid(width / block.x, height / block.y, 1); 29 | kernel<<< grid, block>>>(dVertexArray, dColourArray, width, height, time); 30 | } 31 | -------------------------------------------------------------------------------- /Pangolin/examples/VBODisplay/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | using namespace pangolin; 14 | using namespace std; 15 | 16 | // Mesh size 17 | const int mesh_width=256; 18 | const int mesh_height=256; 19 | 20 | extern "C" void launch_kernel(float4* dVertexArray, uchar4* dColourArray, unsigned int width, unsigned int height, float time); 21 | 22 | int main( int /*argc*/, char* argv[] ) 23 | { 24 | // cudaGLSetGLDevice(0); 25 | 26 | pangolin::CreateWindowAndBind("Main",640,480); 27 | glewInit(); 28 | 29 | // 3D Mouse handler requires depth testing to be enabled 30 | glEnable(GL_DEPTH_TEST); 31 | 32 | // Create vertex and colour buffer objects and register them with CUDA 33 | GlBufferCudaPtr vertex_array( 34 | GlArrayBuffer, mesh_width*mesh_height, GL_FLOAT, 4, 35 | cudaGraphicsMapFlagsWriteDiscard, GL_STREAM_DRAW 36 | ); 37 | GlBufferCudaPtr colour_array( 38 | GlArrayBuffer, mesh_width*mesh_height, GL_UNSIGNED_BYTE, 4, 39 | cudaGraphicsMapFlagsWriteDiscard, GL_STREAM_DRAW 40 | ); 41 | 42 | // Define Camera Render Object (for view / scene browsing) 43 | pangolin::OpenGlRenderState s_cam( 44 | ProjectionMatrix(640,480,420,420,320,240,0.1,1000), 45 | ModelViewLookAt(-0,2,-2, 0,0,0, AxisY) 46 | ); 47 | const int UI_WIDTH = 180; 48 | 49 | // Add named OpenGL viewport to window and provide 3D Handler 50 | View& d_cam = pangolin::Display("cam") 51 | .SetBounds(0.0, 1.0, Attach::Pix(UI_WIDTH), 1.0, -640.0f/480.0f) 52 | .SetHandler(new Handler3D(s_cam)); 53 | 54 | // Add named Panel and bind to variables beginning 'ui' 55 | // A Panel is just a View with a default layout and input handling 56 | View& d_panel = pangolin::CreatePanel("ui") 57 | .SetBounds(0.0, 1.0, 0.0, Attach::Pix(UI_WIDTH)); 58 | 59 | // Default hooks for exiting (Esc) and fullscreen (tab). 60 | for(int frame=0; !pangolin::ShouldQuit(); ++frame) 61 | { 62 | static double time = 0; 63 | static Var delta("ui.time delta", 0.001, 0, 0.005); 64 | 65 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 66 | 67 | d_cam.Activate(s_cam); 68 | glColor3f(1.0,1.0,1.0); 69 | 70 | { 71 | CudaScopedMappedPtr var(vertex_array); 72 | CudaScopedMappedPtr car(colour_array); 73 | launch_kernel((float4*)*var,(uchar4*)*car,mesh_width,mesh_height,time); 74 | time += delta; 75 | } 76 | 77 | pangolin::RenderVboCbo(vertex_array, colour_array); 78 | 79 | // Swap frames and Process Events 80 | pangolin::FinishFrame(); 81 | } 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/bind.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_BIND_H 29 | #define PANGOLIN_COMPAT_BIND_H 30 | 31 | #include 32 | 33 | #ifdef CPP11_NO_BOOST 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | #include 40 | 41 | #endif // PANGOLIN_COMPAT_BIND_H 42 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/boostd.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_BOOSTD_H 29 | #define PANGOLIN_COMPAT_BOOSTD_H 30 | 31 | #include 32 | 33 | #ifdef CPP11_NO_BOOST 34 | namespace boostd = std; 35 | #else 36 | namespace boostd = boost; 37 | #endif 38 | 39 | #endif // PANGOLIN_COMPAT_MEMORY_H 40 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/condition_variable.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_CONDITION_VARIABLE_H 29 | #define PANGOLIN_COMPAT_CONDITION_VARIABLE_H 30 | 31 | #include 32 | 33 | #ifdef CPP11_NO_BOOST 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | #include 40 | 41 | #endif // PANGOLIN_COMPAT_CONDITION_VARIABLE_H 42 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/function.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_FUNCTION_H 29 | #define PANGOLIN_COMPAT_FUNCTION_H 30 | 31 | #include 32 | 33 | #ifdef CPP11_NO_BOOST 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | #include 40 | 41 | #endif // PANGOLIN_COMPAT_FUNCTION_H 42 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/glconsole.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_GLCONSOLE_H 29 | #define PANGOLIN_COMPAT_GLCONSOLE_H 30 | 31 | #include 32 | 33 | // If we don't have GLUT, coerce GLConsole to work with our own font rendering. 34 | #ifdef HAVE_GLES 35 | #include 36 | #include 37 | 38 | // Define our own GLFont class, preventing GLConsoles from being included. 39 | #define __GL_FONT_H__ 40 | 41 | class GLFont 42 | { 43 | public: 44 | void glPrintf(int x, int y, const char *fmt, ...) 45 | { 46 | glPushMatrix(); 47 | glTranslatef(x,y,1.0f); 48 | pangolin::GlFont::I().Text(fmt).Draw(); 49 | glPopMatrix(); 50 | } 51 | void glPrintf(int x, int y, const std::string fmt, ...){ glPrintf(x,y, fmt.c_str()); } 52 | void glPrintfFast(int x, int y, const char *fmt, ...) { glPrintf(x,y,fmt); } 53 | void glPrintfFast(int x, int y, const std::string fmt, ...){ glPrintfFast(x,y, fmt.c_str()); } 54 | unsigned int CharHeight() { return 10; } 55 | unsigned int CharWidth() { return 10; } 56 | }; 57 | 58 | // TODO: We should implement these or something... 59 | #define glPushAttrib(x) 60 | #define glPopAttrib(x) 61 | #define glutGetModifiers(x) (0) 62 | 63 | #define GLUT_ACTIVE_SHIFT 0 64 | #define GLUT_ACTIVE_CTRL 1 65 | #define GLUT_ACTIVE_ALT 2 66 | #define GLUT_KEY_UP 3 67 | #define GLUT_KEY_DOWN 4 68 | #define GLUT_KEY_LEFT 5 69 | #define GLUT_KEY_RIGHT 6 70 | #define GLUT_KEY_PAGE_UP 7 71 | #define GLUT_KEY_PAGE_DOWN 8 72 | #define GLUT_KEY_HOME 9 73 | #define GLUT_KEY_END 10 74 | 75 | #endif // HAVE_GLES 76 | 77 | #include 78 | 79 | #endif // PANGOLIN_COMPAT_GLCONSOLE_H 80 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/memory.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_MEMORY_H 29 | #define PANGOLIN_COMPAT_MEMORY_H 30 | 31 | #include 32 | 33 | #ifdef CPP11_NO_BOOST 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | #include 40 | 41 | #endif // PANGOLIN_COMPAT_MEMORY_H 42 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/mutex.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_MUTEX_H 29 | #define PANGOLIN_COMPAT_MUTEX_H 30 | 31 | #include 32 | 33 | #ifdef CPP11_NO_BOOST 34 | #include 35 | #else 36 | #include 37 | #endif 38 | 39 | #include 40 | 41 | #endif // PANGOLIN_COMPAT_MUTEX_H 42 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/ovr.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_OVR_H 29 | #define PANGOLIN_COMPAT_OVR_H 30 | 31 | #include 32 | 33 | #ifndef _MSVC_ 34 | // Suppress warnings in OVR library headers 35 | #pragma GCC system_header 36 | #endif 37 | 38 | #include 39 | 40 | #endif // PANGOLIN_COMPAT_OVR_H 41 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/compat/type_traits.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_COMPAT_TYPE_TRAITS_H 29 | #define PANGOLIN_COMPAT_TYPE_TRAITS_H 30 | 31 | #include 32 | 33 | #include 34 | 35 | #ifdef CPP11_NO_BOOST 36 | #include 37 | #else 38 | #include 39 | #endif 40 | 41 | #include 42 | 43 | // enable_if From Boost 44 | namespace pangolin 45 | { 46 | template 47 | struct enable_if_c { 48 | typedef T type; 49 | }; 50 | 51 | template 52 | struct enable_if_c {}; 53 | 54 | template 55 | struct enable_if : public enable_if_c {}; 56 | } 57 | 58 | #endif // PANGOLIN_COMPAT_TYPE_TRAITS_H 59 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/console/ConsoleInterpreter.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | enum ConsoleLineType 37 | { 38 | ConsoleLineTypeCmd, 39 | ConsoleLineTypeCmdOptions, 40 | ConsoleLineTypeStdout, 41 | ConsoleLineTypeStderr, 42 | ConsoleLineTypeOutput, 43 | ConsoleLineTypeHelp, 44 | }; 45 | 46 | class ConsoleLine 47 | { 48 | public: 49 | inline ConsoleLine() 50 | : linetype(ConsoleLineTypeCmd) 51 | { 52 | } 53 | 54 | inline ConsoleLine(std::string text, ConsoleLineType linetype = ConsoleLineTypeOutput) 55 | : text(text), linetype(linetype) 56 | { 57 | } 58 | 59 | std::string text; 60 | ConsoleLineType linetype; 61 | }; 62 | 63 | class ConsoleInterpreter 64 | { 65 | public: 66 | inline virtual ~ConsoleInterpreter() 67 | { 68 | } 69 | 70 | virtual void PushCommand(const std::string& cmd) = 0; 71 | 72 | virtual bool PullLine(ConsoleLine& line) = 0; 73 | 74 | virtual std::vector Complete( 75 | const std::string& cmd, int max_options = 20 76 | ) = 0; 77 | 78 | }; 79 | 80 | } 81 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/display/device/display_glut.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_DISPLAY_GLUT_H 29 | #define PANGOLIN_DISPLAY_GLUT_H 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | #ifndef GLUT_DOUBLE 37 | // Avoid pulling in all of glut just for these defines. 38 | #define GLUT_RGB 0x0000 39 | #define GLUT_RGBA 0x0000 40 | #define GLUT_INDEX 0x0001 41 | #define GLUT_SINGLE 0x0000 42 | #define GLUT_DOUBLE 0x0002 43 | #define GLUT_ACCUM 0x0004 44 | #define GLUT_ALPHA 0x0008 45 | #define GLUT_DEPTH 0x0010 46 | #define GLUT_STENCIL 0x0020 47 | #define GLUT_MULTISAMPLE 0x0080 48 | #define GLUT_STEREO 0x0100 49 | #define GLUT_LUMINANCE 0x0200 50 | #endif 51 | 52 | namespace pangolin 53 | { 54 | 55 | /// Create GLUT window and bind Pangolin to it. 56 | /// All GLUT initialisation is taken care of. This prevents you 57 | /// from needing to call BindToContext() and TakeGlutCallbacks(). 58 | PANGOLIN_EXPORT 59 | void CreateGlutWindowAndBind(std::string window_title, int w = 640, int h = 480, unsigned int mode = GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH ); 60 | 61 | /// Applies any post-render events if they are defined, 62 | /// swaps buffers and processes events. Also resets viewport to 63 | /// entire window and disables scissoring. 64 | PANGOLIN_EXPORT 65 | void FinishGlutFrame(); 66 | 67 | /// Swaps OpenGL Buffers and processes input events. 68 | PANGOLIN_EXPORT 69 | void SwapGlutBuffersProcessGlutEvents(); 70 | 71 | /// Allow Pangolin to take GLUT callbacks for its own uses. 72 | /// Not needed if you instantiated a window through CreateWindowAndBind(). 73 | PANGOLIN_EXPORT 74 | void TakeGlutCallbacks(); 75 | 76 | } 77 | 78 | #endif // PANGOLIN_DISPLAY_GLUT_H 79 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/display/user_app.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_USER_APP_H 29 | #define PANGOLIN_USER_APP_H 30 | 31 | namespace pangolin 32 | { 33 | 34 | class PANGOLIN_EXPORT UserApp 35 | { 36 | public: 37 | virtual ~UserApp() {} 38 | virtual void Init() {} 39 | virtual void Render() = 0; 40 | }; 41 | 42 | } 43 | 44 | #endif // PANGOLIN_USER_APP_H 45 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/display/viewport.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIEWPORT_H 29 | #define PANGOLIN_VIEWPORT_H 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | /// Encapsulates OpenGl Viewport. 37 | struct PANGOLIN_EXPORT Viewport 38 | { 39 | Viewport() {} 40 | Viewport(GLint l,GLint b,GLint w,GLint h) : l(l),b(b),w(w),h(h) {} 41 | 42 | void Activate() const; 43 | void ActivateIdentity() const; 44 | void ActivatePixelOrthographic() const; 45 | 46 | void Scissor() const; 47 | void ActivateAndScissor() const; 48 | 49 | bool Contains(int x, int y) const; 50 | 51 | Viewport Inset(int i) const; 52 | Viewport Inset(int horiz, int vert) const; 53 | Viewport Intersect(const Viewport& vp) const; 54 | 55 | static void DisableScissor(); 56 | 57 | GLint r() const { return l+w;} 58 | GLint t() const { return b+h;} 59 | GLfloat aspect() const { return (GLfloat)w / (GLfloat)h; } 60 | GLint l,b,w,h; 61 | }; 62 | 63 | } 64 | 65 | #endif // PANGOLIN_VIEWPORT_H 66 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/compat/gl_es_compat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifndef PANGOLIN_GL_ES_COMPAT_H 6 | #define PANGOLIN_GL_ES_COMPAT_H 7 | 8 | #define GLdouble GLfloat 9 | #define glClearDepth glClearDepthf 10 | #define glFrustum glFrustumf 11 | 12 | #define glColor4fv(a) glColor4f(a[0], a[1], a[2], a[3]) 13 | #define glColor3fv(a) glColor4f(a[0], a[1], a[2], 1.0f) 14 | #define glColor3f(a,b,c) glColor4f(a, b, c, 1.0f) 15 | 16 | #define GL_CLAMP GL_CLAMP_TO_EDGE 17 | 18 | #ifdef HAVE_GLES_2 19 | #define glGenFramebuffersEXT glGenFramebuffers 20 | #define glDeleteFramebuffersEXT glDeleteFramebuffers 21 | #define glBindFramebufferEXT glBindFramebuffer 22 | #define glDrawBuffers glDrawBuffers 23 | #define glFramebufferTexture2DEXT glFramebufferTexture2D 24 | #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER 25 | #define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT16 // <---- 26 | #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0 27 | #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT 28 | #else 29 | #define glOrtho glOrthof 30 | #define glGenFramebuffersEXT glGenFramebuffersOES 31 | #define glDeleteFramebuffersEXT glDeleteFramebuffersOES 32 | #define glBindFramebufferEXT glBindFramebufferOES 33 | #define glDrawBuffers glDrawBuffersOES 34 | #define glFramebufferTexture2DEXT glFramebufferTexture2DOES 35 | #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER_OES 36 | #define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES 37 | #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0_OES 38 | #endif 39 | 40 | #define glGetDoublev glGetFloatv 41 | 42 | #ifdef HAVE_GLES_2 43 | #include 44 | #endif 45 | 46 | inline void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) 47 | { 48 | GLfloat verts[] = { x1,y1, x2,y1, x2,y2, x1,y2 }; 49 | glEnableClientState(GL_VERTEX_ARRAY); 50 | glVertexPointer(2, GL_FLOAT, 0, verts); 51 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 52 | glDisableClientState(GL_VERTEX_ARRAY); 53 | } 54 | 55 | inline void glRecti(int x1, int y1, int x2, int y2) 56 | { 57 | GLfloat verts[] = { (float)x1,(float)y1, (float)x2,(float)y1, 58 | (float)x2,(float)y2, (float)x1,(float)y2 }; 59 | glEnableClientState(GL_VERTEX_ARRAY); 60 | glVertexPointer(2, GL_FLOAT, 0, verts); 61 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 62 | glDisableClientState(GL_VERTEX_ARRAY); 63 | } 64 | 65 | #endif // PANGOLIN_GL_ES_COMPAT_H 66 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/compat/gl_es_compat.h~: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #ifndef PANGOLIN_GL_ES_COMPAT_H 6 | #define PANGOLIN_GL_ES_COMPAT_H 7 | 8 | #define GLdouble GLfloat 9 | #define glClearDepth glClearDepthf 10 | #define glFrustum glFrustumf 11 | 12 | #define glColor4fv(a) glColor4f(a[0], a[1], a[2], a[3]) 13 | #define glColor3fv(a) glColor4f(a[0], a[1], a[2], 1.0f) 14 | #define glColor3f(a,b,c) glColor4f(a, b, c, 1.0f) 15 | 16 | #define GL_CLAMP GL_CLAMP_TO_EDGE 17 | 18 | #ifdef HAVE_GLES_2 19 | #define glGenFramebuffersEXT glGenFramebuffers 20 | #define glDeleteFramebuffersEXT glDeleteFramebuffers 21 | #define glBindFramebufferEXT glBindFramebuffer 22 | #define glDrawBuffers glDrawBuffers 23 | #define glFramebufferTexture2DEXT glFramebufferTexture2D 24 | #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER 25 | #define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT16 // <---- 26 | #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0 27 | #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT 28 | #else 29 | #define glOrtho glOrthof 30 | #define glGenFramebuffersEXT glGenFramebuffersOES 31 | #define glDeleteFramebuffersEXT glDeleteFramebuffersOES 32 | #define glBindFramebufferEXT glBindFramebufferOES 33 | #define glDrawBuffers glDrawBuffersOES 34 | #define glFramebufferTexture2DEXT glFramebufferTexture2DOES 35 | #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER_OES 36 | #define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES 37 | #define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0_OES 38 | #endif 39 | 40 | #define glGetDoublev glGetFloatv 41 | 42 | #ifdef HAVE_GLES_2 43 | #include 44 | #endif 45 | 46 | inline void glRectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2) 47 | { 48 | GLfloat verts[] = { x1,y1, x2,y1, x2,y2, x1,y2 }; 49 | glEnableClientState(GL_VERTEX_ARRAY); 50 | glVertexPointer(2, GL_FLOAT, 0, verts); 51 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 52 | glDisableClientState(GL_VERTEX_ARRAY); 53 | } 54 | 55 | inline void glRecti(int x1, int y1, int x2, int y2) 56 | { 57 | GLfloat verts[] = { (float)x1,(float)y1, (float)x2,(float)y1, 58 | (float)x2,(float)y2, (float)x1,(float)y2 }; 59 | glEnableClientState(GL_VERTEX_ARRAY); 60 | glVertexPointer(2, GL_FLOAT, 0, verts); 61 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 62 | glDisableClientState(GL_VERTEX_ARRAY); 63 | } 64 | 65 | #endif // PANGOLIN_GL_ES_COMPAT_H 66 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glchar.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLCHAR_H 29 | #define PANGOLIN_GLCHAR_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin { 35 | 36 | struct PANGOLIN_EXPORT XYUV 37 | { 38 | XYUV() {} 39 | XYUV(GLfloat x, GLfloat y, GLfloat tu, GLfloat tv) 40 | : x(x), y(y), tu(tu), tv(tv) {} 41 | 42 | XYUV operator+(int dx) const { 43 | return XYUV(x+dx,y,tu,tv); 44 | } 45 | 46 | GLfloat x, y, tu, tv; 47 | }; 48 | 49 | class PANGOLIN_EXPORT GlChar 50 | { 51 | public: 52 | GlChar(); 53 | GlChar(int tw, int th, int x, int y, int w, int h, GLfloat x_step, GLfloat ox, GLfloat oy); 54 | 55 | inline const XYUV& GetVert(size_t i) const { 56 | return vs[i]; 57 | } 58 | 59 | inline GLfloat StepX() const { 60 | return x_step; 61 | } 62 | 63 | inline GLfloat YMin() const { 64 | return y_min; 65 | } 66 | 67 | inline GLfloat YMax() const { 68 | return y_max; 69 | } 70 | 71 | void Draw() const; 72 | 73 | protected: 74 | XYUV vs[4]; 75 | GLfloat x_step; 76 | GLfloat y_min, y_max; 77 | }; 78 | 79 | } 80 | 81 | #endif // PANGOLIN_GLCHAR_H 82 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glfont.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2015 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLFONT_H 29 | #define PANGOLIN_GLFONT_H 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | 36 | namespace pangolin { 37 | 38 | class PANGOLIN_EXPORT GlFont 39 | { 40 | public: 41 | // Singleton instance if requested. 42 | static GlFont& I(); 43 | 44 | // Load GL Font data. Delay uploading as texture until first use. 45 | GlFont(const unsigned char* ttf_buffer, float pixel_height, int tex_w=512, int tex_h=512); 46 | GlFont(const std::string& filename, float pixel_height, int tex_w=512, int tex_h=512); 47 | 48 | virtual ~GlFont(); 49 | 50 | // Generate renderable GlText object from this font. 51 | GlText Text( const char* fmt, ... ); 52 | 53 | GlText Text( const std::string& str ); 54 | 55 | inline float Height() const { 56 | return font_height_px; 57 | } 58 | 59 | protected: 60 | void InitialiseFont(const unsigned char* ttf_buffer, float pixel_height, int tex_w, int tex_h); 61 | 62 | // This can only be called once GL context is initialised 63 | void InitialiseGlTexture(); 64 | 65 | const static int FIRST_CHAR = 32; 66 | const static int NUM_CHARS = 96; 67 | 68 | float font_height_px; 69 | 70 | int tex_w; 71 | int tex_h; 72 | unsigned char* font_bitmap; 73 | GlTexture mTex; 74 | 75 | GlChar chardata[NUM_CHARS]; 76 | GLfloat kern_table[NUM_CHARS*NUM_CHARS]; 77 | }; 78 | 79 | } 80 | 81 | #endif // PANGOLIN_GLFONT_H 82 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glformattraits.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLFORMATTRAITS_H 29 | #define PANGOLIN_GLFORMATTRAITS_H 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | template 37 | struct GlFormatTraits; 38 | //{ 39 | // static const GLint glinternalformat = 0; 40 | // static const GLenum glformat = 0; 41 | // static const GLenum gltype = 0; 42 | // static const T glmin = 0; 43 | // static const T glmax = 0; 44 | //}; 45 | 46 | ////////////////////////////////////////////////////////////////// 47 | 48 | template<> 49 | struct GlFormatTraits 50 | { 51 | static const GLint glinternalformat = GL_LUMINANCE; 52 | static const GLenum glformat = GL_LUMINANCE; 53 | static const GLenum gltype = GL_FLOAT; 54 | }; 55 | 56 | ////////////////////////////////////////////////////////////////// 57 | 58 | template<> 59 | struct GlFormatTraits 60 | { 61 | static const GLint glinternalformat = GL_LUMINANCE; 62 | static const GLenum glformat = GL_LUMINANCE; 63 | static const GLenum gltype = GL_UNSIGNED_BYTE; 64 | }; 65 | 66 | ////////////////////////////////////////////////////////////////// 67 | 68 | template<> 69 | struct GlFormatTraits 70 | { 71 | static const GLint glinternalformat = GL_LUMINANCE; 72 | static const GLenum glformat = GL_LUMINANCE; 73 | static const GLenum gltype = GL_UNSIGNED_SHORT; 74 | }; 75 | 76 | } 77 | 78 | #endif // PANGOLIN_GLFORMATTRAITS_H 79 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glformattraits.h~: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLFORMATTRAITS_H 29 | #define PANGOLIN_GLFORMATTRAITS_H 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | template 37 | struct GlFormatTraits; 38 | //{ 39 | // static const GLint glinternalformat = 0; 40 | // static const GLenum glformat = 0; 41 | // static const GLenum gltype = 0; 42 | // static const T glmin = 0; 43 | // static const T glmax = 0; 44 | //}; 45 | 46 | ////////////////////////////////////////////////////////////////// 47 | 48 | template<> 49 | struct GlFormatTraits 50 | { 51 | static const GLint glinternalformat = GL_LUMINANCE32F_ARB; 52 | static const GLenum glformat = GL_LUMINANCE; 53 | static const GLenum gltype = GL_FLOAT; 54 | }; 55 | 56 | ////////////////////////////////////////////////////////////////// 57 | 58 | template<> 59 | struct GlFormatTraits 60 | { 61 | static const GLint glinternalformat = GL_LUMINANCE; 62 | static const GLenum glformat = GL_LUMINANCE; 63 | static const GLenum gltype = GL_UNSIGNED_BYTE; 64 | }; 65 | 66 | ////////////////////////////////////////////////////////////////// 67 | 68 | template<> 69 | struct GlFormatTraits 70 | { 71 | static const GLint glinternalformat = GL_LUMINANCE; 72 | static const GLenum glformat = GL_LUMINANCE; 73 | static const GLenum gltype = GL_UNSIGNED_SHORT; 74 | }; 75 | 76 | } 77 | 78 | #endif // PANGOLIN_GLFORMATTRAITS_H 79 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glglut.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLGLUT_H 29 | #define PANGOLIN_GLGLUT_H 30 | 31 | #include "glplatform.h" 32 | 33 | #ifdef HAVE_GLUT 34 | #ifdef HAVE_APPLE_OPENGL_FRAMEWORK 35 | #include 36 | #define HAVE_GLUT_APPLE_FRAMEWORK 37 | 38 | inline void glutBitmapString(void* font, const unsigned char* str) 39 | { 40 | const unsigned char* s = str; 41 | while(*s != 0) { 42 | glutBitmapCharacter(font, *s); 43 | ++s; 44 | } 45 | } 46 | #else 47 | #include 48 | #endif // HAVE_APPLE_OPENGL_FRAMEWORK 49 | #endif // HAVE_GLUT 50 | 51 | #endif // PANGOLIN_GLGLUT_H 52 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glinclude.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove, Richard Newcombe 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLINCLUDE_H 29 | #define PANGOLIN_GLINCLUDE_H 30 | 31 | #include 32 | 33 | #ifdef HAVE_GLES 34 | #include 35 | #endif 36 | 37 | #define CheckGlDieOnError() pangolin::_CheckGlDieOnError( __FILE__, __LINE__ ); 38 | namespace pangolin { 39 | inline void _CheckGlDieOnError( const char *sFile, const int nLine ) 40 | { 41 | GLenum glError = glGetError(); 42 | if( glError != GL_NO_ERROR ) { 43 | pango_print_error( "OpenGL Error: %s (%d)\n", glErrorString(glError), glError ); 44 | pango_print_error("In: %s, line %d\n", sFile, nLine); 45 | } 46 | } 47 | } 48 | 49 | #endif // PANGOLIN_GLINCLUDE_H 50 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glinclude.h~: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove, Richard Newcombe 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLINCLUDE_H 29 | #define PANGOLIN_GLINCLUDE_H 30 | 31 | #include 32 | 33 | #ifdef HAVE_GLES 34 | #include 35 | #endif 36 | 37 | #define CheckGlDieOnError() pangolin::_CheckGlDieOnError( __FILE__, __LINE__ ); 38 | namespace pangolin { 39 | inline void _CheckGlDieOnError( const char *sFile, const int nLine ) 40 | { 41 | GLenum glError = glGetError(); 42 | if( glError != GL_NO_ERROR ) { 43 | pango_print_error( "OpenGL Error: %s (%d)\n", glErrorString(glError), glError ); 44 | pango_print_error("In: %s, line %d\n", sFile, nLine); 45 | } 46 | } 47 | } 48 | 49 | #endif // PANGOLIN_GLINCLUDE_H 50 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glpangoglu.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLPANGOGLU_H 29 | #define PANGOLIN_GLPANGOGLU_H 30 | 31 | #include 32 | 33 | namespace pangolin { 34 | 35 | /// Clone of gluProject 36 | PANGOLIN_EXPORT 37 | const GLubyte* glErrorString(GLenum error); 38 | 39 | /// Clone of gluProject 40 | PANGOLIN_EXPORT 41 | GLint glProject( 42 | float objx, float objy, float objz, 43 | const float modelMatrix[16], 44 | const float projMatrix[16], 45 | const GLint viewport[4], 46 | float* winx, float* winy, float* winz 47 | ); 48 | 49 | 50 | /// Clone of gluUnProject 51 | PANGOLIN_EXPORT 52 | GLint glUnProject( 53 | float winx, float winy, float winz, 54 | const float modelMatrix[16], 55 | const float projMatrix[16], 56 | const GLint viewport[4], 57 | float* objx, float* objy, float* objz 58 | ); 59 | 60 | /// Clone of gluProject 61 | PANGOLIN_EXPORT 62 | GLint glProject( 63 | double objx, double objy, double objz, 64 | const double modelMatrix[16], 65 | const double projMatrix[16], 66 | const GLint viewport[4], 67 | double* winx, double* winy, double* winz 68 | ); 69 | 70 | 71 | /// Clone of gluUnProject 72 | PANGOLIN_EXPORT 73 | GLint glUnProject( 74 | double winx, double winy, double winz, 75 | const double modelMatrix[16], 76 | const double projMatrix[16], 77 | const GLint viewport[4], 78 | double* objx, double* objy, double* objz 79 | ); 80 | 81 | } 82 | 83 | #endif // PANGOLIN_GLPANGOGLU_H 84 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glpixformat.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLPANGOPIXFORMAT_H 29 | #define PANGOLIN_GLPANGOPIXFORMAT_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace pangolin { 36 | 37 | // This class may dissapear in the future 38 | struct GlPixFormat 39 | { 40 | GlPixFormat() {} 41 | 42 | GlPixFormat(const VideoPixelFormat& fmt) 43 | { 44 | switch( fmt.channels) { 45 | case 1: glformat = GL_LUMINANCE; break; 46 | case 3: glformat = (fmt.format == "BGR24") ? GL_RGB : GL_RGB; break; 47 | case 4: glformat = (fmt.format == "BGRA24") ? GL_RGBA : GL_RGBA; break; 48 | default: throw std::runtime_error("Unable to display video format"); 49 | } 50 | 51 | switch (fmt.channel_bits[0]) { 52 | case 8: gltype = GL_UNSIGNED_BYTE; break; 53 | case 16: gltype = GL_UNSIGNED_SHORT; break; 54 | case 32: gltype = GL_FLOAT; break; 55 | default: throw std::runtime_error("Unknown channel format"); 56 | } 57 | 58 | if(glformat == GL_LUMINANCE) { 59 | if(gltype == GL_UNSIGNED_BYTE) { 60 | scalable_internal_format = GL_LUMINANCE; 61 | }else{ 62 | scalable_internal_format = GL_LUMINANCE; 63 | } 64 | }else{ 65 | if(gltype == GL_UNSIGNED_BYTE) { 66 | scalable_internal_format = GL_RGBA; 67 | }else{ 68 | scalable_internal_format = GL_RGBA; 69 | } 70 | } 71 | } 72 | 73 | GLint glformat; 74 | GLenum gltype; 75 | GLint scalable_internal_format; 76 | }; 77 | 78 | } 79 | 80 | #endif // PANGOLIN_GLPANGOPIXFORMAT_H 81 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glpixformat.h~: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLPANGOPIXFORMAT_H 29 | #define PANGOLIN_GLPANGOPIXFORMAT_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace pangolin { 36 | 37 | // This class may dissapear in the future 38 | struct GlPixFormat 39 | { 40 | GlPixFormat() {} 41 | 42 | GlPixFormat(const VideoPixelFormat& fmt) 43 | { 44 | switch( fmt.channels) { 45 | case 1: glformat = GL_LUMINANCE; break; 46 | case 3: glformat = (fmt.format == "BGR24") ? GL_RGB : GL_RGB; break; 47 | case 4: glformat = (fmt.format == "BGRA24") ? GL_RGBA : GL_RGBA; break; 48 | default: throw std::runtime_error("Unable to display video format"); 49 | } 50 | 51 | switch (fmt.channel_bits[0]) { 52 | case 8: gltype = GL_UNSIGNED_BYTE; break; 53 | case 16: gltype = GL_UNSIGNED_SHORT; break; 54 | case 32: gltype = GL_FLOAT; break; 55 | default: throw std::runtime_error("Unknown channel format"); 56 | } 57 | 58 | if(glformat == GL_LUMINANCE) { 59 | if(gltype == GL_UNSIGNED_BYTE) { 60 | scalable_internal_format = GL_LUMINANCE8; 61 | }else{ 62 | scalable_internal_format = GL_LUMINANCE32F_ARB; 63 | } 64 | }else{ 65 | if(gltype == GL_UNSIGNED_BYTE) { 66 | scalable_internal_format = GL_RGBA8; 67 | }else{ 68 | scalable_internal_format = GL_RGBA32F; 69 | } 70 | } 71 | } 72 | 73 | GLint glformat; 74 | GLenum gltype; 75 | GLint scalable_internal_format; 76 | }; 77 | 78 | } 79 | 80 | #endif // PANGOLIN_GLPANGOPIXFORMAT_H 81 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glplatform.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLPLATFORM_H 29 | #define PANGOLIN_GLPLATFORM_H 30 | 31 | ////////////////////////////////////////////////////////// 32 | // Attempt to portably include Necessary OpenGL headers 33 | ////////////////////////////////////////////////////////// 34 | 35 | #include 36 | 37 | #ifdef _WIN_ 38 | // Define maths quantities when using to match posix systems 39 | #define _USE_MATH_DEFINES 40 | 41 | // Don't define min / max macros in windows.h or other unnecessary macros 42 | #define NOMINMAX 43 | #define WIN32_LEAN_AND_MEAN 44 | #include 45 | 46 | // Undef nuisance Windows.h macros which interfere with our methods 47 | #undef LoadImage 48 | #undef near 49 | #undef far 50 | #endif 51 | 52 | #ifdef HAVE_GLEW 53 | #include 54 | #endif 55 | 56 | #ifdef HAVE_GLES 57 | #if defined(_ANDROID_) 58 | #include 59 | #ifdef HAVE_GLES_2 60 | #include 61 | #include 62 | #endif 63 | #include 64 | #define GL_GLEXT_PROTOTYPES 65 | #include 66 | 67 | #elif defined(_APPLE_IOS_) 68 | #include 69 | #include 70 | #endif 71 | #else 72 | #ifdef _OSX_ 73 | #include 74 | #else 75 | #include 76 | #endif 77 | #endif // HAVE_GLES 78 | 79 | #include 80 | 81 | #endif // PANGOLIN_GLPLATFORM_H 82 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/gl/glplatform.h~: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_GLPLATFORM_H 29 | #define PANGOLIN_GLPLATFORM_H 30 | 31 | ////////////////////////////////////////////////////////// 32 | // Attempt to portably include Necessary OpenGL headers 33 | ////////////////////////////////////////////////////////// 34 | 35 | #include 36 | 37 | #ifdef _WIN_ 38 | // Define maths quantities when using to match posix systems 39 | #define _USE_MATH_DEFINES 40 | 41 | // Don't define min / max macros in windows.h or other unnecessary macros 42 | #define NOMINMAX 43 | #define WIN32_LEAN_AND_MEAN 44 | #include 45 | 46 | // Undef nuisance Windows.h macros which interfere with our methods 47 | #undef LoadImage 48 | #undef near 49 | #undef far 50 | #endif 51 | 52 | #ifdef HAVE_GLEW 53 | #include 54 | #endif 55 | 56 | #ifdef HAVE_GLES 57 | #if defined(_ANDROID_) 58 | #include 59 | #ifdef HAVE_GLES_2 60 | #include 61 | #include 62 | #else 63 | #include 64 | #define GL_GLEXT_PROTOTYPES 65 | #include 66 | #endif 67 | #elif defined(_APPLE_IOS_) 68 | #include 69 | #include 70 | #endif 71 | #else 72 | #ifdef _OSX_ 73 | #include 74 | #else 75 | #include 76 | #endif 77 | #endif // HAVE_GLES 78 | 79 | #include 80 | 81 | #endif // PANGOLIN_GLPLATFORM_H 82 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/handler/handler_glbuffer.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef HANDLER_GLBUFFER_H 29 | #define HANDLER_GLBUFFER_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | struct Handler3DFramebuffer : public pangolin::Handler3D 38 | { 39 | Handler3DFramebuffer(GlFramebuffer& fb, pangolin::OpenGlRenderState& cam_state, pangolin::AxisDirection enforce_up=pangolin::AxisNone, float trans_scale=0.01f); 40 | void GetPosNormal(pangolin::View& view, int x, int y, GLprecision p[3], GLprecision Pw[3], GLprecision Pc[3], GLprecision /*n*/[3], GLprecision default_z); 41 | 42 | protected: 43 | GlFramebuffer& fb; 44 | }; 45 | 46 | } 47 | 48 | #endif // HANDLER_GLBUFFER_H 49 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/hud/oculus_hud.h: -------------------------------------------------------------------------------- 1 | #ifndef PANGOLIN_OCULUS_HUD_H 2 | #define PANGOLIN_OCULUS_HUD_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace pangolin 13 | { 14 | 15 | class OculusHud; 16 | 17 | struct HandlerOculus : public pangolin::Handler 18 | { 19 | HandlerOculus(OculusHud& oculus, pangolin::Handler* h = 0); 20 | 21 | void Keyboard(View&, unsigned char key, int x, int y, bool pressed); 22 | void Mouse(View&, MouseButton button, int x, int y, bool pressed, int button_state); 23 | void MouseMotion(View&, int x, int y, int button_state); 24 | void PassiveMouseMotion(View&, int x, int y, int button_state); 25 | void Special(View&, InputSpecial inType, float x, float y, float p1, float p2, float p3, float p4, int button_state); 26 | 27 | void SetHandler(pangolin::Handler* h); 28 | 29 | protected: 30 | OculusHud& oculus; 31 | pangolin::Handler* handler; 32 | }; 33 | 34 | 35 | class OculusHud : public View 36 | { 37 | public: 38 | OculusHud(); 39 | 40 | void Render(); 41 | void RenderFramebuffer(); 42 | 43 | void SetHandler(Handler *handler); 44 | 45 | void SetParams(float focalLength, float lensXOffset, float eye_y, float eye_z); 46 | 47 | OVR::HMDInfo& HmdInfo(); 48 | 49 | unsigned int NumEyes() const; 50 | 51 | View& CommonView(); 52 | 53 | OpenGlMatrix HeadTransform(); 54 | OpenGlMatrix HeadTransformDelta(); 55 | pangolin::GlFramebuffer& Framebuffer(); 56 | pangolin::OpenGlRenderState& DefaultRenderState(); 57 | 58 | void UnwarpPoint(unsigned int view, const float in[2], float out[2]); 59 | 60 | protected: 61 | // Oculus SDK Shader for applying lens and chromatic distortion. 62 | static const char* PostProcessFullFragShaderSrc; 63 | 64 | void InitialiseOculus(); 65 | void InitialiseFramebuffer(); 66 | void InitialiseShader(); 67 | 68 | pangolin::GlTexture colourbuffer; 69 | pangolin::GlRenderBuffer depthbuffer; 70 | pangolin::GlFramebuffer framebuffer; 71 | pangolin::GlSlProgram occ; 72 | bool post_unwarp; 73 | 74 | OVR::Ptr pManager; 75 | OVR::Ptr pHMD; 76 | OVR::Ptr pSensor; 77 | boostd::shared_ptr pFusionResult; 78 | OVR::HMDInfo HMD; 79 | OVR::Util::Render::StereoConfig stereo; 80 | 81 | View eyeview[2]; 82 | View common; 83 | pangolin::OpenGlRenderState default_cam; 84 | HandlerOculus handler; 85 | 86 | // Center to Oculus transform 87 | OpenGlMatrix T_oc; 88 | }; 89 | 90 | } 91 | 92 | #endif // PANGOLIN_OCULUS_HUD_H 93 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/image/image.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_IMAGE_H 29 | #define PANGOLIN_IMAGE_H 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | // Simple image wrapper 37 | template 38 | struct Image { 39 | inline Image() 40 | : pitch(0), ptr(0), w(0), h(0) 41 | { 42 | } 43 | 44 | inline Image(size_t w, size_t h, size_t pitch, T* ptr) 45 | : pitch(pitch), ptr(ptr), w(w), h(h) 46 | { 47 | } 48 | 49 | void Dealloc() 50 | { 51 | if(ptr) { 52 | delete[] ptr; 53 | ptr = NULL; 54 | } 55 | } 56 | 57 | void Alloc(size_t w, size_t h, size_t pitch) 58 | { 59 | Dealloc(); 60 | this->w = w; 61 | this->h = h; 62 | this->pitch = pitch; 63 | this->ptr = new unsigned char[h*pitch]; 64 | } 65 | 66 | size_t SizeBytes() const 67 | { 68 | return pitch * h; 69 | } 70 | 71 | size_t Area() const 72 | { 73 | return w * h; 74 | } 75 | 76 | template 77 | Image Reinterpret() 78 | { 79 | return Image(w,h,pitch, (To*)ptr); 80 | } 81 | 82 | T* RowPtr(int r) 83 | { 84 | return (T*)((char*)ptr + r*pitch); 85 | } 86 | 87 | size_t pitch; 88 | T* ptr; 89 | size_t w; 90 | size_t h; 91 | }; 92 | 93 | } 94 | 95 | #endif // PANGOLIN_IMAGE_H 96 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/image/image_io.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_IMAGE_IO_H 29 | #define PANGOLIN_IMAGE_IO_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace pangolin { 36 | 37 | struct TypedImage : public Image 38 | { 39 | inline TypedImage() 40 | : Image() 41 | { 42 | } 43 | 44 | inline TypedImage(size_t w, size_t h, size_t pitch, unsigned char* ptr, const VideoPixelFormat& fmt) 45 | : Image(w,h,pitch,ptr), fmt(fmt) 46 | { 47 | } 48 | 49 | inline void Alloc(size_t w, size_t h, const VideoPixelFormat& fmt) 50 | { 51 | this->fmt = fmt; 52 | Image::Alloc(w, h, w*fmt.bpp / 8); 53 | } 54 | 55 | inline void Alloc(size_t w, size_t h, const VideoPixelFormat& fmt, size_t pitch) 56 | { 57 | this->fmt = fmt; 58 | Image::Alloc(w, h, pitch); 59 | } 60 | 61 | VideoPixelFormat fmt; 62 | }; 63 | 64 | PANGOLIN_EXPORT 65 | TypedImage LoadImage(const std::string& filename, ImageFileType file_type); 66 | 67 | PANGOLIN_EXPORT 68 | TypedImage LoadImage(const std::string& filename); 69 | 70 | PANGOLIN_EXPORT 71 | void SaveImage(const Image& image, const pangolin::VideoPixelFormat& fmt, const std::string& filename, bool top_line_first = true); 72 | 73 | PANGOLIN_EXPORT 74 | void SaveImage(const TypedImage& image, const std::string& filename, bool top_line_first = true); 75 | 76 | PANGOLIN_EXPORT 77 | void FreeImage(TypedImage& img); 78 | 79 | } 80 | 81 | #endif // PANGOLIN_IMAGE_IO_H 82 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/ios/PangolinAppDelegate.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #import 29 | 30 | #import "PangolinUIView.h" 31 | 32 | @interface PangolinAppDelegate : UIResponder 33 | 34 | @property (strong, nonatomic) UIWindow *window; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/ios/PangolinUIView.h: -------------------------------------------------------------------------------- 1 | // 2 | // GlTestViewController.h 3 | // gltest 4 | // 5 | // Created by Steven Lovegrove on 30/01/2014. 6 | // Copyright (c) 2014 Steven Lovegrove. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #include 12 | #include 13 | 14 | @interface PangolinUIView : UIView { 15 | CAEAGLLayer* _eaglLayer; 16 | EAGLContext* _context; 17 | 18 | GLuint _colorRenderBuffer; 19 | GLuint _depthRenderBuffer; 20 | } 21 | 22 | @end -------------------------------------------------------------------------------- /Pangolin/include/pangolin/pangolin.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_H 29 | #define PANGOLIN_H 30 | 31 | #include 32 | 33 | #ifdef BUILD_PANGOLIN_GUI 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #ifdef HAVE_GLUT 42 | #include 43 | #endif // HAVE_GLUT 44 | #ifdef _ANDROID_ 45 | #include 46 | #endif 47 | #if !defined(HAVE_GLES) || defined(HAVE_GLES_2) 48 | #include 49 | #endif 50 | #endif // BUILD_PANGOLIN_GUI 51 | 52 | #ifdef BUILD_PANGOLIN_VARS 53 | #include 54 | #ifdef BUILD_PANGOLIN_GUI 55 | #include 56 | #endif // BUILD_PANGOLIN_GUI 57 | #endif // BUILD_PANGOLIN_VARS 58 | 59 | #ifdef BUILD_PANGOLIN_VIDEO 60 | #include 61 | #include 62 | #endif // BUILD_PANGOLIN_VIDEO 63 | 64 | #include 65 | 66 | // Let other libraries headers know about Pangolin 67 | #define HAVE_PANGOLIN 68 | 69 | #endif // PANGOLIN_H 70 | 71 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/platform.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_PLATFORM_H 29 | #define PANGOLIN_PLATFORM_H 30 | 31 | #include 32 | 33 | // Include portable printf-style format macros 34 | #define __STDC_FORMAT_MACROS 35 | 36 | #ifdef _GCC_ 37 | # define PANGOLIN_DEPRECATED __attribute__((deprecated)) 38 | #elif defined _MSVC_ 39 | # define PANGOLIN_DEPRECATED __declspec(deprecated) 40 | #else 41 | # define PANGOLIN_DEPRECATED 42 | #endif 43 | 44 | #if (__cplusplus > 199711L) || (_MSC_VER >= 1700) 45 | # define PANGOLIN_OVERRIDE override 46 | #else 47 | # define PANGOLIN_OVERRIDE 48 | #endif 49 | 50 | #ifdef _MSVC_ 51 | # define __thread __declspec(thread) 52 | # include 53 | #else 54 | # define PANGOLIN_EXPORT 55 | #endif //_MSVC_ 56 | 57 | #ifdef _APPLE_IOS_ 58 | // Not supported on this platform. 59 | #define __thread 60 | #endif // _APPLE_IOS_ 61 | 62 | #ifndef _ANDROID_ 63 | # include 64 | # define pango_print_debug(...) printf(__VA_ARGS__) 65 | # define pango_print_info(...) printf(__VA_ARGS__) 66 | # define pango_print_error(...) fprintf(stderr, __VA_ARGS__) 67 | # define pango_print_warn(...) fprintf(stderr, __VA_ARGS__) 68 | #else 69 | # include 70 | # define pango_print_debug(...) __android_log_print(ANDROID_LOG_DEBUG, "pango", __VA_ARGS__ ); 71 | # define pango_print_info(...) __android_log_print(ANDROID_LOG_INFO, "pango", __VA_ARGS__ ); 72 | # define pango_print_error(...) __android_log_print(ANDROID_LOG_ERROR, "pango", __VA_ARGS__ ); 73 | # define pango_print_warn(...) __android_log_print(ANDROID_LOG_ERROR, "pango", __VA_ARGS__ ); 74 | #endif 75 | 76 | #endif // PANGOLIN_PLATFORM_H 77 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/python/PyInterpreter.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #pragma once 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | namespace pangolin 39 | { 40 | 41 | class PyInterpreter : public ConsoleInterpreter 42 | { 43 | public: 44 | PyInterpreter(); 45 | 46 | ~PyInterpreter() PANGOLIN_OVERRIDE; 47 | 48 | void PushCommand(const std::string &cmd) PANGOLIN_OVERRIDE; 49 | 50 | bool PullLine(ConsoleLine& line) PANGOLIN_OVERRIDE; 51 | 52 | std::vector Complete( 53 | const std::string& cmd, int max_options 54 | ) PANGOLIN_OVERRIDE; 55 | 56 | static void AttachPrefix(void* data, const std::string& name, VarValueGeneric& var, bool brand_new ); 57 | 58 | private: 59 | PyObject* pycompleter; 60 | PyObject* pycomplete; 61 | 62 | std::string ToString(PyObject* py); 63 | void CheckPrintClearError(); 64 | PyUniqueObj EvalExec(const std::string& cmd); 65 | 66 | std::queue line_queue; 67 | std::set base_prefixes; 68 | }; 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/utils/file_extension.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_FILE_EXTENSION_H 29 | #define PANGOLIN_FILE_EXTENSION_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | enum ImageFileType 38 | { 39 | ImageFileTypePpm, 40 | ImageFileTypeTga, 41 | ImageFileTypePng, 42 | ImageFileTypeJpg, 43 | ImageFileTypeTiff, 44 | ImageFileTypeGif, 45 | ImageFileTypeExr, 46 | ImageFileTypePango, 47 | ImageFileTypePvn, 48 | ImageFileTypeUnknown 49 | }; 50 | 51 | PANGOLIN_EXPORT 52 | std::string FileLowercaseExtention(const std::string& filename); 53 | 54 | PANGOLIN_EXPORT 55 | ImageFileType FileTypeMagic(const unsigned char data[], size_t bytes); 56 | 57 | PANGOLIN_EXPORT 58 | ImageFileType FileTypeExtension(const std::string& ext); 59 | 60 | PANGOLIN_EXPORT 61 | ImageFileType FileType(const std::string& filename); 62 | 63 | } 64 | 65 | #endif // PANGOLIN_FILE_EXTENSION_H 66 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/utils/params.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_PARAMS_H 29 | #define PANGOLIN_PARAMS_H 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | namespace pangolin 38 | { 39 | 40 | class PANGOLIN_EXPORT Params 41 | { 42 | public: 43 | typedef std::map ParamMap; 44 | 45 | bool Contains(const std::string& key) const 46 | { 47 | return params.find(key) != params.end(); 48 | } 49 | 50 | template 51 | T Get(const std::string& key, T default_val) const 52 | { 53 | ParamMap::const_iterator v = params.find(key); 54 | if(v != params.end()) { 55 | return Convert::Do(v->second); 56 | }else{ 57 | return default_val; 58 | } 59 | } 60 | 61 | template 62 | void Set(const std::string& key, const T& val) 63 | { 64 | params[key] = Convert::Do(val); 65 | } 66 | 67 | ParamMap params; 68 | }; 69 | 70 | } 71 | 72 | #endif // PANGOLIN_PARAMS_H 73 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/utils/threadedfilebuf.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_THREADED_WRITE_H 29 | #define PANGOLIN_THREADED_WRITE_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | #include 38 | 39 | namespace pangolin 40 | { 41 | 42 | class PANGOLIN_EXPORT threadedfilebuf : public std::streambuf 43 | { 44 | public: 45 | ~threadedfilebuf(); 46 | threadedfilebuf(); 47 | threadedfilebuf(const std::string& filename, unsigned int buffer_size_bytes); 48 | 49 | void open(const std::string& filename, unsigned int buffer_size_bytes); 50 | void close(); 51 | 52 | void operator()(); 53 | 54 | protected: 55 | //! Override streambuf::xsputn for asynchronous write 56 | std::streamsize xsputn(const char * s, std::streamsize n); 57 | 58 | //! Override streambuf::overflow for asynchronous write 59 | int overflow(int c); 60 | 61 | std::filebuf file; 62 | char* mem_buffer; 63 | std::streamsize mem_size; 64 | std::streamsize mem_max_size; 65 | std::streamsize mem_start; 66 | std::streamsize mem_end; 67 | 68 | boostd::mutex update_mutex; 69 | boostd::condition_variable cond_queued; 70 | boostd::condition_variable cond_dequeued; 71 | boostd::thread write_thread; 72 | 73 | bool should_run; 74 | }; 75 | 76 | } 77 | 78 | 79 | #endif // PANGOLIN_THREADED_WRITE_H 80 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/utils/uri.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_URI_H 29 | #define PANGOLIN_URI_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace pangolin 36 | { 37 | 38 | class PANGOLIN_EXPORT Uri : public Params 39 | { 40 | public: 41 | std::string scheme; 42 | std::string url; 43 | }; 44 | 45 | //! Parse string as Video URI 46 | PANGOLIN_EXPORT 47 | Uri ParseUri(const std::string& str_uri); 48 | 49 | } 50 | 51 | #endif // PANGOLIN_URI_H 52 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/utils/xml/license.txt: -------------------------------------------------------------------------------- 1 | Use of this software is granted under one of the following two licenses, 2 | to be chosen freely by the user. 3 | 4 | 1. Boost Software License - Version 1.0 - August 17th, 2003 5 | =============================================================================== 6 | 7 | Copyright (c) 2006, 2007 Marcin Kalicinski 8 | 9 | Permission is hereby granted, free of charge, to any person or organization 10 | obtaining a copy of the software and accompanying documentation covered by 11 | this license (the "Software") to use, reproduce, display, distribute, 12 | execute, and transmit the Software, and to prepare derivative works of the 13 | Software, and to permit third-parties to whom the Software is furnished to 14 | do so, all subject to the following: 15 | 16 | The copyright notices in the Software and this entire statement, including 17 | the above license grant, this restriction and the following disclaimer, 18 | must be included in all copies of the Software, in whole or in part, and 19 | all derivative works of the Software, unless such copies or derivative 20 | works are solely in the form of machine-executable object code generated by 21 | a source language processor. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 26 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 27 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 28 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29 | DEALINGS IN THE SOFTWARE. 30 | 31 | 2. The MIT License 32 | =============================================================================== 33 | 34 | Copyright (c) 2006, 2007 Marcin Kalicinski 35 | 36 | Permission is hereby granted, free of charge, to any person obtaining a copy 37 | of this software and associated documentation files (the "Software"), to deal 38 | in the Software without restriction, including without limitation the rights 39 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 40 | of the Software, and to permit persons to whom the Software is furnished to do so, 41 | subject to the following conditions: 42 | 43 | The above copyright notice and this permission notice shall be included in all 44 | copies or substantial portions of the Software. 45 | 46 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 47 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 48 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 49 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 50 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 51 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 52 | IN THE SOFTWARE. 53 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/var/input_record_repeat.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_INPUT_RECORD_REPEAT_H 29 | #define PANGOLIN_INPUT_RECORD_REPEAT_H 30 | 31 | #include 32 | 33 | #include 34 | #include 35 | #include 36 | 37 | namespace pangolin 38 | { 39 | 40 | struct FrameInput 41 | { 42 | int index; 43 | std::string var; 44 | std::string val; 45 | }; 46 | 47 | struct PANGOLIN_EXPORT InputRecordRepeat 48 | { 49 | InputRecordRepeat(const std::string& var_record_prefix); 50 | ~InputRecordRepeat(); 51 | 52 | void SetIndex(int id); 53 | 54 | void Record(); 55 | void Stop(); 56 | 57 | void LoadBuffer(const std::string& filename); 58 | void SaveBuffer(const std::string& filename); 59 | void ClearBuffer(); 60 | 61 | void PlayBuffer(); 62 | void PlayBuffer(size_t start, size_t end); 63 | 64 | void UpdateVariable(const std::string& name ); 65 | 66 | template 67 | inline void UpdateVariable(const Var& var ) { 68 | GuiVarChanged((void*)this, var.var->Meta().full_name, *var.var); 69 | } 70 | 71 | size_t Size(); 72 | 73 | protected: 74 | bool record; 75 | bool play; 76 | 77 | int index; 78 | std::ofstream file; 79 | std::string filename; 80 | 81 | std::list play_queue; 82 | std::list record_queue; 83 | 84 | static void GuiVarChanged(void* data, const std::string& name, VarValueGeneric& var); 85 | }; 86 | 87 | } 88 | 89 | #endif // PANGOLIN_INPUT_RECORD_REPEAT_H 90 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/var/varvaluegeneric.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VARVALUEGENERIC_H 29 | #define PANGOLIN_VARVALUEGENERIC_H 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | struct VarMeta 37 | { 38 | std::string full_name; 39 | std::string friendly; 40 | double range[2]; 41 | double increment; 42 | int flags; 43 | bool gui_changed; 44 | bool logscale; 45 | bool generic; 46 | }; 47 | 48 | // Forward declaration 49 | template 50 | class VarValueT; 51 | 52 | //! Abstract base class for named Pangolin variables 53 | class VarValueGeneric 54 | { 55 | public: 56 | VarValueGeneric() 57 | : str(0) 58 | { 59 | } 60 | 61 | virtual ~VarValueGeneric() 62 | { 63 | } 64 | 65 | virtual const char* TypeId() const = 0; 66 | virtual void Reset() = 0; 67 | virtual VarMeta& Meta() = 0; 68 | 69 | //protected: 70 | // String serialisation object. 71 | VarValueT* str; 72 | }; 73 | 74 | } 75 | 76 | #endif // PANGOLIN_VARVALUEGENERIC_H 77 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/var/varvaluet.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VARVALUET_H 29 | #define PANGOLIN_VARVALUET_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | template 38 | class VarValueT : public VarValueGeneric 39 | { 40 | public: 41 | typedef typename boostd::remove_reference::type VarT; 42 | 43 | virtual const VarT& Get() const = 0; 44 | virtual void Set(const VarT& val) = 0; 45 | }; 46 | 47 | } 48 | 49 | #endif // PANGOLIN_VARVALUET_H 50 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/var/varwrapper.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VARWRAPPER_H 29 | #define PANGOLIN_VARWRAPPER_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | namespace pangolin 36 | { 37 | 38 | template 39 | class VarWrapper : public VarValueT 40 | { 41 | public: 42 | typedef typename boostd::remove_reference::type VarS; 43 | 44 | VarWrapper(VarValueT& src) 45 | : src(src) 46 | { 47 | this->str = src.str; 48 | } 49 | 50 | const char* TypeId() const 51 | { 52 | return typeid(T).name(); 53 | } 54 | 55 | void Reset() 56 | { 57 | src.Reset(); 58 | 59 | // If reset throws, it will go up to the user, since there is nothing 60 | // more we can do 61 | cache = Convert::Do(src.Get()); 62 | } 63 | 64 | VarMeta& Meta() 65 | { 66 | return src.Meta(); 67 | } 68 | 69 | const T& Get() const 70 | { 71 | // This might throw, but we can't reset because this is a const method 72 | cache = Convert::Do(src.Get()); 73 | return cache; 74 | } 75 | 76 | void Set(const T& val) 77 | { 78 | cache = val; 79 | try { 80 | src.Set( Convert::Do(val) ); 81 | }catch(BadInputException) { 82 | pango_print_warn("Unable to set variable with type %s from %s. Resetting.", typeid(VarS).name(), typeid(T).name() ); 83 | Reset(); 84 | } 85 | } 86 | 87 | protected: 88 | mutable T cache; 89 | VarValueT& src; 90 | }; 91 | 92 | } 93 | 94 | #endif // PANGOLIN_VARWRAPPER_H 95 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/firewire_deinterlace.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_FIREWIRE_DEINTERLACE_H 29 | #define PANGOLIN_FIREWIRE_DEINTERLACE_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | class PANGOLIN_EXPORT FirewireDeinterlace 38 | : public VideoInterface 39 | { 40 | public: 41 | FirewireDeinterlace(VideoInterface* videoin); 42 | ~FirewireDeinterlace(); 43 | 44 | size_t SizeBytes() const; 45 | 46 | const std::vector& Streams() const; 47 | 48 | void Start(); 49 | 50 | void Stop(); 51 | 52 | bool GrabNext( unsigned char* image, bool wait = true ); 53 | 54 | bool GrabNewest( unsigned char* image, bool wait = true ); 55 | 56 | protected: 57 | VideoInterface* videoin; 58 | std::vector streams; 59 | unsigned char* buffer; 60 | }; 61 | 62 | 63 | } 64 | 65 | #endif // PANGOLIN_FIREWIRE_DEINTERLACE_H 66 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/images.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_IMAGES_H 29 | #define PANGOLIN_VIDEO_IMAGES_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | namespace pangolin 39 | { 40 | 41 | // Video class that outputs test video signal. 42 | class PANGOLIN_EXPORT ImagesVideo : public VideoInterface 43 | { 44 | public: 45 | ImagesVideo(const std::string& wildcard_path); 46 | ~ImagesVideo(); 47 | 48 | //! Implement VideoInput::Start() 49 | void Start(); 50 | 51 | //! Implement VideoInput::Stop() 52 | void Stop(); 53 | 54 | //! Implement VideoInput::SizeBytes() 55 | size_t SizeBytes() const; 56 | 57 | //! Implement VideoInput::Streams() 58 | const std::vector& Streams() const; 59 | 60 | //! Implement VideoInput::GrabNext() 61 | bool GrabNext( unsigned char* image, bool wait = true ); 62 | 63 | //! Implement VideoInput::GrabNewest() 64 | bool GrabNewest( unsigned char* image, bool wait = true ); 65 | 66 | protected: 67 | typedef std::vector Frame; 68 | 69 | const std::string& Filename(size_t frameNum, size_t channelNum) { 70 | return filenames[channelNum][frameNum]; 71 | } 72 | 73 | bool QueueFrame(); 74 | 75 | std::vector streams; 76 | size_t size_bytes; 77 | 78 | 79 | int num_files; 80 | size_t num_channels; 81 | std::vector > filenames; 82 | 83 | int num_loaded; 84 | std::deque loaded; 85 | }; 86 | 87 | } 88 | 89 | #endif // PANGOLIN_VIDEO_IMAGES_H 90 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/join.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_JOIN_H 29 | #define PANGOLIN_VIDEO_JOIN_H 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | class PANGOLIN_EXPORT VideoJoiner 37 | : public VideoInterface, public VideoFilterInterface 38 | { 39 | public: 40 | VideoJoiner(const std::vector &src); 41 | 42 | ~VideoJoiner(); 43 | 44 | size_t SizeBytes() const; 45 | 46 | const std::vector& Streams() const; 47 | 48 | void Start(); 49 | 50 | void Stop(); 51 | 52 | bool GrabNext( unsigned char* image, bool wait = true ); 53 | 54 | bool GrabNewest( unsigned char* image, bool wait = true ); 55 | 56 | std::vector& InputStreams(); 57 | 58 | protected: 59 | std::vector src; 60 | std::vector streams; 61 | size_t size_bytes; 62 | }; 63 | 64 | 65 | } 66 | 67 | #endif // PANGOLIN_VIDEO_JOIN_H 68 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/openni.h: -------------------------------------------------------------------------------- 1 | #ifndef PANGOLIN_OPENNI_H 2 | #define PANGOLIN_OPENNI_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | // Workaround poor OpenNI Platform test on Linux before including XnCppWrapper.h 10 | // See https://github.com/dennishamester/OpenNI/commit/ca99f6181234c682bba42a6ba 11 | #ifdef _LINUX_ 12 | #define linux 1 13 | #endif // _LINUX_ 14 | 15 | // OpenNI generates SO MANY warnings, we'll just disable all for this header(!) 16 | // GCC and clang will listen to this pramga. 17 | #ifndef _MSVC_ 18 | #pragma GCC system_header 19 | #endif 20 | #include 21 | 22 | namespace pangolin 23 | { 24 | 25 | //! Interface to video capture sources 26 | struct PANGOLIN_EXPORT OpenNiVideo : public VideoInterface 27 | { 28 | public: 29 | OpenNiVideo(OpenNiSensorType s1, OpenNiSensorType s2, ImageDim dim = ImageDim(640,480), int fps = 30); 30 | ~OpenNiVideo(); 31 | 32 | //! Implement VideoInput::Start() 33 | void Start(); 34 | 35 | //! Implement VideoInput::Stop() 36 | void Stop(); 37 | 38 | //! Implement VideoInput::SizeBytes() 39 | size_t SizeBytes() const; 40 | 41 | //! Implement VideoInput::Streams() 42 | const std::vector& Streams() const; 43 | 44 | //! Implement VideoInput::GrabNext() 45 | bool GrabNext( unsigned char* image, bool wait = true ); 46 | 47 | //! Implement VideoInput::GrabNewest() 48 | bool GrabNewest( unsigned char* image, bool wait = true ); 49 | 50 | void SetAutoExposure(bool enabled) 51 | { 52 | #if XN_MINOR_VERSION > 5 || (XN_MINOR_VERSION == 5 && XN_BUILD_VERSION >= 7) 53 | if(imageNode.IsValid()) { 54 | imageNode.GetAutoExposureCap().Set(enabled ? 1 : 0); 55 | } 56 | #else 57 | throw pangolin::VideoException("SetAutoExposure Not supported for this version of OpenNI."); 58 | #endif 59 | } 60 | 61 | protected: 62 | std::vector streams; 63 | OpenNiSensorType sensor_type[2]; 64 | 65 | xn::Context context; 66 | xn::DepthGenerator depthNode; 67 | xn::ImageGenerator imageNode; 68 | xn::IRGenerator irNode; 69 | 70 | size_t sizeBytes; 71 | }; 72 | 73 | } 74 | 75 | #endif // PANGOLIN_OPENNI_H 76 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/openni_common.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 2015 Richard Newcombe 6 | * 7 | * Permission is hereby granted, free of charge, to any person 8 | * obtaining a copy of this software and associated documentation 9 | * files (the "Software"), to deal in the Software without 10 | * restriction, including without limitation the rights to use, 11 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the 13 | * Software is furnished to do so, subject to the following 14 | * conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be 17 | * included in all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | * OTHER DEALINGS IN THE SOFTWARE. 27 | */ 28 | 29 | #ifndef PANGOLIN_OPENNI_COMMON_H 30 | #define PANGOLIN_OPENNI_COMMON_H 31 | 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | enum OpenNiSensorType 38 | { 39 | OpenNiUnassigned = -1, 40 | OpenNiRgb = 0, 41 | OpenNiIr, 42 | OpenNiDepth_1mm, 43 | OpenNiDepth_1mm_Registered, 44 | OpenNiDepth_100um, 45 | OpenNiIr8bit, 46 | OpenNiIr24bit, 47 | OpenNiIrProj, 48 | OpenNiIr8bitProj, 49 | OpenNiGrey 50 | }; 51 | 52 | struct PANGOLIN_EXPORT OpenNiStreamMode 53 | { 54 | OpenNiStreamMode( 55 | OpenNiSensorType sensor_type=OpenNiUnassigned, 56 | ImageDim dim=ImageDim(640,480), int fps=30, int device=0 57 | ) 58 | : sensor_type(sensor_type), dim(dim), fps(fps), device(device) 59 | { 60 | 61 | } 62 | 63 | OpenNiSensorType sensor_type; 64 | ImageDim dim; 65 | int fps; 66 | int device; 67 | }; 68 | 69 | } 70 | 71 | #endif // PANGOLIN_OPENNI_COMMON_H 72 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/pango_video.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_PANGO_VIDEO_H 29 | #define PANGOLIN_PANGO_VIDEO_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | class PANGOLIN_EXPORT PangoVideo 38 | : public VideoInterface, public VideoPropertiesInterface, public VideoPlaybackInterface 39 | { 40 | public: 41 | PangoVideo(const std::string& filename, bool realtime = true); 42 | ~PangoVideo(); 43 | 44 | // Implement VideoInterface 45 | 46 | size_t SizeBytes() const PANGOLIN_OVERRIDE; 47 | 48 | const std::vector& Streams() const PANGOLIN_OVERRIDE; 49 | 50 | void Start() PANGOLIN_OVERRIDE; 51 | 52 | void Stop() PANGOLIN_OVERRIDE; 53 | 54 | bool GrabNext( unsigned char* image, bool wait = true ) PANGOLIN_OVERRIDE; 55 | 56 | bool GrabNewest( unsigned char* image, bool wait = true ) PANGOLIN_OVERRIDE; 57 | 58 | // Implement VideoPropertiesInterface 59 | 60 | const json::value& DeviceProperties() const PANGOLIN_OVERRIDE; 61 | 62 | const json::value& FrameProperties() const PANGOLIN_OVERRIDE; 63 | 64 | 65 | // Implement VideoPlaybackInterface 66 | 67 | int GetCurrentFrameId() const PANGOLIN_OVERRIDE; 68 | 69 | int GetTotalFrames() const PANGOLIN_OVERRIDE; 70 | 71 | int Seek(int frameid) PANGOLIN_OVERRIDE; 72 | 73 | protected: 74 | int FindSource(); 75 | 76 | PacketStreamReader reader; 77 | size_t size_bytes; 78 | std::vector streams; 79 | json::value device_properties; 80 | json::value frame_properties; 81 | int src_id; 82 | int frame_id; 83 | }; 84 | 85 | } 86 | #endif // PANGOLIN_PANGO_VIDEO_H 87 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/pango_video_output.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_PANGO_VIDEO_OUTPUT_H 29 | #define PANGOLIN_PANGO_VIDEO_OUTPUT_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | class PANGOLIN_EXPORT PangoVideoOutput : public VideoOutputInterface 38 | { 39 | public: 40 | PangoVideoOutput(const std::string& filename); 41 | ~PangoVideoOutput(); 42 | 43 | const std::vector& Streams() const PANGOLIN_OVERRIDE; 44 | void SetStreams(const std::vector& streams, const std::string& uri, const json::value& device_properties) PANGOLIN_OVERRIDE; 45 | int WriteStreams(unsigned char* data, const json::value& frame_properties) PANGOLIN_OVERRIDE; 46 | 47 | protected: 48 | void WriteHeader(); 49 | 50 | std::vector streams; 51 | std::string input_uri; 52 | json::value device_properties; 53 | 54 | PacketStreamWriter packetstream; 55 | int packetstreamsrcid; 56 | size_t total_frame_size; 57 | }; 58 | 59 | } 60 | #endif // PANGOLIN_PANGO_VIDEO_OUTPUT_H 61 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/pvn_video.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_PVN_H 29 | #define PANGOLIN_PVN_H 30 | 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | namespace pangolin 38 | { 39 | 40 | class PANGOLIN_EXPORT PvnVideo : public VideoInterface 41 | { 42 | public: 43 | PvnVideo(const std::string& filename, bool realtime = false); 44 | ~PvnVideo(); 45 | 46 | //! Implement VideoInput::Start() 47 | void Start(); 48 | 49 | //! Implement VideoInput::Stop() 50 | void Stop(); 51 | 52 | //! Implement VideoInput::SizeBytes() 53 | size_t SizeBytes() const; 54 | 55 | //! Implement VideoInput::Streams() 56 | const std::vector& Streams() const; 57 | 58 | //! Implement VideoInput::GrabNext() 59 | bool GrabNext( unsigned char* image, bool wait = true ); 60 | 61 | //! Implement VideoInput::GrabNewest() 62 | bool GrabNewest( unsigned char* image, bool wait = true ); 63 | 64 | protected: 65 | int frames; 66 | std::ifstream file; 67 | 68 | std::vector streams; 69 | size_t frame_size_bytes; 70 | 71 | bool realtime; 72 | pangolin::basetime frame_interval; 73 | pangolin::basetime last_frame; 74 | 75 | void ReadFileHeader(); 76 | }; 77 | 78 | } 79 | 80 | 81 | #endif //PANGOLIN_PVN_H 82 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/shift.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_SHIFT_H 29 | #define PANGOLIN_VIDEO_SHIFT_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | // Video class that debayers its video input using the given method. 38 | class PANGOLIN_EXPORT ShiftVideo : public VideoInterface, public VideoFilterInterface 39 | { 40 | public: 41 | ShiftVideo(VideoInterface* videoin, VideoPixelFormat new_fmt, int shift_right_bits = 0, unsigned int mask = 0xFFFF); 42 | ~ShiftVideo(); 43 | 44 | //! Implement VideoInput::Start() 45 | void Start(); 46 | 47 | //! Implement VideoInput::Stop() 48 | void Stop(); 49 | 50 | //! Implement VideoInput::SizeBytes() 51 | size_t SizeBytes() const; 52 | 53 | //! Implement VideoInput::Streams() 54 | const std::vector& Streams() const; 55 | 56 | //! Implement VideoInput::GrabNext() 57 | bool GrabNext( unsigned char* image, bool wait = true ); 58 | 59 | //! Implement VideoInput::GrabNewest() 60 | bool GrabNewest( unsigned char* image, bool wait = true ); 61 | 62 | std::vector& InputStreams(); 63 | 64 | protected: 65 | std::vector videoin; 66 | std::vector streams; 67 | size_t size_bytes; 68 | unsigned char* buffer; 69 | int shift_right_bits; 70 | unsigned int mask; 71 | }; 72 | 73 | } 74 | 75 | #endif // PANGOLIN_VIDEO_SHIFT_H 76 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/teli.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2015 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_TELI_H 29 | #define PANGOLIN_VIDEO_TELI_H 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | 36 | namespace pangolin 37 | { 38 | 39 | // Video class that outputs test video signal. 40 | class PANGOLIN_EXPORT TeliVideo : public VideoInterface 41 | { 42 | public: 43 | TeliVideo(); 44 | TeliVideo(const ImageRoi& roi); 45 | ~TeliVideo(); 46 | 47 | //! Implement VideoInput::Start() 48 | void Start(); 49 | 50 | //! Implement VideoInput::Stop() 51 | void Stop(); 52 | 53 | //! Implement VideoInput::SizeBytes() 54 | size_t SizeBytes() const; 55 | 56 | //! Implement VideoInput::Streams() 57 | const std::vector& Streams() const; 58 | 59 | //! Implement VideoInput::GrabNext() 60 | bool GrabNext( unsigned char* image, bool wait = true ); 61 | 62 | //! Implement VideoInput::GrabNewest() 63 | bool GrabNewest( unsigned char* image, bool wait = true ); 64 | 65 | inline Teli::CAM_HANDLE GetCameraHandle() { 66 | return cam; 67 | } 68 | 69 | inline Teli::CAM_STRM_HANDLE GetCameraStreamHandle() { 70 | return strm; 71 | } 72 | 73 | protected: 74 | void Initialise(const ImageRoi& roi); 75 | 76 | std::vector streams; 77 | size_t size_bytes; 78 | 79 | Teli::CAM_HANDLE cam; 80 | Teli::CAM_STRM_HANDLE strm; 81 | HANDLE hStrmCmpEvt; 82 | }; 83 | 84 | } 85 | 86 | #endif // PANGOLIN_VIDEO_TELI_H 87 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/test.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_TEST_H 29 | #define PANGOLIN_VIDEO_TEST_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | // Video class that outputs test video signal. 38 | class PANGOLIN_EXPORT TestVideo : public VideoInterface 39 | { 40 | public: 41 | TestVideo(size_t w, size_t h, size_t n, std::string pix_fmt); 42 | ~TestVideo(); 43 | 44 | //! Implement VideoInput::Start() 45 | void Start(); 46 | 47 | //! Implement VideoInput::Stop() 48 | void Stop(); 49 | 50 | //! Implement VideoInput::SizeBytes() 51 | size_t SizeBytes() const; 52 | 53 | //! Implement VideoInput::Streams() 54 | const std::vector& Streams() const; 55 | 56 | //! Implement VideoInput::GrabNext() 57 | bool GrabNext( unsigned char* image, bool wait = true ); 58 | 59 | //! Implement VideoInput::GrabNewest() 60 | bool GrabNewest( unsigned char* image, bool wait = true ); 61 | 62 | protected: 63 | std::vector streams; 64 | size_t size_bytes; 65 | }; 66 | 67 | } 68 | 69 | #endif // PANGOLIN_VIDEO_TEST_H 70 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/unpack.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_UNPACK_H 29 | #define PANGOLIN_VIDEO_UNPACK_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | // Video class that debayers its video input using the given method. 38 | class PANGOLIN_EXPORT UnpackVideo : 39 | public VideoInterface, public VideoFilterInterface 40 | { 41 | public: 42 | UnpackVideo(VideoInterface* videoin, VideoPixelFormat new_fmt); 43 | ~UnpackVideo(); 44 | 45 | //! Implement VideoInput::Start() 46 | void Start(); 47 | 48 | //! Implement VideoInput::Stop() 49 | void Stop(); 50 | 51 | //! Implement VideoInput::SizeBytes() 52 | size_t SizeBytes() const; 53 | 54 | //! Implement VideoInput::Streams() 55 | const std::vector& Streams() const; 56 | 57 | //! Implement VideoInput::GrabNext() 58 | bool GrabNext( unsigned char* image, bool wait = true ); 59 | 60 | //! Implement VideoInput::GrabNewest() 61 | bool GrabNewest( unsigned char* image, bool wait = true ); 62 | 63 | std::vector& InputStreams(); 64 | 65 | protected: 66 | std::vector videoin; 67 | std::vector streams; 68 | size_t size_bytes; 69 | unsigned char* buffer; 70 | }; 71 | 72 | } 73 | 74 | #endif // PANGOLIN_VIDEO_UNPACK_H 75 | -------------------------------------------------------------------------------- /Pangolin/include/pangolin/video/drivers/video_splitter.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #ifndef PANGOLIN_VIDEO_SPLITTER_H 29 | #define PANGOLIN_VIDEO_SPLITTER_H 30 | 31 | #include 32 | #include 33 | 34 | namespace pangolin 35 | { 36 | 37 | class PANGOLIN_EXPORT VideoSplitter 38 | : public VideoInterface, public VideoFilterInterface 39 | { 40 | public: 41 | VideoSplitter(VideoInterface* videoin, const std::vector& streams); 42 | 43 | ~VideoSplitter(); 44 | 45 | size_t SizeBytes() const; 46 | 47 | const std::vector& Streams() const; 48 | 49 | void Start(); 50 | 51 | void Stop(); 52 | 53 | bool GrabNext( unsigned char* image, bool wait = true ); 54 | 55 | bool GrabNewest( unsigned char* image, bool wait = true ); 56 | 57 | std::vector& InputStreams(); 58 | 59 | protected: 60 | std::vector videoin; 61 | std::vector streams; 62 | }; 63 | 64 | 65 | } 66 | 67 | #endif // PANGOLIN_VIDEO_SPLITTER_H 68 | -------------------------------------------------------------------------------- /Pangolin/src/PangolinConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Compute paths 2 | get_filename_component( PROJECT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH ) 3 | SET( Pangolin_INCLUDE_DIRS "@EXPORT_LIB_INC_DIR@;@USER_INC@" ) 4 | SET( Pangolin_INCLUDE_DIR "@EXPORT_LIB_INC_DIR@;@USER_INC@" ) 5 | 6 | # Library dependencies (contains definitions for IMPORTED targets) 7 | if( NOT TARGET @LIBRARY_NAME@ AND NOT @PROJECT_NAME@_BINARY_DIR ) 8 | include( "${PROJECT_CMAKE_DIR}/@PROJECT_NAME@Targets.cmake" ) 9 | @ExternConfig@ 10 | endif() 11 | 12 | SET( Pangolin_LIBRARIES @LIBRARY_NAME@ ) 13 | SET( Pangolin_LIBRARY @LIBRARY_NAME@ ) 14 | SET( Pangolin_CMAKEMODULES @CMAKE_CURRENT_SOURCE_DIR@/../CMakeModules ) 15 | -------------------------------------------------------------------------------- /Pangolin/src/PangolinConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION "@PANGOLIN_VERSION@") 2 | 3 | # Check build type is valid 4 | if( "System:${CMAKE_SYSTEM_NAME},Win64:${CMAKE_CL_64},Android:${ANDROID},iOS:${IOS}" STREQUAL 5 | "System:@CMAKE_SYSTEM_NAME@,Win64:@CMAKE_CL_64@,Android:@ANDROID@,iOS:@IOS@" ) 6 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 7 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 8 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 9 | else() 10 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 11 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 12 | set(PACKAGE_VERSION_EXACT TRUE) 13 | endif() 14 | endif() 15 | else() 16 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 17 | endif() 18 | -------------------------------------------------------------------------------- /Pangolin/src/_embed_/fonts/AnonymousPro.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FangGet/pangolin_android/63ec35c3e7f89b8ddc86aebb81df12c0d3bde432/Pangolin/src/_embed_/fonts/AnonymousPro.ttf -------------------------------------------------------------------------------- /Pangolin/src/config.h.in: -------------------------------------------------------------------------------- 1 | #ifndef PANGOLIN_CONFIG_H 2 | #define PANGOLIN_CONFIG_H 3 | 4 | /* 5 | * Configuration Header for Pangolin 6 | */ 7 | 8 | /// Version 9 | #define PANGOLIN_VERSION_MAJOR @PANGOLIN_VERSION_MAJOR@ 10 | #define PANGOLIN_VERSION_MINOR @PANGOLIN_VERSION_MINOR@ 11 | #define PANGOLIN_VERSION_STRING "@PANGOLIN_VERSION@" 12 | 13 | /// Pangolin options 14 | #cmakedefine BUILD_PANGOLIN_GUI 15 | #cmakedefine BUILD_PANGOLIN_VARS 16 | #cmakedefine BUILD_PANGOLIN_VIDEO 17 | 18 | /// Configured libraries 19 | #cmakedefine HAVE_CUDA 20 | #cmakedefine HAVE_PYTHON 21 | 22 | #cmakedefine CPP11_NO_BOOST 23 | #cmakedefine HAVE_EIGEN 24 | #cmakedefine HAVE_TOON 25 | 26 | #cmakedefine HAVE_DC1394 27 | #cmakedefine HAVE_V4L 28 | #cmakedefine HAVE_OPENNI 29 | #cmakedefine HAVE_OPENNI2 30 | #cmakedefine HAVE_UVC 31 | #cmakedefine HAVE_DEPTHSENSE 32 | #cmakedefine HAVE_TELICAM 33 | #cmakedefine HAVE_PLEORA 34 | 35 | #cmakedefine HAVE_FFMPEG 36 | #cmakedefine HAVE_FFMPEG_MAX_ANALYZE_DURATION2 37 | #cmakedefine HAVE_FFMPEG_AVFORMAT_ALLOC_OUTPUT_CONTEXT2 38 | 39 | #cmakedefine HAVE_GLEW 40 | #cmakedefine GLEW_STATIC 41 | 42 | #cmakedefine HAVE_GLUT 43 | #cmakedefine HAVE_FREEGLUT 44 | #cmakedefine HAVE_APPLE_OPENGL_FRAMEWORK 45 | #cmakedefine HAVE_MODIFIED_OSXGLUT 46 | #cmakedefine HAVE_GLES 47 | #cmakedefine HAVE_GLES_2 48 | #cmakedefine HAVE_OCULUS 49 | 50 | #cmakedefine HAVE_PNG 51 | #cmakedefine HAVE_JPEG 52 | #cmakedefine HAVE_TIFF 53 | #cmakedefine HAVE_OPENEXR 54 | 55 | /// Platform 56 | #cmakedefine _UNIX_ 57 | #cmakedefine _WIN_ 58 | #cmakedefine _OSX_ 59 | #cmakedefine _LINUX_ 60 | #cmakedefine _ANDROID_ 61 | #cmakedefine _IOS_ 62 | 63 | /// Compiler 64 | #cmakedefine _GCC_ 65 | #cmakedefine _CLANG_ 66 | #cmakedefine _MSVC_ 67 | 68 | /// Defines generated when calling into Pangolin API. Not to be 69 | /// used in compiled library code, only inlined header code. 70 | #if (__cplusplus > 199711L) || (_MSC_VER >= 1700) 71 | #define CALLEE_HAS_CPP11 72 | #define CALLEE_HAS_RVALREF 73 | #endif 74 | 75 | #if (__cplusplus > 199711L) || (_MSC_VER >= 1800) 76 | #define CALLEE_HAS_VARIADIC_TEMPLATES 77 | #endif 78 | 79 | #endif //PANGOLIN_CONFIG_H 80 | -------------------------------------------------------------------------------- /Pangolin/src/gl/compat/gl2engine.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | GlEngine& glEngine() 34 | { 35 | static GlEngine engine; 36 | return engine; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Pangolin/src/gl/compat/gl2engine.cpp~: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2014 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | GlEngine& glEngine() 34 | { 35 | static GlEngine engine; 36 | return engine; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /Pangolin/src/gl/glchar.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | GlChar::GlChar() 34 | : x_step(0.0f) 35 | { 36 | // Uninitialised 37 | } 38 | 39 | GlChar::GlChar(int tw, int th, int x, int y, int w, int h, GLfloat advance, GLfloat ox, GLfloat oy) 40 | : x_step(advance) 41 | { 42 | const GLfloat u = (GLfloat)x / (GLfloat)tw; 43 | const GLfloat v = (GLfloat)y / (GLfloat)th; 44 | const GLfloat u2 = (GLfloat)(x + w) / (GLfloat)tw; 45 | const GLfloat v2 = (GLfloat)(y + h) / (GLfloat)th; 46 | 47 | // Setup u,v tex coords 48 | vs[0] = XYUV(ox, oy, u,v ); 49 | vs[1] = XYUV(ox, oy-h, u,v2 ); 50 | vs[2] = XYUV(w+ox, oy-h, u2,v2 ); 51 | vs[3] = XYUV(w+ox, oy, u2,v ); 52 | 53 | y_min = oy-h; 54 | y_max = oy; 55 | } 56 | 57 | void GlChar::Draw() const 58 | { 59 | glVertexPointer(2, GL_FLOAT, sizeof(XYUV), &vs[0].x); 60 | glEnableClientState(GL_VERTEX_ARRAY); 61 | glTexCoordPointer(2, GL_FLOAT, sizeof(XYUV), &vs[0].tu); 62 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); 63 | glEnable(GL_TEXTURE_2D); 64 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 65 | glDisable(GL_TEXTURE_2D); 66 | glDisableClientState(GL_VERTEX_ARRAY); 67 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /Pangolin/src/gl/gltexturecache.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | TextureCache& TextureCache::I() { 34 | static TextureCache instance; 35 | return instance; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /Pangolin/src/handler/handler_glbuffer.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | namespace pangolin { 32 | 33 | Handler3DFramebuffer::Handler3DFramebuffer(GlFramebuffer& fb, pangolin::OpenGlRenderState& cam_state, pangolin::AxisDirection enforce_up, float trans_scale) 34 | : pangolin::Handler3D(cam_state,enforce_up, trans_scale), fb(fb) 35 | { 36 | } 37 | 38 | void Handler3DFramebuffer::GetPosNormal(pangolin::View& view, int x, int y, GLprecision p[3], GLprecision Pw[3], GLprecision Pc[3], GLprecision n[3], GLprecision default_z) 39 | { 40 | fb.Bind(); 41 | Handler3D::GetPosNormal(view,x,y,p,Pw,Pc,n,default_z); 42 | fb.Unbind(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Pangolin/src/image/image_common.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2011 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | namespace pangolin 34 | { 35 | 36 | const VideoPixelFormat SupportedVideoPixelFormats[] = 37 | { 38 | {"GRAY8", 1, {8}, 8, false}, 39 | {"GRAY10", 1, {10}, 10, false}, 40 | {"GRAY12", 1, {12}, 12, false}, 41 | {"GRAY16LE", 1, {16}, 16, false}, 42 | {"Y400A", 2, {8,8}, 16, false}, 43 | {"RGB24", 3, {8,8,8}, 24, false}, 44 | {"BGR24", 3, {8,8,8}, 24, false}, 45 | {"YUYV422", 3, {4,2,2}, 16, false}, 46 | {"RGBA", 4, {8,8,8,8}, 32, false}, 47 | {"GRAY32F", 1, {32}, 32, false}, 48 | {"RGB96F", 3, {32,32,32}, 96, false}, 49 | {"",0,{0,0,0,0},0,0} 50 | }; 51 | 52 | VideoPixelFormat VideoFormatFromString(const std::string& format) 53 | { 54 | for(int i=0; !SupportedVideoPixelFormats[i].format.empty(); ++i) 55 | if(!format.compare(SupportedVideoPixelFormats[i].format)) 56 | return SupportedVideoPixelFormats[i]; 57 | throw VideoException("Unknown Format",format); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /Pangolin/src/ios/PangolinAppDelegate.mm: -------------------------------------------------------------------------------- 1 | // 2 | // GlTestAppDelegate.m 3 | // gltest 4 | // 5 | // Created by Steven Lovegrove on 30/01/2014. 6 | // Copyright (c) 2014 Steven Lovegrove. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @implementation PangolinAppDelegate 13 | 14 | @synthesize window=_window; 15 | 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | return YES; 20 | } 21 | 22 | - (void)applicationWillResignActive:(UIApplication *)application 23 | { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application 29 | { 30 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 32 | } 33 | 34 | - (void)applicationWillEnterForeground:(UIApplication *)application 35 | { 36 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 37 | } 38 | 39 | - (void)applicationDidBecomeActive:(UIApplication *)application 40 | { 41 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 42 | } 43 | 44 | - (void)applicationWillTerminate:(UIApplication *)application 45 | { 46 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Pangolin/src/video/drivers/test.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | void setRandomData(unsigned char * arr, int size){ 34 | for(int i = 0 ; i < size;i++) { 35 | // arr[i] = (unsigned char)(i * 255.0 / size); 36 | arr[i] = (unsigned char)(rand()/(RAND_MAX/255.0)); 37 | } 38 | } 39 | 40 | TestVideo::TestVideo(size_t w, size_t h, size_t n, std::string pix_fmt) 41 | { 42 | const VideoPixelFormat pfmt = VideoFormatFromString(pix_fmt); 43 | 44 | size_bytes = 0; 45 | 46 | for(size_t c=0; c < n; ++c) { 47 | const StreamInfo stream_info(pfmt, w, h, (w*pfmt.bpp)/8, 0); 48 | streams.push_back(stream_info); 49 | size_bytes += w*h*(pfmt.bpp)/8; 50 | } 51 | } 52 | 53 | TestVideo::~TestVideo() 54 | { 55 | 56 | } 57 | 58 | //! Implement VideoInput::Start() 59 | void TestVideo::Start() 60 | { 61 | 62 | } 63 | 64 | //! Implement VideoInput::Stop() 65 | void TestVideo::Stop() 66 | { 67 | 68 | } 69 | 70 | //! Implement VideoInput::SizeBytes() 71 | size_t TestVideo::SizeBytes() const 72 | { 73 | return size_bytes; 74 | } 75 | 76 | //! Implement VideoInput::Streams() 77 | const std::vector& TestVideo::Streams() const 78 | { 79 | return streams; 80 | } 81 | 82 | //! Implement VideoInput::GrabNext() 83 | bool TestVideo::GrabNext( unsigned char* image, bool wait ) 84 | { 85 | setRandomData(image, size_bytes); 86 | return true; 87 | } 88 | 89 | //! Implement VideoInput::GrabNewest() 90 | bool TestVideo::GrabNewest( unsigned char* image, bool wait ) 91 | { 92 | return GrabNext(image,wait); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /Pangolin/src/video/drivers/video_splitter.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the Pangolin Project. 2 | * http://github.com/stevenlovegrove/Pangolin 3 | * 4 | * Copyright (c) 2013 Steven Lovegrove 5 | * 6 | * Permission is hereby granted, free of charge, to any person 7 | * obtaining a copy of this software and associated documentation 8 | * files (the "Software"), to deal in the Software without 9 | * restriction, including without limitation the rights to use, 10 | * copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | * copies of the Software, and to permit persons to whom the 12 | * Software is furnished to do so, subject to the following 13 | * conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be 16 | * included in all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | * OTHER DEALINGS IN THE SOFTWARE. 26 | */ 27 | 28 | #include 29 | 30 | namespace pangolin 31 | { 32 | 33 | VideoSplitter::VideoSplitter(VideoInterface *src, const std::vector& streams) 34 | : streams(streams) 35 | { 36 | videoin.push_back(src); 37 | 38 | // Warn if stream over-runs input stream 39 | for(unsigned int i=0; i < streams.size(); ++i) { 40 | if(src->SizeBytes() < (size_t)streams[i].Offset() + streams[i].SizeBytes() ) { 41 | pango_print_warn("VideoSplitter: stream extends past end of input.\n"); 42 | break; 43 | } 44 | } 45 | } 46 | 47 | VideoSplitter::~VideoSplitter() 48 | { 49 | delete videoin[0]; 50 | } 51 | 52 | size_t VideoSplitter::SizeBytes() const 53 | { 54 | return videoin[0]->SizeBytes(); 55 | } 56 | 57 | const std::vector& VideoSplitter::Streams() const 58 | { 59 | return streams; 60 | } 61 | 62 | void VideoSplitter::Start() 63 | { 64 | videoin[0]->Start(); 65 | } 66 | 67 | void VideoSplitter::Stop() 68 | { 69 | videoin[0]->Stop(); 70 | } 71 | 72 | bool VideoSplitter::GrabNext( unsigned char* image, bool wait ) 73 | { 74 | return videoin[0]->GrabNext(image, wait); 75 | } 76 | 77 | bool VideoSplitter::GrabNewest( unsigned char* image, bool wait ) 78 | { 79 | return videoin[0]->GrabNewest(image, wait); 80 | } 81 | 82 | std::vector& VideoSplitter::InputStreams() 83 | { 84 | return videoin; 85 | } 86 | 87 | 88 | 89 | } 90 | -------------------------------------------------------------------------------- /Pangolin/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(BUILD_PANGOLIN_GUI AND BUILD_PANGOLIN_VARS ) 2 | if(BUILD_PANGOLIN_VIDEO) 3 | add_subdirectory(VideoViewer) 4 | endif() 5 | endif() 6 | -------------------------------------------------------------------------------- /Pangolin/tools/VideoViewer/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Find Pangolin (https://github.com/stevenlovegrove/Pangolin) 2 | find_package(Pangolin 0.2 REQUIRED) 3 | include_directories(${Pangolin_INCLUDE_DIRS}) 4 | 5 | add_executable(VideoViewer main.cpp) 6 | target_link_libraries(VideoViewer ${Pangolin_LIBRARIES}) 7 | 8 | 9 | # Make file association 10 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND ${CMAKE_MAJOR_VERSION} VERSION_GREATER "2.9.9" ) 11 | file( GENERATE 12 | OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pango.desktop" 13 | CONTENT 14 | "[Desktop Entry] 15 | Name=PangoVideoViewer 16 | Exec=$ 17 | MimeType=application/x-pango 18 | Icon= 19 | Terminal=false 20 | Type=Application 21 | Categories=AudioVideo;Player;Video; 22 | Comment=" 23 | ) 24 | 25 | add_custom_target( 26 | install-mime-info 27 | COMMAND mkdir -p $ENV{HOME}/.local/share/mime/packages/ 28 | COMMAND mkdir -p $ENV{HOME}/.local/share/applications/ 29 | COMMAND cp "${CMAKE_CURRENT_SOURCE_DIR}/application-x-pango.xml" $ENV{HOME}/.local/share/mime/packages/ 30 | COMMAND cp "${CMAKE_CURRENT_BINARY_DIR}/pango.desktop" $ENV{HOME}/.local/share/applications/ 31 | COMMAND update-mime-database $ENV{HOME}/.local/share/mime 32 | COMMAND update-desktop-database $ENV{HOME}/.local/share/applications 33 | DEPENDS VideoViewer 34 | VERBATIM 35 | ) 36 | endif() 37 | -------------------------------------------------------------------------------- /Pangolin/tools/VideoViewer/application-x-pango.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Pangolin Video File 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pangolin_android 2 | A repository for pangolin on android 3 | 4 | ## MainPage 5 | This repository is aimed at transplanting pangolin to android.Author of Pangolin is stevenlovegrove and source repository is:[https://github.com/stevenlovegrove/Pangolin](https://github.com/stevenlovegrove/Pangolin).Introduction about Pangolin detail can be found at source code's github page. Original Pangolin contains a method to transplant it to android however hard to achieve with some errors inside the CMakeLists and source code.I made a small change for Pangolin to make it suitable for OPENGL ES/ES2. 6 | 7 | ## Code 8 | Find the latest version on [Github](https://github.com): 9 | ``` 10 | git clone https://github.com/FangGet/pangolin_android.git 11 | ``` 12 | 13 | ## Standalone Libs And Examples 14 | Compiled libs and examples for android can be found here: [http://pan.baidu.com/s/1c2dXRXm](http://pan.baidu.com/s/1c2dXRXm); 15 | 16 | ## Dependencies 17 | * Android SDK; 18 | * Android NDK(>r5e); 19 | * Android-Cmake(given); 20 | 21 | You should have installed Android SDK on your Linux and environment variables should have been setted properly. SDK have to be updated with version>android-8. 22 | 23 | Android NDK can be only extracted to certain directory. 24 | 25 | Android-Cmake may not perform properly on Windows. 26 | 27 | Other dependencies for pangolin can be found at[https://github.com/FangGet/pangolin_android/tree/master/Pangolin](https://github.com/FangGet/pangolin_android/tree/master/Pangolin). 28 | 29 | ## Building 30 | pangolin_android uses CMake portable pre-build tool. Please excute the following at a shell (or the equivelent using a GUI): 31 | ``` 32 | git clone https://github.com/FangGet/pangolin_android.git 33 | export $ANDROID_NDK=you android ndk root directory 34 | cd pangolin_android 35 | mkdir build 36 | cd build 37 | cmake -DCMAKE_TOOLCHAIN_FILE=../android-cmake/android.toolchain.cmake \ 38 | -DANDROID_NDK=$ANDROID_NDK \ 39 | -DCMAKE_BUILD_TYPE=Release \ 40 | -DANDROID_ABI="armeabi-v7a with NEON" \ 41 | -DANDROID_NATIVE_API_LEVEL=android-14 \ 42 | 43 | cmake --build 44 | ``` 45 | ANDROID_BUILD_TYPE:(must be specified) 46 | * Debug 47 | * Release 48 | 49 | Android_ABI: 50 | * armeabi 51 | * armeabi-v7a 52 | * armeabi-v7a with NEON 53 | 54 | ## Issues 55 | Please visit [Github Issues](https://github.com/FangGet/pangolin_android/issues) to view and report problems with pangolin_android. I will try my best to answer it. 56 | 57 | Contact with: fangasfrank@gmail.com 58 | -------------------------------------------------------------------------------- /android-cmake/AndroidNdkModules.cmake: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014, Pavel Rojtberg 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, 8 | # this list of conditions and the following disclaimer. 9 | # 10 | # 2. Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 14 | # 3. Neither the name of the copyright holder nor the names of its 15 | # contributors may be used to endorse or promote products derived from this 16 | # software without specific prior written permission. 17 | # 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | # POSSIBILITY OF SUCH DAMAGE. 29 | 30 | macro(android_ndk_import_module_cpufeatures) 31 | if(ANDROID) 32 | include_directories(${ANDROID_NDK}/sources/android/cpufeatures) 33 | add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) 34 | target_link_libraries(cpufeatures dl) 35 | endif() 36 | endmacro() 37 | 38 | macro(android_ndk_import_module_native_app_glue) 39 | if(ANDROID) 40 | include_directories(${ANDROID_NDK}/sources/android/native_app_glue) 41 | add_library(native_app_glue ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) 42 | target_link_libraries(native_app_glue log) 43 | endif() 44 | endmacro() 45 | 46 | macro(android_ndk_import_module_ndk_helper) 47 | if(ANDROID) 48 | android_ndk_import_module_cpufeatures() 49 | android_ndk_import_module_native_app_glue() 50 | 51 | include_directories(${ANDROID_NDK}/sources/android/ndk_helper) 52 | file(GLOB _NDK_HELPER_SRCS ${ANDROID_NDK}/sources/android/ndk_helper/*.cpp ${ANDROID_NDK}/sources/android/ndk_helper/gl3stub.c) 53 | add_library(ndk_helper ${_NDK_HELPER_SRCS}) 54 | target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue) 55 | 56 | unset(_NDK_HELPER_SRCS) 57 | endif() 58 | endmacro() --------------------------------------------------------------------------------