I have always loved programming - its like Lego without gravity.

Basic on my ZX81 graduating to assembler and Turbo Pascal during my teens.

Developed phone OS software - engineer, architect, product manager - but got made irrelevant by the iPhone and redundant by Android.

These days I mostly work with data, big data and fitting big data onto small boxes.

Rendering Spheres with Triangles

Creating spheres programmatically has turned up a couple of times recently.  So here are my own notes:

There are two general approaches:

The leftmost is termed the uv-sphere and the rightmost an icosphere.

The uv-sphere looks like a globe. For many purposes it is perfectly fine, but for some use cases, e.g. if you want to deform the sphere, it is disadvantageous that the density of vertices is greater around the poles.  The icosphere vertices are distributed evenly.

GLUT tends to use the uv approach: look at the function glutSolidSphere() in the freeglut sourcecode.

And webGL doesn’t have glutSolidSphere().  Oh well.  Here’s my code for creating an untextured icosphere online.

Here is an excellent article on producing an icosphere: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html

I’ve also experiemented with tiling spheres for RTS games etc.  Here’s an excellent guide to how you might divide the sphere surface into zones: http://kiwi.atmos.colostate.edu/BUGS/geodesic/text.html

Finally, texturing.  http://vterrain.org/Textures/spherical.html gives an excellent description of how you might choose to texture them, and http://www.iquilezles.org/www/articles/patchedsphere/patchedsphere.htm is - as iñigo is - brilliant.

jump to ↓



performance
Faster searches with non-prefix fields in composite indices
Compressing MySQL databases
What highscalability.com says about Scaling my Server
Scaling my Server: follow-up
old classics
The kid's computer
Making the History of Worlds Religions map
If you defend those involved in the OpenGL ES specification, you are an idiot
Stackoverflow unwinding?
general
Why Swift?
Python annotations and type checking
pycon 2014 Sweden: the bad bits
Table-based Template Translation in C++
recreation
games programming
Perlin Noise
Perlin Noise
Drawing RTS maps fast
WillCity update
ludum-dare
Ludum Dare #35 Mosaic
LudumDare 33 wallpapers
SSIM vs MSE for Mosaics
Ludum Dare 30 results are in!