Skip to content

voldien/OpenGL-Samples

Repository files navigation

Linux Build License: MIT

OpenGL Sample Repository - Work In Progress

github_opengl_thumbnail

A collection of OpenGL Samples, work in progress, for personal educational purposes.

CLI - Command Line Options

Usage:
  OpenGL Sample: GLSample [OPTION...]

 GLSample options:
  -h, --help                   helper information.
  -d, --debug                  Enable Debug View. (default: true)
  -t, --time arg               How long to run sample (default: 0)
  -f, --fullscreen             Run in FullScreen Mode
  -v, --vsync                  Vertical Blank Sync
  -g, --opengl-version arg     OpenGL Version (default: -1)
  -F, --filesystem arg         FileSystem (default: .)
  -r, --renderdoc              Enable RenderDoc
  -W, --width arg              Set Window Width (default: -1)
  -H, --height arg             Set Window Height (default: -1)
  -D, --display arg            Display (default: -1)
  -R, --dynamic-range arg      Set Dynamic Range ldr,hdr16,hdr32 (default: 
                               hdr16)
  -m, --multi-sample arg       Set MSAA (MultiSampling) (default: 0)
      --super-multisample arg  Set Super MultiSampling MSAA (default: 0)
  -p, --use-postprocessing     Use Post Processing (default: true)
  -C, --disable-colorspace     Use Color Space Convertion
  -s, --glsl-version arg       Override glsl version from system 
                               (110,120,130,140,150,330...) (default: -1)

Graphic Based Samples

Triangle

Texture Texture

PointLights

SkyboxPanoramic

SkyboxPanoramic

Fog

Irradiance

Instance

Subsurface Scattering Subsurface Scattering

Normal

PhongBlinn PhongBlinn

Terrain

FrustumCulling

BasicShadowMapp

BasicShadowMap PCF BasicShadowMap PCF

PointLightShadow PointLightShadow

ProjectedShadow

Shadow Volume

MipMapVisual

AmbientOcclusion

AmbientOcclusion AmbientOcclusion AmbientOcclusion AmbientOcclusion

Physical Based Rendering

Physical Based Rendering Physical Based Rendering Physical Based Rendering

Panoramic Panoramic

SimpleOcean

Compute Shader Base Examples

GameOfLife

MandelBrot

VectorField2D

ComputeGroup

MarchingCube MarchingCube

RigidBody

PostProcessing Effects

  • Chromatic Aberration

  • Sobel Edge Detection

  • Screen Space Ambient Occlusion

  • Gaussian/Box Blur

  • Mist Fog

  • Volumetric Scattering

Volumetric

Volumetric

  • ColorSpace

  • Pixelate

  • Grain

  • Bloom

  • Contact Shadow

  • Vignette

Required Packages

sudo apt-get install pkg-config libsdl2-dev libfreeimage-dev libfmt-dev libglm-dev libgtest-dev googletest mesa-common-dev mesa-utils libopenal-dev libalut-dev
sudo apt-get install glslang-tools libavcodec-dev libavformat-dev libswscale-dev libavutil-dev binutils-dev libeigen3-dev libglu1-mesa-dev libbz2-dev libzip-dev libogg-dev libopus-dev libvorbis-dev libssl-dev

Build Instruction

git submodule update --init --recursive
mkdir build && cd build
cmake ..
make
make DownloadAsset

License

This project is licensed under the MIT License - see the LICENSE file for details

Models downloaded from Morgan McGuire's Computer Graphics Archive

Misc Notes

Force NVIDIA Usage

Force the system to try to use the NVIDIA GPU. This is very useful when using a system with multiple GPUs.

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia program arguments

Mesa

MESA_DEBUG=1
MESA_GLSL=source
MESA_SHADER_DUMP_PATH=dump
INTEL_DEBUG=perf

Export Build to Target Directory

Build Asset File

tar

Setup Build.

cmake .. -DCMAKE_INSTALL_PREFIX=/target -DCMAKE_BUILD_TYPE=Release

Install

cmake --build . --parallel $(nproc --all) --target install ;