-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5ed6812
Showing
71 changed files
with
7,761 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
BasedOnStyle: Google | ||
IndentWidth: 2 | ||
ColumnLimit: 120 | ||
AllowShortFunctionsOnASingleLine: Inline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Created by https://www.gitignore.io/api/c++,cmake,cuda,qt | ||
|
||
### C++ ### | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
|
||
### CMake ### | ||
CMakeCache.txt | ||
CMakeFiles | ||
CMakeScripts | ||
Makefile | ||
cmake_install.cmake | ||
install_manifest.txt | ||
|
||
|
||
### CUDA ### | ||
*.i | ||
*.ii | ||
*.gpu | ||
*.ptx | ||
*.cubin | ||
*.fatbin | ||
|
||
|
||
### Qt ### | ||
# C++ objects and libs | ||
|
||
*.slo | ||
*.lo | ||
*.o | ||
*.a | ||
*.la | ||
*.lai | ||
*.so | ||
*.dll | ||
*.dylib | ||
|
||
# Qt-es | ||
|
||
/.qmake.cache | ||
/.qmake.stash | ||
*.pro.user | ||
*.pro.user.* | ||
*.qbs.user | ||
*.qbs.user.* | ||
*.moc | ||
moc_*.cpp | ||
qrc_*.cpp | ||
ui_*.h | ||
Makefile* | ||
*build-* | ||
|
||
# QtCreator | ||
|
||
*.autosave | ||
|
||
# QtCtreator Qml | ||
*.qmlproject.user | ||
*.qmlproject.user.* | ||
|
||
# QtCtreator CMake | ||
CMakeLists.txt.user | ||
|
||
# project-related files | ||
build | ||
.* | ||
IDEAS.md | ||
*~ | ||
evaluation/result | ||
*.pyc | ||
|
||
# generated folders | ||
bin | ||
lib | ||
|
||
evaluation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
image: gitlab.ipb.uni-bonn.de:4567/global/docker-images:ipb_default | ||
|
||
build_release: | ||
script: | ||
- export TERM=xterm | ||
- export SHELL=/bin/bash | ||
- apt-get update -yq | ||
- apt-get install -y libeigen3-dev libboost-filesystem-dev libboost-system-dev libglew-dev | ||
- mkdir build | ||
- cd build | ||
- cmake -DCMAKE_BUILD_TYPE=Release -DOPENGL_VERSION=450 .. | ||
- make | ||
# finally run tests. | ||
# No tests due to missing X11 context... - ctest -VV | ||
stage: build | ||
tags: | ||
- docker | ||
|
||
build_debug: | ||
script: | ||
- export TERM=xterm | ||
- export SHELL=/bin/bash | ||
- apt-get update -yq | ||
- apt-get install -y libeigen3-dev libboost-filesystem-dev libboost-system-dev libglew-dev | ||
- mkdir build | ||
- cd build | ||
- cmake -DCMAKE_BUILD_TYPE=Debug -DOPENGL_VERSION=450 .. | ||
- make | ||
# finally run tests. | ||
# No tests due to missing X11 context... - ctest -VV | ||
stage: build | ||
tags: | ||
- docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
cmake_minimum_required(VERSION 3.2.3) | ||
|
||
project(glow) | ||
|
||
find_package(OpenGL REQUIRED) | ||
find_package(GLEW REQUIRED) | ||
find_package(Boost REQUIRED COMPONENTS filesystem system) | ||
find_package(X11) | ||
|
||
find_package(catkin) | ||
|
||
if(catkin_FOUND) | ||
catkin_package( | ||
INCLUDE_DIRS src/ | ||
LIBRARIES glow glow_util | ||
CFG_EXTRAS GlowShaderCompilation.cmake GenCppFile.cmake | ||
) | ||
endif() | ||
|
||
include_directories(${catkin_INCLUDE_DIRS} src/) | ||
|
||
if(CMAKE_BUILD_TYPE MATCHES Debug) | ||
set(CMAKE_CXX_FLAGS "-std=c++11 -g2 -DDEBUG ${CMAKE_CXX_FLAGS}") | ||
else() | ||
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -O3 -DNDEBUG ${CMAKE_CXX_FLAGS}") | ||
endif() | ||
|
||
message("Using CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}") | ||
|
||
option(ENABLE_NVIDIA_EXT "Enable Nvidia GL capabilites." OFF) | ||
set(OPENGL_VERSION 330 CACHE STRING "Available OpenGL version") | ||
|
||
if(ENABLE_NVIDIA_EXT) | ||
message("Enabling Nvidia OpenGL extensions.") | ||
add_definitions(-DQUERY_MEMORY_NV) | ||
endif() | ||
|
||
add_definitions(-D__GL_VERSION=${OPENGL_VERSION}) | ||
message(STATUS "Using OpenGL version ${OPENGL_VERSION}.") | ||
|
||
add_library(glow | ||
src/glow/glexception.cpp | ||
src/glow/GlProgram.cpp | ||
src/glow/GlShader.cpp | ||
src/glow/GlVertexArray.cpp | ||
src/glow/GlUniform.cpp | ||
src/glow/glutil.cpp | ||
src/glow/GlTexture.cpp | ||
src/glow/GlTextureRectangle.cpp | ||
src/glow/GlFramebuffer.cpp | ||
src/glow/GlRenderbuffer.cpp | ||
src/glow/GlTransformFeedback.cpp | ||
src/glow/GlQuery.cpp | ||
src/glow/GlSampler.cpp | ||
src/glow/GlState.cpp | ||
src/glow/GlColor.cpp | ||
src/glow/GlShaderCache.cpp | ||
src/glow/GlCapabilities.cpp | ||
src/glow/GlTextureBuffer.cpp) | ||
|
||
if(X11_FOUND) | ||
add_library(glow_util | ||
src/glow/util/GlCamera.cpp | ||
src/glow/util/RoSeCamera.cpp | ||
src/glow/util/FpsCamera | ||
src/glow/util/RandomColorGenerator.cpp | ||
src/glow/util/X11OffscreenContext.cpp) | ||
|
||
target_link_libraries(glow_util ${X11_LIBRARIES} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES}) | ||
|
||
else() | ||
add_library(glow_util | ||
src/glow/util/GlCamera.cpp | ||
src/glow/util/RoSeCamera.cpp | ||
src/glow/util/FpsCamera.cpp | ||
src/glow/util/RandomColorGenerator.cpp) | ||
|
||
target_link_libraries(glow_util ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES}) | ||
endif() | ||
|
||
target_link_libraries(glow ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${Boost_LIBRARIES}) | ||
|
||
if(NOT GTEST_FOUND) | ||
|
||
IF(IS_DIRECTORY "/usr/src/gtest/") | ||
MESSAGE(STATUS "Found google test sources in /usr/src/gtest/") | ||
|
||
ADD_SUBDIRECTORY(/usr/src/gtest/ gtest) | ||
|
||
# mimick the behaviour of find_package(GTest) | ||
SET(GTEST_FOUND TRUE) | ||
SET(GTEST_BOTH_LIBRARIES gtest gtest_main) | ||
SET(GTEST_LIBRARIES gtest) | ||
SET(GTEST_MAIN_LIBRARIES gtest_main) | ||
ELSE() | ||
find_package(GTest) | ||
ENDIF() | ||
endif() | ||
|
||
# TODO: Install options for CMake only. | ||
# TODO: and test without catkin. | ||
|
||
|
||
if(GTEST_FOUND) | ||
enable_testing() | ||
# TODO: add testcases. | ||
add_subdirectory(test) | ||
|
||
|
||
endif() | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# OpenGL Object Wrapper (GLOW) -- a high-level layer for OpenGL. | ||
|
||
With this side project, I want to provide a simple high-level interface to OpenGL's objects with the following goals in mind: | ||
|
||
1. simple resource management with automatic generation and deletion of OpenGL objects, | ||
2. object related functions should be related to the object without the need to bind the right object at the right time, | ||
3. catch potential errors or misuse of OpenGL functionality as early as possible, | ||
4. allow only access to **core profile** functionality, since I needed it at some point in time. | ||
|
||
These goals should align with the main purpose of this framework: simple, effortless usage of OpenGL's functionality. | ||
However, it does not aim at providing some framework for GUI creation, etc. | ||
A OpenGL context has to be created independently by virtue of a context/window creation framework, like: | ||
- GLFW3 (http://www.glfw.org/) | ||
- Qt (http://doc.qt.io/qt-5/qt5-intro.html) | ||
- Pangolin (https://github.com/stevenlovegrove/Pangolin) | ||
|
||
I only included a simple headless context for computations & testing. | ||
|
||
This project is work in progress and will be extended over time. | ||
Most of the functionality included was implemented as it was needed by my own projects. | ||
Therefore, you cannot (or better should not) expect feature completness or stability of the interface. | ||
|
||
## Related work | ||
|
||
This project is inspired by some other frameworks, which are perfectly fine, but lack some features or functionality that I want to have in my work. | ||
However, this framework is heavily inspired by these frameworks: | ||
|
||
- Pangolin (https://github.com/stevenlovegrove/Pangolin): Cross-platform GUI framework with OpenGL wrapper objects. | ||
Does not enforce the usage of core functionality. Furthermore, in some parts the code might not run on "pure" core profile contexts and | ||
due to the usage of NVIDIA specific extensions with context from other GPU vendors, like ATI and Intel. | ||
- OOGL (https://github.com/Overv/OOGL): didn't look deeply into this. | ||
- globjects (https://github.com/cginternals/globjects): Pretty complete high-level API for OpenGL. Also wrapping all objects into complete C++-classes. | ||
|
||
## Requirements | ||
- GLEW | ||
- Eigen 3 | ||
|
||
## Features | ||
- *Shader compilation*: I usally have my shader files in separate text files and it's somehow annoying to move these stuff around and make it available relative to the executable. For this purpose, I build a solution based on CMAKE, which simply generates a statically initialized "storage" of shader strings, which can accessed by a call to a static method of `GlShaderCache`. It's somehow nice as it only needs cmake to generate the source, which can be then included in the build and therefore compiled into a library or executable. | ||
|
||
|
||
## Future work | ||
- More documentation, examples, etc. | ||
- Enable/disable functionality for given OpenGL version by virtue of compile flags. | ||
- Feature completness for OpenGL version 4.5 (core profile) | ||
- Cross-plattform functionality | ||
- Extend GLSL parser with additional convenience functions a la Pangolin. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# | ||
# CMake script which is executed via cmake -P GenCppFile.cmake | ||
# Generating a static cache initializer class and its source to statically initialize | ||
# the GLOW shader cache. The variables are passed via the CMake cache. | ||
# | ||
# GLOW_CACHE_CPP_FILENAME: filename of the generated .cpp file. | ||
# GLOW_CACHE_SHADER_FILENAMES: filenames of the shader files for which an entry should be generated. | ||
# | ||
# | ||
# author: jens behley | ||
# | ||
|
||
# needed to avoid calls with empty destination filename | ||
if(GLOW_CACHE_CPP_FILENAME) | ||
|
||
file(LOCK ${GLOW_CACHE_CPP_FILENAME} RESULT_VARIABLE lock_status) | ||
# message(STATUS "lock_status = ${lock_status}") | ||
if(${lock_status} EQUAL "0") | ||
|
||
set(FILE_CONTENT "") | ||
|
||
# message(STATUS ">> GenCppFile: Writing shader source to '${GLOW_CACHE_CPP_FILENAME}'") | ||
# message(STATUS ">> GenCppFile: Shader files: ${GLOW_CACHE_SHADER_FILENAMES}") | ||
|
||
get_filename_component(GLOW_CACHE_NAMESPACE ${GLOW_CACHE_CPP_FILENAME} NAME_WE) | ||
string(MAKE_C_IDENTIFIER ${GLOW_CACHE_NAMESPACE} GLOW_CACHE_NAMESPACE) | ||
# message(STATUS ">> namespace: '${GLOW_CACHE_NAMESPACE}'") | ||
|
||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "// GLOW_CACHE V10\n") | ||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "// This file is automatically generated. All changes will be lost when calling cmake.\n\n") | ||
|
||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "\#include <iostream>\n\#include <glow/GlShaderCache.h>\n\n") | ||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "namespace ${GLOW_CACHE_NAMESPACE} {\n") | ||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "class CacheInitalizer {\n public:\n CacheInitalizer() {\n") | ||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" " glow::GlShaderCache& cache = glow::GlShaderCache::getInstance();\n") | ||
|
||
foreach(shader_file ${GLOW_CACHE_SHADER_FILENAMES}) | ||
file(READ ${shader_file} content) | ||
|
||
# escape special characters for string variable. It might be neccessary to escape more then these? | ||
# Reminder: Quotes are important to avoid removal of ";" | ||
string(REPLACE "\n" "\\n" content "${content}") | ||
string(REPLACE "\"" "\\\"" content "${content}") | ||
|
||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" " cache.insertSource(\"${shader_file}\", \"${content}\");\n") | ||
endforeach() | ||
|
||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" " };\n};\n\n") | ||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "static CacheInitalizer __init__;\n") | ||
string(CONCAT FILE_CONTENT "${FILE_CONTENT}" "} // end namespace ${GLOW_CACHE_NAMESPACE}") | ||
|
||
|
||
file(LOCK ${GLOW_CACHE_CPP_FILENAME} RELEASE) | ||
file(WRITE ${GLOW_CACHE_CPP_FILENAME} "${FILE_CONTENT}") | ||
|
||
endif() | ||
|
||
endif() |
Oops, something went wrong.