This project uses a variety of external libraries found through LearnOpenGL.com and is currently compiled with visual studio 2017. In order to compile these libraries (If the FinalProject.sln does not build and run on your machine), Open the "LearnOpenGL-master" folder and run CMake on this. If you are utilizing the CMake GUI, Put the "LearnOpenGL-master" as your source and for build, copy and past the path of the source and add "/build" afterwards. Once comlete, then click "Configure", and then click this button once more when finished to get rid of the red directories. Then, click "Generate" to make the project in a platformand click "Open Solution".
Now, build the solution from your platform. Once done, move the contents of the include and libraries directories to the "OpenGL Stuff" folder and place them in their respective folders.
Each of these files is to demonstrate different aspects of geometry shaders.
Pressing the number keys (on the main keyboard, not the number pad) will change the amounts of lines the geometry shader draws. Press the enter key to set the detail level to 100 points. Pressing the space bar will increase the detail level incrementally, up to the maximum.
In some projects, you can change the view between seeing the lines and the points being drawn with either the page up, page down, home, end, up, or down keys depending on the project.
Now for what is being accomplished: I have implemented a geometry shader, which is a shader that lies in between the vertex and fragment shaders that is capable of manipulating vertex information. In these examples, the main program only sends the vertex shader a single point, that being the middle of the screen. All other points and lines are generated by the geometry shader. What this allows for is for models to be defined by a series of functions, and then the complexity of what is rendered is determined by a client. This allow for greater flexibility across devices of varying power, all of which utilizing the same code.
Project walkthrough:
NOTE: See Walkthrough.mp4 for a video demonstration of these projects.
-
xSquaredGeometryShader In this, a geometry shader is used to define the f(x) = x^2 function with varying levels of detail. (1-10 and up/down on keyboard).
--Controls-- (1-10) Set the complexity level (number of points that define a curve) (Space-Bar) Increment the complexity level
-
Polygons This project shows the capability of generating symmetrical polygons with a varying number of points, and acts as a foundation for the following projects. In this, you can change the number of vertices using 1-10 or up/down on the keyboard.
--Controls-- (1-10) Set the number of sides the polygon has (Space-Bar) Increment the number of sides
-
Expanding Circle This project shows how you can animate an object as time progresses and change the color of said object over time.
--Controls-- (1-10) Set the number of sides the polygon has (Space-Bar) Increment the number of sides
- Rose This project shows how you can define a complex shape with varying level of complexity with the geometry shader. Here we graph a rose curve and show the trace of a particle orbiting said curve.
--Controls-- (1-10) Change the number of petals on the curve (Home) Set shader to line mode (End) Set shader to point mode (Page up) Increase the complexity of curve (Page down) Decrease the complexity of curve (Up) Increment the amount of petals (Down) Decrement the amount of petals
- Fireworks This project demonstrates the capabilites of defining a firework off of a single point. This "Firework" generates a variable number of particles with a multi-layered effect where each layer has a different color. Also, as the firework explodes outward, the color fades to black (Like how a firework's flame burns out over time).
--Controls-- (1-10) Set the number of particles (Space-Bar) Increment the number of particles
- ParticleSystem Shows how one can generate particles scattered around a single point, each with a unique color. This can be used for clouds, fireworks, water, tornadoes, or whatever may be the circumstance.
--Controls-- (1-10) Set the number of particles (Space-Bar) Increment the number of particles (Enter) Set the number of particles to 100