WebGL rotating F
Using WebGL or OpenGL ES 2.0 compatible routines draw a rotating F shape.
Specifically avoid glBegin, glVertex, glPush/PopMatrix, or glu(t/fw), however all functions needed are available in (eg) opengl32.dll.
While the Phix example below uses a somewhat fudged "Hello!" graphic, any texture or even just plain colours is perfectly acceptable.
A detailed tutorial (if code below does not suffice) can be found at https://webglfundamentals.org - specifically 2nd 3D and 1st textures sections.
- Optional extra
Allow toggling between the F shape and a classic Utah teapot.
Makie can use OpenGL as a backend for plotting (GLMakie). The code plots an 'F' as three rectangular solid-shaped scatter plots with overlapping markers, then rotates the resulting graph.
using GeometryBasics: Rect3f
topbar = vec([Point3f(i / 5, j / 5, k / 5) for i in 1:7, j in 8:3:28, k in 45:50])
stem = vec([Point3f(i / 5, j / 5, k / 5) for i in 1:7, j in 1:7, k in 1:8:56])
midbar = vec([Point3f(i / 5, j / 5, k / 5) for i in 1:7, j in 8:2:21, k in 25:29])
fig = Figure(resolution = (800, 400))
pos = fig[1, 1]
meshscatter(pos, topbar; marker = Rect3f(Vec3f(-0.5), Vec3f(16)), transparency = true,
color = [RGBA(topbar[i]..., 0.5) for i in 1:length(topbar)])
meshscatter!(pos, stem; marker = Rect3f(Vec3f(-0.5), Vec3f(16)), transparency = true,
color = [RGBA(stem[i]..., 0.5) for i in 1:length(stem)])
meshscatter!(pos, midbar; marker = Rect3f(Vec3f(-0.5), Vec3f(16)), transparency = true,
color = [RGBA(midbar[i]..., 0.5) for i in 1:length(midbar)])
for _ in 1:28
rotate!(Accum, fig.scene, 0.25)
You can run this online here (which gives me around 10% CPU load, with space toggling the timer for no extra load). No teapot, sorry.