Originated from the famous Learnopengl.com tutorial.
Now it's a playground for my simple graphical experiments - more concerned about rendering algorithms and scientific papers, less concerned about maximizing performance (though within realtime)
Features:
- shader code generation (
#include,#define) - hot-reloading engine dynamic library, without stopping the application
- hot-reloading OpenGL shaders, without stopping the application
- the project is split into:
- engine - contains the main loop, window management, rendering wrappers and utilities
- application - instantiates an engine, provides window callbacks, provides the rendering callback, instantiates and uses engine utilities
The project was developed and tested on Ubuntu 20.04 (Wayland).
First of all you need GNU Make (tested version 4.2.1)
Try to run
make -versionin console. If it's not already installed, runsudo apt update sudo apt install make
Now you can choose to install prerequisites automatically, or manually
-
Automatically: it will execute
sudocommands, so make sure you trust us :)Run in console
make init_repo
-
Manually:
-
clangcompiler (tested with version10.0.0-4ubuntu1). Example installation:sudo apt install clang
-
Linux display libraries. Example installation:
sudo apt install libwayland-dev libxkbcommon-dev xorg-dev
-
CMake (tested version
3.29.3). Example installation:sudo apt install cmake
-
(Optional) Bear tool (tested version
3.1.5) Needed if you prefer to useclangdas development tool.bearsimply dumpsclangbuild commands intocompile_commands.jsonfile required byclangd.# to install sudo apt install bear # to run bear on this project make intellisense
-
Internal dependencies (you don't need to do anything to install):
- OpenGL
4.3 - imgui
v1.91.2for user interface - GLFW
v3.4for cross-platform window interaction - GLM
v1.0.1for math utilities - GLAD
v2.0.7for fetching OpenGL function pointers - spdlog
v1.14.1for logging - STB image
v2.30for decoding images - concurrentqueue
v1.0.4for multi-threaded message queue - cr.h for simple hot reloading of dynamic libraries
- ccache
v4.8.3for faster compilation
-
Clone the repository
git clone --recurse-submodules https://github.com/laralex/RenderingExperiments.git
-
Run this to build everything (
-j16for faster multi-threaded build)make -j16
NOTE: you can tweak build options in the
Makefile. You can disable an option by commenting it out with#Changing of the options (except for
DEBUG) would require a clean build (removebuild/debugorbuild/releasedirectory)# For lot of logs, and debugger support (unoptimized code!) DEBUG?=1 # Start the application right after successful build RUN_AFTER_BUILD?=1 # Allows to recompile and update behavior of a running application. Builds the application code as a dynamic library. USE_HOT_RELOADING?=1 # For incremental compilation. Dumps GPU Make dependencies of all source files on header files USE_DEP_FILES?=1 # For faster re-compilation. Enables precompiled headers USE_PCH?=1 # For faster re-compilation. Enables caching of compiled files USE_CCACHE?=1 # For code completion (aka intellisense) in IDE. Uses Bear tool to generate `compile_commands.json` file USE_CLANGD?=1 # For maximum log (slow and a LOT of messages) USE_VERBOSE_LOG?=1 # For compiling and running to check memory allocations and valid usage USE_SANITIZER?=1 # if ON, link engine code dynamically into the application # if OFF, link engine code statically into the application USE_DYNLIB_ENGINE?=1 # For debugging. Dumps more logs from compiler USE_COMPILER_DUMP?=1
-
If the application hasn't started yet, run it
make run
Controls:
W/S- move forward / backwardsA/D- move left / rightLEFT SHIFT + W/S- move up/downESC- exitP- wireframe modeQ- remember camera location, this location is used for culling, pressQagain to teleport to remembered location
NOTE: if some controls don't seem to work (especially ESC/SHIFT/ALT/CTRL/etc, make sure to start the application when current keyboard layout is English, any other won't work)
-
If the application is running, and you want to recompile it without stopping the application, you can use
make hot -j16
After compilation completes, the application will apply the newly compiled code automatically. It has limitations though, some code changes might crash the program, because of incompatible binary data (e.g. if you change the definitions of
class/structfields)
Everything needed to run the application is stored in the installation folder (typically ./build/release/install).
You can copy the whole folder somewhere else, and then to run the application you need:
cd <where_you_copied_install_directory>
LD_LIBRARY_PATH=. ./app