Posts

C++ Naming Conventions - Code Complete 2nd Edition

C++ Game Project - 1 - Rendering Fonts

Image
Figured out how to render fonts using FreeType and OpenGL.

Learning Points:
Orthographic projections and the device coordinate system.Font metrics and FreeType library.Resource Pools and Factory designs.GLM library.
References:
https://www.freetype.org/freetype2/docs/tutorial/step2.htmlhttps://open.gl/https://learnopengl.com/In-Practice/Text-Rendering

OpenGL Transform Feedback

Image

Programming Adventures 2 - Unity3D Translation

Image
Programming Adventures 2 - Unity3D Translate When moving objects using gameObject.transform.translate(x,y,z), its direction is based on the object's local transformation.

That means that a square object rotated 90 degrees right will translate +Y when translated by (10, 0, 0).

This bug happens when trying to translate objects using world space vectors.


Solution The solution is to use gameObject.transform.SetPositionAndRotation( gameObject's position + translation direction, __); this avoids the local transformation stack!

Programming Tricks 1 - PHP and JS/CSS

Programming Tricks 1 PHP When creating PHP scripts, there is a funny error that if there are spaces before the first <?php tag, the session information is sent before the php script is executed.

So if you get:
 [22-Sep-2019 12:09:17 America/New_York] PHP Warning:  session_start(): Cannot start session when headers already sent in /home/esceqrkk/groundstationdatabase/main.php on line 3  And there is no code before that main.php file, it's due to the spaces.

Javascript + CSS A super easy way to animate and control your CSS animations is to use css transitions, css variables and jquery all in one go for example:

JQuery side:
var currentXTranslation = 0; $(document).ready(function () { $("#NavigateLeftButton").hide(); $("#NavigateLeftButton").click(function(evt) { currentXTranslation += 100; $(':root').css('--current-x-translation', currentXTranslation + "vw"); CS…

Project 6: Marching cubes algorithm and metaballs.

The marching cubes algorithm is a way of creating polygons from volumes of data. The data it works on is varied such as 1 / R^2 (the one used to produce metaballs) and a noise function like perlin noise.

My implementation of marching cubes in a nutshell is initially the scene is split into a 3d grid of voxels, then at the corners and center of each voxel an isovalue is calculated (to form the isosurface).
Then using the comparison between the isovalue at each vertex with a threshold value, a table of indices which tell you which edges have been intersected and how each edge is connected to form the triangle facets is referenced.

To generate metaballs from this technique, i used the function 1 / distance^2 to calculate the isovalues at vertices.

Calculating the normal at each triangle facet was done through assuming that each point charge in the scene was a sphere, and the triangle was sitting on the surface of each sphere, individually taking the normals each time. I then took the ave…