WebGL rotating F: Difference between revisions

m
syntax highlighting fixup automation
(Added Wren)
m (syntax highlighting fixup automation)
Line 15:
=={{header|Julia}}==
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.
<langsyntaxhighlight lang="julia">using Colors
using GeometryBasics: Rect3f
using GLMakie
Line 36:
sleep(0.25)
end
</syntaxhighlight>
</lang>
 
=={{header|Phix}}==
You can run this online [http://phix.x10.mx/p2js/HelloF.htm here] (which gives me around 10% CPU load, with space toggling the timer for no extra load). No teapot, sorry.
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--
-- demo\pGUI\HelloF.exw
Line 423:
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span>
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</langsyntaxhighlight>-->
 
=={{header|Wren}}==
Line 435:
 
As with any Open GL aplication, the Wren code needs to be embedded in a host application which can communicate directly with the relevant libraries and which I've written here in C.
<langsyntaxhighlight lang="ecmascript">/* webgl_rotating_F.wren */
 
import "./math" for Math
Line 1,129:
Glut.setOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS)
init.call()
drawScene.call()</langsyntaxhighlight>
<br>
We now embed the above code in the following C program, compile and run.
<langsyntaxhighlight lang="c">/* gcc webgl_rotating_F.c -o webgl_rotating_F -lglut -lGLESv2 -lm -lwren */
 
#include <stdlib.h>
Line 1,455:
free(script);
return 0;
}</langsyntaxhighlight>
10,327

edits