NGL Demos

The following programs demonstrate NGL along with various graphics techniques. There are now some interactive WebGL Demos, you will need to have WebGL enabled with the browser click on links for demos.

BlankNGL


This is a blank NGL project that creates an empty Qt OpenGL window with basic key control framework, it also has methods implemented for initializeGL, paintGL and resize window

git clone git@github.com:NCCA/BlankNGL.git

Simple NGL Demo


This demo shows a basic Qt OpenGL window and how to use ngl for a simple drawing project. It uses a simple PBR metal shader.


git clone git@github.com:NCCA/SimpleNGL.git

SDL NGL Demo


This demo show how to use the NGL library with SDL (2.0). At the University SDL2 is installed, if you need to use it on your own machine use vcpkg.

git clone git@github.com:NCCA/SDLNGL.git

VAOPrimitives Demo


This demo demonstrates how to use the build in primitives in NGL

git clone git@github.com:NCCA/VAOPrimitives.git

Vertex Array Objects


A series of demos used in the lecture on Vertex Array Objects and Vertex Buffers, this also introduces the ngl VAO factories and how to use them .

git clone git@github.com:NCCA/VertexArrayObject.git

Creating a Virtual Camera


This demo show how to create several Cameras and use them

git clone git@github.com:NCCA/Camera.git

SDL_TTF Text rendering with SDL


This Demo replaces the ngl::Text class to use SDL_ttf instead of the Qt font rendering. Use this if you are not using Qt for your project

git clone git@github.com:NCCA/SDLTTF.git

lookAt demos


Two demos showing how to use the lookAt, persprctive and ortho utility methods. The first demo is a simple lookAt example the 2nd creates a simple maya style interface where we can zoom to different windows etc.

git clone git@github.com:NCCA/LookAtDemos.git

Simple Lighting


This demo show how to use the Light and Material classes to generate a series of PointLights and render using Phong shading

git clone git@github.com:NCCA/Lights.git

Simple Spotlights


This demo show how to generate a simple spotlight

git clone git@github.com:NCCA/SpotLight.git

Shading Models


A series of demos used in the lecture on Shading Models. This builds from simple constant shading to PBR.

git clone git@github.com:NCCA/ShadingModels.git

Klein Bottle Demo


This program demonstrates the production of a Klein bottle based on the code from this excellent website It uses the ngl::SimpleVAO class

git clone git@github.com:NCCA/KleinBottle.git

Texturing Demos


These demos are part of the lecture on Texturing in OpenGL

git clone git@github.com:NCCA/Textures.git

Image Based Heightmap


Generates a heighmap grid where the height of the mesh is based on the Red channel of the image. This demo doesn’t use the ngl::VertexArrayObject class so it also demonstrates the direct access to OpenGL VertexBufferObjects and VAO’s not using NGL.

git clone git@github.com:NCCA/ImageHeightMap.git

ngl::Obj Demo


A demonstration of using the ngl::Obj class to load a mesh

git clone git@github.com:NCCA/ObjDemo.git

Game Key Controls


This demo shows how to do game style control and movement of an object in Qt, read the blog post for more details

git clone git@github.com:NCCA/GameKeyControl.git

Advanced Game Key Controls


This demo takes the code above and uses a different method to do game style control, it also has the ability to record and playback the keystrokes, including saving them to file.

git clone git@github.com:NCCA/AdvancedGameKeyControl.git

SDL Joypad Demo


A demo using the SDL2 Joypad code, you may need to re-map the controller depending upon type. This is setup to use an XBox controller.

git clone git@github.com:NCCA/SDLJoyPad.git

Using Interpolation templates


A demonstration of the interpolation templates built into NGL

git clone git@github.com:NCCA/Interpolation.git

Using ngl::Quaternion


This demo demonstrates how to convert from a Rotation matrix and a Quaternion. Two matrices are generated and the slerp method is used to interpolate between them

git clone git@github.com:NCCA/QuatSlerp.git

Generating Curves


Two demos to show the ngl::BezierCurve class, the first demo is a simple 4 point curve the second code bundle contains a simple python script to export all curve cv values from Maya into a text file which is loaded into the program. There is also a demo showing how to use geometry shaders to produce curves

git clone git@github.com:NCCA/CurveDemos.git

Collision Detection Demos


A series of programs showing Ray-Sphere, Ray-Triangle, Sphere-Sphere, Sphere-Plane collision detection algorithms

git clone git@github.com:NCCA/Collisions.git

Abstract Octree


An Abstract Octree template to use in your own projects, this code is originally writen by my collegue Dr Xiaosong Yang for his advanced collision detection lectures and templated and ported to ngl by me.

git clone git@github.com:NCCA/OctreeAbstract.git

