Over the summer I did another dive into OpenGL. Graphics still fascinate me, especially seeing the beautiful effects that can be purely mathematically generated.
I learned some more advanced features this time around, including making algorithms for generating all sorts of shapes/meshes, lighting, and instancing (a way to render many of a similar graphic primitive in parallel)!
I first had to relearn the basics of OpenGL (making 2D triangles, adding colors, rendering lines and points, etc.), but eventually (or maybe a few eventuallies) I was able to generate some points with math, connect those points together correctly, add some color, and do some movement of the generated mesh.
Here's what some of those looked like:
Next I added some Phong Lighting, which basically light objects based off how a light source hits an object, the object's natural luminescense.
Cubes moving around, acting as light sources, their color adds together on the white surface.
As a few final demos for lighting I:
One final topic I looked at was instancing, which is the ability to efficiently draw many of the same graphics primitives, such as grass. This is done by giving the GPU some mesh/item you want to draw, and instruction for how and where you want to draw some number of that item.
I generated a little map and put as many blades of grass as my integrated graphics card could seem to handle, and voila, we have an FPS (sort of?).