twilight.c for WebGL

Haven’t really put pen to paper on this yet but as an exercise to learn some WebGL basics I’m looking at porting the old SGI twilight.c over to WebGL. The original twilight.c was written using the old IRIS GL API, but there is a newer, yet still obsolete port by tweakoz on GitHub that I’ll probably also reference. The twilight sidebar I’m using on this site was generated from this version running on my Mac.

I’ve done approximately zero GL programming on any level so hopefully this will be a good learning experience.

Both the original SGI version and the OpenGL port use the old “fixed pipeline” mode that was in use before programmable GPUs came along, so I’ll have to figure out how to write vertex and fragment shaders instead. The IRIS GL version uses polygons and boxes to draw the sky/horizon and the larger stars but I think those functions are gone in modern versions of OpenGL/WebGL so those need to be converted into triangles. Not terribly difficult since the twilight background is two rectangles. The OpenGL version linked above uses GL_QUAD for the sky/horizon and GL_POINT_SMOOTH for the larger stars both of which I’m fairly sure aren’t supported in WebGL.

Here’s a link to the repo on my GitHub: twilightjs

And a link to the running version (very, very in progress): halfmanhalftaco.com/twilightjs