/ComputerGraphicsWithOpenGL

Computer Graphics with OpenGL and C++

Primary LanguageC

Computer Graphics With OpenGL

This project was inspired Joey de Vries - Learn OpenGL and David Wolff - OpenGL 4.0 Shading Language Cookbook. It will illustrate some of the most common computer graphics techinques used in the industry, including topics such as primitive objects, camera system, texturing, lighting, fragment and geometry shading, shadows and screen-space filters.

Computer graphics is a field in Computer Science which studies methods for digitally synthesizing and manipulating visual content to make computers easier to interact with, and better for understanding and interpreting many types of data. It has profound impact in many types of media (graphics design, animation, 3d modelling, medical imaging, image processing, and computer vision among others) and industries (films, television, advertising and video games).

Getting Started

NOTE: The project is configured for Mac OSX using CMake.

  1. Download and install the CMake.app for Mac OS X 10.7 or later
  2. Open Terminal.app on your Mac and enter the following commands.
  3. Install CMake Command Line Tools for Terminal
% sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install
  1. Clone the project on your Mac and ensure that you have the 'build', 'src', 'Includes', 'Libraries' folders, including 'CMakeLists.txt' and ComputerGraphicsWithOpenGLConfig.h.in files.
% cd ./Downloads
% git clone https://github.com/geoo993/ComputerGraphicsWithOpenGL.git
% cd ./ComputerGraphicsWithOpenGL
% ls  

CMakeLists.txt				Libraries
README.md
ComputerGraphicsWithOpenGLConfig.h.in	build
Includes				src

NOTE: Please fetch all the large files from the resources directory using git lfs

% cd ./src/resources
% brew install git lfs
% git lfs install
% git lfs pull
Downloading LFS objects:  53% (101/190), 198 MB | 2.7 MB/s
  1. Check that all the project libraries are available
% cd ../../Libraries 
% ls
libGLEW.2.1.0.dylib           libfmodstudioL.dylib
libassimp.4.1.0.dylib         libfreeimage.3.17.0.dylib
libfmod.dylib                 libfreeimageplus.3.17.0.dylib
libfmodL.dylib                libfreetype.6.dylib
libfmodstudio.dylib           libglfw.3.2.dylib
  1. Download the missing libpng16.16.dylib shared library of libfreetype.6.dylib with Homebrew
% brew install libpng
🍺  /usr/local/Cellar/libpng/1.6.37: 27 files, 1.2MB
  1. Check that cmake is running in Terminal
% cmake --version
cmake version 3.15.2

% which cmake   
/usr/local/bin/cmake
  1. Go to the build folder
% cd ../build

and make sure you have installed Xcode Command Line Tools and pointing towards the Xcode Developer directory

% xcode-select --install # Install Command Line Tools if you haven't already.
% sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools

or alternatively specify to use the full Xcode.app (if you have it installed) with:

% sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
  1. Configure and generate the Xcode project inside the build folder
% cmake -G "Xcode" ../
% ls
CMakeCache.txt				ComputerGraphicsWithOpenGLConfig.h
CMakeFiles				cmake_install.cmake
CMakeScripts				src
ComputerGraphicsWithOpenGL.xcodeproj
  1. The Xcode project should be available in the build folder of the project. Open the Xcode project ComputerGraphicsWithOpenGL.xcodeproj and set the active scheme to ComputerGraphicsWithOpenGL target in the Build Scheme
Find and select: Product => Scheme => Choose Scheme => ComputerGraphicsWithOpenGL
  1. Build and Run ComputerGraphicsWithOpenGL in Xcode
Find and select: Product => Run

or using Terminal

% cmake --build . --target ComputerGraphicsWithOpenGL --config Debug
% ./src/Debug/ComputerGraphicsWithOpenGL

Controls

Movement:

  • Move in the scene with Arrow Keys ➡️ ⬅️ ⬆️ ⬇️
  • Toggle movement speed with O