Particle Systems


some basic particle system demos.

git clone git@github.com:NCCA/ParticleSystem.git

Particle Factory


This demo demonstrates the use of the factory pattern and runtime polymorphism. Note this is not a good way to generate a particle system just a nice visual demo.

git clone git@github.com:NCCA/ParticleFactory.git

Selection using Unique Colour values


Picking of objects using Colour values based on this post

git clone git@github.com:NCCA/ColourSelection.git

ngl::PointBake Demos


This demonstrates loading in a Mesh (obj) and PointBake animation data from my Maya Exporter ( see here ). The basic principle is load an Obj Mesh, then the PointBake per frame animation data, then we update the verts per frame. see NGL::PointBake class for more details and also this blog post

git clone git@github.com:NCCA/PointBake.git

Blend Shape using Objs


This demo show how to do basic Blend Shape animaiton using the GPU based on the technique shown here

git clone git@github.com:NCCA/MorphObj.git

The second demo does the same thing but morph targets are passed as a texture buffer object instead.

git clone git@github.com:NCCA/MorphObjTBO.git

Facial Animation using Blend Shapes


This demo show how to do basic Blend Shape animation using the GPU based on the technique shown here it loads in a simple list of data for each of the meshes and then morphs them



git clone git@github.com:NCCA/FacialAnimation.git

Using libassimp


These demos show how to use assimp to load meshes and do skeletal animation with ngl

git clone git@github.com:NCCA/AssetImportDemos.git

Embedding Python in NGL


This demonstrates how to embed python scripts into NGL (and in general any C++ program) It uses a simple python script to animate two Spheres (a different script for each Sphere) more details here

git clone git@github.com:NCCA/EmbedPython.git

Qt GUI and NGL


This is the code to accompany the Video Tutorial here

git clone git@github.com:NCCA/QtNGL.git

Mass Spring System using RK 4 integration


A Simple Mass spring system using RK4 integration, the integrated is an Abstract class so it may be re-implemented to use different equations for the simulations

Some of the code is based on this post

git clone git@github.com:NCCA/MassSpring.git

Affine Transforms


This demo show how to build affine transform using a series of matrices in ngl. This demo also demonstrates how you use Qt GUI components with ngl and OpenGL

git clone git@github.com:NCCA/AffineTransforms.git

Geometry Shaders


A simple demo showing how to draw Face and Vertex Normals using Geometry Shaders

git clone git@github.com:NCCA/GeometryShaders.git

Tessellation Shader

This demo is the one written for this blog post and implements this code

git clone git@github.com:NCCA/TessellationShader.git

Animated Textures


This demo uses several sprite sheets of fire to generate an animated fire using billboards. The billboards are generated on the GPU using a geometry shader and the data for the frames / animation is passes using attributes.

git clone git@github.com:NCCA/TessellationShader.git

Instancing Methods in OpenGL


These three demos show different ways of using Transfrom Feedback to generate instanced geometry.

These are Uniform Buffer Object Instancing, Texture Buffer Object instancing and Divisor Instancing.

git clone git@github.com:NCCA/Instancing.git

Normal Mapping


This demo uses the ngl::Obj and ngl::VertexArrayObject classes to read in a mesh then construct an extended VAO passing in Tangents and Bi-Tangents (BiNormals) to glsl as attributes. This is then used to do normal mapping along the lines of this

git clone git@github.com:NCCA/NormalMapping.git

Using Frame Buffer Objects


A number of demos showing how to use Frame buffer objects, including real time shadows and render to FBO demos

git clone git@github.com:NCCA/FBODemos.git

Sponza Demo


A basic framework to load a Wavefront OBJ file with groups and an MTL file with textures and draw the scene as efficiently as possible. The source contains the models and textures from here and is quite large
For a detailed look at how this work see the following blog posts initial design The mtl class Grouped Object class

git clone git@github.com:NCCA/Sponza.git

Using Bullet Physics


Using the Bullet Physics with NGL, the demo has basic wrappers for the Physics world and rigid bodies, it also uses the ngl::Obj to load low-res collision meshes and uses higher detail ones for the drawing.
For more details read the user guide

git clone git@github.com:NCCA/BulletNGL.git
git clone git@github.com:NCCA/BulletNGLTower.git

Box2D and NGL


This demo uses Box2D to do basic 2D physics using NGL to draw and setup and orthographic 2D world (but rendered in 3D). It creates a number of passive bodies as platforms and one moving kinematic moving platform. The player is moved using impulses applied when the keys are pressed

git clone git@github.com:NCCA/Box2D.git

The next demo has a simple python maya script to export data that can be used in a C++ program.

git clone git@github.com:NCCA/Box2DExport.git
Previous