Move Pointlights:

  • Move pointlight Up with Q
  • Move pointlight Down with A
  • Move pointlight Forward with S
  • Move pointlight Backward with D
  • Move pointlight Right with E
  • Move pointlight Left with W
  • Select pointlight with I

Look Around:

  • Move and Hold screen with 🖱️

  • Zoom with 🖱️ (Mouse wheel)

UI Interaction:

  • Click on Buttons or drag Sliders with 🖱️

Content

Objects

  • Cube
  • Sphere
  • Quad
  • Torus
  • Torus Knot
  • Metal Balls
  • Teapot
  • Planar Terrain and HeightMap Terrain
  • Trolley

Lighting

Image Based Lighting (IBL)

Image Based Lighting (IBL)


Blinn Phong Lighting

Blinn Phong Lighting


HDR Tone Mapping

HDR Tone Mapping


Shaders

Physically Based Rendering (PBR)

Physically Based Rendering (PBR)


Bump Mapping

Bump Mapping


Parallax Mapping

Parallax Mapping


Chromatic Aberration

Chromatic Aberration


Environment Mapping (Reflection and Refraction)

Environment Mapping


Disintergration

Disintergration


Fireball (Geometry Shader)

Fireball


Wireframe (Geometry Shader)

Wireframe


Porcupine / Display Normal (Geometry Shader)

Porcupine


Toon / Cell Shading

Toon Shading


Fast Approximate Anti-Aliasing (FXAA) (Geometry Shader)

Fast Approximate Anti Aliasing


Post Processing Effects

Color Inversion

Color Inversion


Gray Scale

Gray Scale


Kernel

Kernel


Kernel Blur

Image Based Lighting (IBL)


Sobel Edge Detection

Kernel Blur


Frei-Chen Edge Detection

Frei Chen Edge Detection


Screen Wave

Screen Wave


Swirl

Swirl


Night Vision

Night Vision


Lens Circle

Lens Circle


Posterization

Posterization


Dream Vision

Dream Vision


Pixelate

Pixelate


Pixelation

Pixelation


Knitted Pixelation

Knitted Pixelation


Frosted Glass Pixelation Effect

Frosted Glass Pixelation Effect


Frosted Glass Screen Wave Effect

Frosted Glass Screen Wave Effect


Cross Hatching

Cross Hatching


Predators Thermal Vision

Predators Thermal Vision


Toonify

Toonify


Shockwave

Shockwave


Fish Eye

Fish Eye


Barrel Distortion

Barrel Distortion


Multi-Screen Fish Eye

Multi-Screen Fish Eye


Fish Eye Lens

Fish Eye Lens


Fish Eye / Anti-Fish Eye

Fish Eye / Anti-Fish Eye


Gaussian Blur

Gaussian Blur


Blur

Blur


Radial Blur

Radial Blur


Motion Blur

Motion Blur


Vignetting

Vignetting


Bright Parts

Bright Parts


Bloom

Bloom


Lens Flare

Lens Flare


Screen Space Ambient Occlusion

Screen Space Ambient Occlusion


Depth Testing

Depth Testing


Depth Mapping

Depth Mapping


Directional Shadow Mapping

Directional Shadow Mapping


Omnidirectional Shadow Mapping

Omnidirectional Shadow Mapping


Deferred Rendering

Deferred Rendering


Rain Drops

Rain Drops


Palette Quantization And Dithering

Palette Quantization And Dithering


Distorted TV

Distorted TV


RGB Display

RGB Display


Retro Parallax

Retro Parallax


Money Filter

Money Filter


Microprism Mosaic

Microprism Mosaic


Bayer Matrix Dithering

Bayer Matrix Dithering


Julia Freak

Julia Freak


Heart Blend

Heart Blend


EM Interference

EM Interference


Cubic Lens Distortion

Cubic Lens Distortion


Cel Shaderish

Cel Shaderish


Cartoon Video

Cartoon Video


Built With

Acknowledgments